gcc - Compile with older libc (version `GLIBC_2.14' not found) -
i have compile program on current ubuntu (12.04). program should run on cluster using centos older kernel (2.6.18). cannot compile on cluster directly, unfortunately. if compile , copy program without changes error message "kernel old".
the way understood it, reason not kernel version, version of libc used compilation. tried compile program dynamically linking libc cluster , statically linking else.
research
there lot of questions on none of answers worked me. here research on topic:
- this question explains reason kernel old message
- this question similar more specialized , has no answers
- linking statically proposed here didn't work because libc old on cluster. 1 answer mentions build using old libc, doesn't explain how this.
- one way compile in vm running old os. worked complicated. read you should not link libc statically
- apparently is possible compile different libc version option
-rpath
did not work me (see below)
current state
i copied following files cluster directory /path/to/copied/libs
- libc-2.5.so
- libgcc_s.so.1
- libstdc++.so.6
and compiling options -nodefaultlibs -xlinker -rpath=/path/to/copied/libs -wl,-bstatic,-lrt,-lboost_system,-lboost_filesystem -wl,-bdynamic,-lc,-lstdc++,-lgcc_s
the output of ldd on compiled binary is
mybin: /path/to/copied/libs/libc.so.6: version `glibc_2.14' not found (required mybin) mybin: /path/to/copied/libs/libstdc++.so.6: version `glibcxx_3.4.15' not found (required mybin) linux-vdso.so.1 => (0x00007ffff36bb000) libc.so.6 => /path/to/copied/libs/libc.so.6 (0x00007fbe3789a000) libstdc++.so.6 => /path/to/copied/libs/libstdc++.so.6 (0x00007fbe37599000) libgcc_s.so.1 => /path/to/copied/libs/libgcc_s.so.1 (0x00007fbe3738b000) /lib64/ld-linux-x86-64.so.2 (0x00007fbe37bf3000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fbe37071000)
i'm confused error, because uses correct path (i.e. libc cluster) still complains missing glibc version. when running ldd on cluster returns not dynamic executable
, running binary results in same 2 errors mentioned above. looks there other libraries included (linux-vdso.so.1, ld-linux-x86-64.so.2 , libm.so.6). should use older versions well?
so have 2 main questions:
- is correct approach here?
- if yes: how link old libc correctly?
see this answer.
is correct approach here
no: can't use mismatched versions of glibc link command does. used crt0.o
, ld-linux.so
new (system-installed) libc, libc.so.6
old (copied cluster) libc. not going work.
Comments
Post a Comment