Would it make sense to have sysroot come from an environment variable?

Bryan Ischo bryan@ischo.com
Fri Aug 26 19:23:00 GMT 2011


On 08/26/11 11:56, Bryan Ischo wrote:
> I'm still trying to get my head around all of the search paths that 
> the GNU toolchain uses and when it uses them and how it gets them.  
> I'm wondering if it makes any sense at all for the toolchain to accept 
> sysroot via an environment variable; for the purposes of this 
> discussion I would propose that this variable be SYSROOT.
>
> I suggest this only because I'm trying to create a fairly 
> self-contained build of the compiler toolchain that is as 
> 'relocatable' as possible, and one problem is that I can put libraries 
> and headers (for gcc, glibc, and the kernel) into a sysroot directory 
> of my choosing that I can move around as I need to, but then making 
> the toolchain use that sysroot requires passing --sysroot flags to the 
> appropriate tool at the appropriate time; and it seems like since the 
> sysroot would be a fixed value that would be used identically for all 
> tools in the toolchain, getting this value from an environment 
> variable would be much more convenient and seamless.
>
> Would it make any sense to do this?  If so, would it be as simple as 
> patching the tools to look at a SYSROOT environment variable to get 
> their sysroot if none has been specified on the command line?
>
> Thank you, and best wishes,
> Bryan
>

As a followup: does GCC_EXEC_PREFIX (which I just read about) already do 
what I am suggesting?  It would seem like it does; it seems like it's a 
single one-stop place to put a prefix that would allow a completely 
relocatable toolchain + sysroot all in one.

Thanks,
Bryan



More information about the Gcc-help mailing list