0

I have been using old version of gcc and libc for my SLES 10 machine to build my code. Recently in order to add support for new libraries, I added GCC 6.3 build version. But when I refer this

./gcc -o ~/test ~/test.c -L/home/newuser/newos/Gcc/glibc-2.17/lib -lXX

, I get following error:

./gcc: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./gcc)

./gcc: /lib64/libc.so.6: version `GLIBC_2.11' not found (required by ./gcc)

the current glibc version in /lib64 is 2.4 and I can't upgrade it as it is needed by most of my files. I am trying to link glibc 2.14 to gcc 6.3.0 at compile time. Is there any way I can refer new glibc from gcc commandline ?

I tried to use the fix provided in this link as this scenario is very much similar to my scenario:

./gcc -Wl,--rpath=../../glibc-2.14/lib -Wl,--dynamic-linker=../../glibc-2.14/lib/libc.so.6

and

./gcc -Wl,--rpath=../../glibc-2.14/lib -Wl,--dynamic-linker=../../glibc-2.14/lib/ld-linux.so.2

But still the same error persists for me. Is there anything more i need to do?

EDIT1

I added additional command to export LD_LIBRARY_PATH.

export LD_LIBRARY_PATH=/path/to/glibc2.14/lib

after this export, when I ran the gcc with above command, I was facing another error:

error while loading shared libraries. /path/to/glibc-2.14/lib/libm.so.6: ELF file OS ABI invalid

Community
  • 1
  • 1
DTdev
  • 538
  • 1
  • 18
  • 32
  • libc is so fundamental to everything compiled on the distro, it is not advisable to attempt to change from the current version. If you want a different version of glibc, I believe it would take a defining a new toolchain based on that version. That said, I don't claim to the last word on cross-version builds, so there may be a shorter route. Were I in your spot, I would virtualize a guest that provides a compatible glibc and build in the guest. – David C. Rankin Apr 21 '17 at 05:24
  • Thanks David. So is there no way I can use gcc-4.9.3 on a SUSE 10 machine without replacing the older glibc libraries? – DTdev Apr 21 '17 at 06:23
  • That's my understanding. I looked at updating gcc/glibc on Leap 42.2 and conferred with the developers on the openSuSE list less than a month ago about this. I was was cautioned against it for the reasons mentioned. I sill have 11.0 and 13.1 as well as Leap running, you are pretty much stuck with the glibc version that the distro is based on. You can move around with versions of just about everything else, but the glibc version is basically the backbone for everything built for the distro and the dependencys basically prohibit a glibc move without rebuilding a big portion of the system. – David C. Rankin Apr 21 '17 at 06:58
  • Ok. Actually as per the complete scenario, we build the driver for different kernels provided with SLES and RHEL kernels. The build system is SLES 10 machine with glibc-2.4 and gcc-4.1 . Now when we freshly built it with SLES 12 machine for SLES 12 specific driver using bultin glibc 2.19 and gcc 6.3.0, it passes. But as soon as I copy the entire code to old build machine, same command fails with above errors. What can possibly done? Can upgrading glibc on SLES 10 cause any issue while building binary for older OSs? – DTdev Apr 25 '17 at 06:59

0 Answers0