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

Ian Lance Taylor iant@google.com
Fri Aug 26 19:52:00 GMT 2011


Bryan Ischo <bryan@ischo.com> 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



More information about the Gcc-help mailing list