Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
the output executable is still linked to the old linux loader. WTF? I can force it by passing "-Wl,--dynamic-linker=/usr/glibc2/lib/ld-linux.so.2" to it every single time I run gcc, but that's not really a solution. I know it's somehow a problem with how I compiled GCC. I tried cross-compiling gcc with /usr/glibc2 as the system root, but it fails at the stage one compiler, saying it can't find certain symbols which I can see in /usr/glibc2/lib/ld-linux.so.2, so I know that its not using the right loader either.
( note that the gcc you built and installed has to be the first one in your path for this to work, if not, then you need to adjust your path. for example, if the newer gcc was installed in /usr/local and gcc is in /usr/local/bin:
will make the one in /usr/local/bin the first one encountered when you enter the command gcc. also, what configure options did you pass when you built the new gcc?)
It would probably help if you stated what you are trying to accomplish, if you are building another system, it might help if you look here:
I've tried dozens of different configurations, and I always come up with linker errors. The only way I can get it to continue is to actually switch the makefile mid-build. I can't imagine that makes for a usable compiler.
I figured out that my gcc has compiled in specs. I just did "./configure ; make bootstrap" for the thing. I did a "gcc -dumpspecs", and I assume the important lines are:
and that should be /usr/glibc2/lib/ld-linux.so.2 (at least at compile time). I'm using the compiler flag -Wl,--dynamic-linker=/usr/glibc2/lib/ld-linux.so.2, but I still get unresolved symbols.
Last edited by dombrowsky; 01-17-2006 at 02:48 PM.
Got it to build this time, but the compiler won't work without hacking.
/home/davek/src/gcc-build/gcc/xgcc -Bgcc test.c
/usr/glibc2/lib/libc.so.6: undefined reference to `_rtld_global@GLIBC_PRIVATE'
/usr/glibc2/lib/libc.so.6: undefined reference to `__libc_enable_secure@GLIBC_PRIVATE'
/usr/glibc2/lib/libc.so.6: undefined reference to `_rtld_global_ro@GLIBC_PRIVATE'
/usr/glibc2/lib/libc.so.6: undefined reference to `_dl_out_of_memory@GLIBC_PRIVATE'
/usr/glibc2/lib/libc.so.6: undefined reference to `_dl_argv@GLIBC_PRIVATE'
collect2: ld returned 1 exit status
those symbols are defined in /usr/glibc2/lib/ld-linux.so.2. I know the compiler us using that as the linker, becuase it prints it in the specs. However, the executable is still linked to old libs.
The compiler won't run without flags, for example ->
gcc -Wl,-rpath,/usr/glibc2/lib test.c
anyone know what I configured wrong? The tests won't pass if it has to pass those wierdo flags to it.
I also noticed something else. Observe ->
$ export LD_LIBRARY_PATH=/usr/glibc2/lib
$ gcc test.c
/usr/local/lib/gcc/i686-pc-linux-gnu/4.0.2/../../../../i686-pc-linux-gnu/bin/as: /lib/ld-linux.so.2: version `GLIBC_PRIVATE' not found (required by /usr/glibc2/lib/libc.so.6)
isn't 'as' in binutils? Perhaps I should recompile binutils with new glibc first.
From reading the linux from scratch pages, I realize that I didn't understand something fundamental about the process. Rebuilding glibc is basically building a new system. You have to bootstrap it by first building
new tools with old libs and then new tools with the new libs. A much longer process than I thought....
I now have a compiler which will automatically link to the new glibc libraries. My previous approach was actually correct, I was just doing things in the wrong order. In short, here's how to construct a new glibc system from sources:
Compile binutils using old gcc
Compile new gcc using bootstrap and old gcc
Compile new glibc using new gcc
recompile and install ld in binutils with LIB_PATH=/usr/glibc2
recompile and install new gcc using new glibc. this is the hard part, it requires figuring out how to get gcc to link to the new libraries. In my system, I gcc compiled by default WITHOUT a specs file, so I had to change gcc/config/i386/linux.h to point to the new linker, then add LDFLAGS=-Wl,--dynamic-linker=/usr/glibc2/lib/ld-linux.so.2 . This is the part of the process which requires the most magic
recompile and install binutils using new-linked gcc in /usr/glibc2