Search code examples
gccprefixbinutils

Change gcc/binutils --prefix


I once build and installed gcc and binutils with a wrong prefix (--prefix=/home/.../usr) passed to the configure script.

Now I reconfigured, rebuilt and reinstalled gcc and binutils with the right prefix (--prefix=/usr), however compiling always fails with:

$ /bin/ld: cannot find /home/../usr/lib/libc.so.6

Of course I could symlink the libraries in order to get it working, but I would like to know in which file these paths are saved and how I can change them.


Solution

  • Now I reconfigured, rebuilt and reinstalled gcc and binutils with the right prefix (--prefix=/usr), however compiling always fails with:

    $ /bin/ld: cannot find /home/../usr/lib/libc.so.6

    You probably have not rebuilt and re-installed libc, and the error comes from it.

    On Linux, libc.so is a linker script, similar to this:

    /* GNU ld script
       Use the shared library, but some functions are only in
       the static library, so try that secondarily.  */
    OUTPUT_FORMAT(elf64-x86-64)
    GROUP ( /lib/x86_64-linux-gnu/libc.so.6 /usr/lib/x86_64-linux-gnu/libc_nonshared.a  AS_NEEDED ( /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ) )
    

    I bet your libc.so has /home/../usr/lib/libc.so.6 in it.