This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: --with-sysroot and --with-build-sysroot


Anyone?

Marco Trudel wrote:
Hey all

I don't really understand the meaning and difference of --with-sysroot and --with-build-sysroot. From http://gcc.gnu.org/install/configure.html:

 > --with-sysroot=dir
 > Tells GCC to consider dir as the root of a tree that contains a
 > (subset of) the root filesystem of the target operating system.

The GCC that is used to compile the current GCC source or the final compiled GCC later at runtime? I assume for both.


> Target > system headers, libraries and run-time object files will be searched > in there.

I'm compiling a build=i686-pc-linux-gnu host=i686-pc-linux-gnu target=i686-pc-linux-gnu. I put glibc and glibc-devel into sysroot. This worked with GCC 4.2 but fails with GCC 4.3 because "linux/limits.h" can't be found [1].
I'd say GCC 4.3 does the correct thing but how then was GCC 4.2 able to compile the setup? I always assumed that "--with-sysroot" is for the created compiler and "--with-build-sysroot" for the compiler compiling the new compiler.


Also I'm doing a build=i686-pc-linux-gnu host=i686-pc-mingw32 target=i686-pc-linux-gnu compilation with also --with-sysroot set and containing glibc and glibc-devel. That works with GCC 4.2 and GCC 4.3. I would have assumed that GCC 4.3 also fails because it already fails for a host=i686-pc-linux-gnu.


> --with-build-sysroot=dir > Tells GCC to consider dir as the system root (see --with-sysroot) > while building target libraries, instead of the directory specified > with --with-sysroot.

So this overwrites --with-sysroot for target libraries. What is --with-sysroot then left to be used for? target binaries? Other things?


> This option is only useful when you are already > using --with-sysroot. You can use --with-build-sysroot when you are > configuring with --prefix set to a directory that is different from > the one in which you are installing GCC and your target libraries.

So assumed I have:
--prefix=/home/me/gcc-tmp
--with-sysroot=/home/me/gcc-tmp/sysroot

But will finally install it into /home/me/gcc. What do I have to set --with-build-sysroot to? What for? The sysroot will be found relative to the GCC binaries because it is a subdirectory of the prefix.


> This option affects the system root for the compiler used to build > target libraries (which runs on the build system); it does not affect > the compiler which is used to build GCC itself.

And --with-sysroot is used for both? Then for my setup (having sys-root as a subdir of prefix) makes --with-build-sysroot superfluous?
Where then makes --with-build-sysroot sense? Assumed I do:
--prefix=/home/me/gcc-tmp
--with-sysroot=/home/me/sysroot
Won't it be found absolutely when moving gcc to /home/me/gcc? Or do I still have to set build-sysroot to /home/me/sysroot?



thanks Marco

[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30832



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]