Creating GCC with glibc in a non-standard place without root

I have a system that I do not have root access to, but I need to install the current version of GCC (4.7.2) on.

The system launches the x86_64 Linux 2.6.18 build and already has GCC 4.1 (without C ++ support, although --version says it was built with it).

EDIT 5: At this point, the steps below are just one set of things I've tried. Since then I have started cleaning several times. I am looking for someone to describe in detail the exact order that I need to do everything with all the necessary switches.

This is the process that I went through so far (where ROOT is the folder in my home directory)

make-3.82>./configure --prefix=$ROOT && make && make install && hash -r binutils-2.23>./configure --prefix=$ROOT && make && make install autoconf-2.69>./configure --prefix=$ROOT && make && make install automake-1.9>./configure --prefix=$ROOT && make && make install flex-2.5.37>./configure --prefix=$ROOT && make && make install libunwind-1.1>./configure --prefix=$ROOT && make && make install gcc-4.7.2-scratch>../gcc-4.7.2/configure --prefix=$ROOT \ --disable-multilib --disable-nls --enable-languages=c,c++ \ && make && make install && hash -r ncurses-5.9>./configure --prefix=$ROOT && make && make install texinfo-4.13>./configure --prefix=$ROOT && make && make install glibc-2.14-scratch>touch $ROOT/etc/ld.so.conf 

The glibc patch with the patch from http://sourceforge.net/apps/trac/unattended/wiki/ModifyingTheBootDisk#PatchGLibc (correct line numbers for 2.14)

 glibc-2.14-scratch>../glibc-2.14/configure --prefix=$ROOT \ --with-headers=$3_3_4_HEADERS && make && make install 

The flags that I added should have undefined reference to '__isoc99_sscanf' rid of undefined reference to '__isoc99_sscanf' . I donโ€™t know which combination of flags was really necessary to fix this, but this fixed the problem with these flags.

 gcc-4.7.2-scratch2>../gcc-4.7.2/configure --prefix=$ROOT \ --disable-multilib --disable-nls --enable-languages=c,c++ \ CPPFLAGS="-I$ROOT/include" CFLAGS="-g -O2 -lc" \ CXXFLAGS="-g -O2 -lc" LDFLAGS="-L$ROOT/lib \ -L$ROOT/lib64" && make && make install 

Now I get this error during the GCC build:

 build/genmddeps ../../gcc-4.7.2/gcc/config/i386/i386.md > tmp-mddeps build/genmddeps: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by build/genmddeps) 

The error makes sense because libc in / lib64 is version 2.5, but I donโ€™t know how to get GCC to use the one I built that was installed in $ ROOT / lib.

EDIT 1: Adding -rpath did not help, but I added the lib directories to LD_RUN_PATH and LD_LIBRARY_PATH. With this set, I could not start anything because I was getting the error [program_name]: error while loading shared libraries: /home/mrambiguous/root/lib/libc.so.6: ELF file OS ABI invalid

Another weird thing to note is that when I tried the -rpath clause, I started getting errors from GCC about unrecognized command line options (like -V). I had to install it to use the GCC 4.1 system. Now I'm not sure if my first GCC build was somehow distorted or if it was ever used in the first place.

EDIT 2: I just opened libc.so.6 in vim to find out if I can find anything in ABI as plain text and there is copyright information there. libc ABIs: UNIQUE IFUNC

He also confirms that GCC 4.7.2 worked in the same block of text. Compiled by GNU CC version 4.7.2

EDIT 3: Removed $ ROOT, reinstalled everything, the same problem of not recognizing -V and -qversion as valid parameters.

EDIT 4: I tried to edit the ELF header using brandelf -t SVR4 libc.so.6 , but this just gives me a new error unexpected PLT reloc type 0x25

+8
gcc linux glibc
source share
1 answer

I'm in a hurry, so I canโ€™t analyze your error messages in detail.

New glibc and old glibc are not only incompatible with ABI, but also headers, see gcc bug 52922 .

Therefore, any confusion will lead to errors that you met, you need to be extremely careful.

Manual tuning is hopelessly tiring.

If your goal is to use gcc-4.7.2, I recommend you Gentoo Prefix . I have many examples of the Gentoo prefix running on RHEL 5 (you have a 2.6.18 kernel, gcc-4.1, and glibc-2.5, just like you). This compiles gcc-4.7.2 on top of glibc-2.5.

If you want to have some fun using the new glibc, check out Prefix / libc . However, this is work in progress. Expect a lot of damage. But this will not be a big rollback, because you are trying to compile a modern toolchain manually, right?

+4
source share

All Articles