Would it make sense to have sysroot come from an environment variable?
Ian Lance Taylor
iant@google.com
Fri Aug 26 21:43:00 GMT 2011
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
More information about the Gcc-help
mailing list