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

Bryan Ischo bryan@ischo.com
Fri Aug 26 21:51:00 GMT 2011


On 08/26/11 14:42, Ian Lance Taylor wrote:
> Bryan Ischo<bryan@ischo.com>  writes:
>
>> On 08/26/11 13:56, Ian Lance Taylor wrote:
>>> Bryan Ischo<bryan@ischo.com>   writes:
>>>
>>>> Thank you for your reply.  So just to be clear, are you saying that I
>>>> would configure gcc --with-sysroot=DIR, and then at runtime I can do:
>>>>
>>>> $ mv DIR DIR.moved
>>>> $ /some/random/path/to/gcc
>>>>
>>>> And that gcc, which was installed in a place that had nothing to do
>>>> with DIR, will somehow know that I moved DIR?  How does it do that?
>>> Yes, that is what I am saying.  The key is that gcc itself is under
>>> DIR--it's in DIR/bin.  It looks at argv[0] to see where it was run from.
>>>
>>> Ian
>> Now I'm really confused.  My example doesn't have gcc under DIR; it's
>> under /some/random/path/to/gcc.  sysroot is for header files and
>> libraries, or at least that's how it's described in all documentation
>> I have read.  Here is what the gcc manual says about --sysroot:
> I'm sorry, you're quite right.  I was confusing two different ideas.
>
> --sysroot points to an existing directory which holds header files and
> libraries.
>
> --prefix is what I was thinking of.  gcc is installed in ${prefix}/bin,
> and the ${prefix} directory can be moved around at will.
>
> You can use the --sysroot option with gcc to specify the sysroot at
> runtime.  There is no environment variable for that, though.
>
> Sorry for the confusion.
>
> Ian

No problem, thanks for the clarification.  I think my original question 
then still stands, which is, rather than having to pass --sysroot to 
every toolchain command (binutils needs this too, right?), would a 
single SYSROOT environment variable make more sense?

Thank you,
Bryan



More information about the Gcc-help mailing list