On 08/26/11 12:52, Ian Lance Taylor wrote:
Bryan Ischo<bryan@xxxxxxxxx> writes:
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?
If you configure gcc using --with-sysroot=DIR, then you should be able to
move around DIR and have everything continue to work seamlessly. You
will run DIR/bin/gcc and gcc will figure out everything from there.
Ian
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?
Thanks,
Bryan