Using new gcc/glibc on an older system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

this might be a FAQ but I didn't find anything yet, so:

On an older system it is rather trivial to install latest
binutils/gcc/gdb and then use them during development: just configure
them with --prefix=/some/path and add /some/path/bin in front of your
PATH (with GCC I'm also using LD_LIBRARY_PATH pointing to .o
files/libgcc.so). All those seem to work. However, when glibc comes
into play, nothing seems to be trivial anymore. There are two things
I'd like to do:

1) compile programs against a new glibc and then run those binaries
that require the new libc. This works partially now for me if I pass
correct CPPFLAGS and LDFLAGS when compiling (i.e., gcc ...
-I/path/to/new-glibc/include
-Wl,--dynamic-linker=/path/to/new-glibc/lib/ld-linux-x86-64.so.2 ...).
Those programs seem to then automatically pick up correct glibc without
need for any LD_LIBRARY_PATH or other such settings for trivial
programs. However, if I link some lib not in that directory,
compilation and linking seem to succeed but I get, e.g., with
libtermcap:

localhost:~> ldd ./a.out
        libtermcap.so.2 => not found
        libc.so.6 => /tmp/glibc/lib/libc.so.6 (0x0000002a957f3000)
        /tmp/glibc/lib/ld-linux-x86-64.so.2 (0x0000002a95556000)
localhost:~> ./a.out
./a.out: error while loading shared libraries: libtermcap.so.2: cannot
open shared object file: No such file or directory

So it seems something else would be still needed here. As an ugly
workaround I added links under /tmp/glibc/lib to /lib and /usr/lib for
needed libs but that feels hacky, I don't want to do that again if I
add some other libs later under /lib or /usr/lib. So, hints how to do
this smoothly would be appreciated a lot.


2) run any given existing program against the new glibc seems hairy:
settings LD_LIBRARY_PATH to something like
/path/to/new-glibc/lib:/lib:/usr/lib just gives me seg faults, toying
with PATH or LD_PRELOAD does not help at all. So I'm wondering what
would be the easiest way for a user to run existing programs compiled
against the new glibc? Now I get:

localhost:~> export LD_LIBRARY_PATH=/tmp/glibc/lib:/lib64:/lib
localhost:~> /bin/ls
zsh: segmentation fault  /bin/ls
localhost:~> 

Here I'm completely stuck.


[Please CC me in replies.]

Thanks.




 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux