'dlclose@@GLIBC_2.2.5' on centos 7.3 with gcc 4.8.5

/usr/bin/ld: /home/pan/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Eta/Libs/RHEL6_64_GCC444/Debug/librssl.a(rsslImpl.c.o)||undefined reference to symbol 'dlclose@@GLIBC_2.2.5'|

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @PETER96

    It states in the README that:

    This Release has been tested with the following:
    - Red Hat Advanced Server 6.0 Update 2 Release 64-bit with GCC 4.4.4 (RHEL_6_64_GCC444)
    - Oracle Linux Server 6.0 Update 4 64-bit with UPA Lib GCC 4.4.4 (RHEL6_64_GCC444)
    - Oracle Linux Server 7.0 64-bit with GCC 4.8.2 (OL7_64_GCC482)
    - CentOS 7.0 64-bit with GCC 4.8.2 (OL7_64_GCC482)

    For CentOS 7.x with GCC 4.8.5, the application should link to librssl.a from OL7_64_GCC482. Therefore, the correct location for librssl.a is /home/pan/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Eta/Libs/OL7_64_GCC482/Debug/librssl.a.

Answers

  • I change link then

    ||=== Build: Debug in fmarketrueter (compiler: GNU GCC Compiler) ===| /usr/bin/ld: /home/pan/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Eta/Libs/OL7_64_GCC482/Debug/librssl.a(rsslImpl.c.o)||undefined reference to symbol 'dlclose@@GLIBC_2.2.5'| ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 11 second(s)) ===|

  • Have you added -ldl in the linker options? It requires -lnsl -lpthread -lrt -ldl -lm.

    If this doesn't solve the problem, please share your Makefile.

  • You may need to verify the version of glibc installed on the machine.

    # yum list glibc
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    * base: anorien.csc.warwick.ac.uk
    * extras: centos.mirroring.pulsant.co.uk
    * updates: centos.mirrors.nublue.co.uk
    Installed Packages
    glibc.i686 2.17-222.el7 @base
    glibc.x86_64 2.17-222.el7 @base

    If the application is built properly, it will link to /lib64/libdl.so.2.

    # ldd CENTOS7_64_GCC482/Debug/Consumer
    linux-vdso.so.1 => (0x00007ffd5c146000)
    libnsl.so.1 => /lib64/libnsl.so.1 (0x00007fbe0a4fe000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fbe0a2e2000)
    librt.so.1 => /lib64/librt.so.1 (0x00007fbe0a0da000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fbe09ed6000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fbe09bd4000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fbe09807000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fbe0a718000)

    /lib64/libdl.so.2 will have dlopen@@GLIBC_2.2.5.

    # strings /lib64/libdl.so.2 | grep dlopen
    dlopen
    dlopen.c
    dlopen_doit
    dlopenold.c
    __dlopen_check
    __dlopen
    dlopen@@GLIBC_2.2.5
  • I check version below

    glibc.x86_64 2.17-157.el7 Available Packages glibc.i686 2.17-222.el7 glibc.x86_64 2.17-222.el7

    dlopen dlopen.c dlopen_doit dlopenold.c __dlopen_check __dlopen dlopen@@GLIBC_2.2.5

    My linker option -lpthread -lema -lxml2 -lrssl -lrsslVA -ldl -lnsl -lrt -ldl -lm

    but

    /home/pan/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Eta/Libs/OL7_64_GCC482/Debug/librsslVA.a(rsslReactor.c.o)||In function `_reactorTakeChannel':| /local/jenkins/workspace/ESDKCore/OS/OL7-64/esdk/Cpp-C/Eta/Impl/Reactor/rsslReactor.c|176|未定義參考到「rsslCreateNotifierEvent」|

  • From my test, the order of Elektron library in the link options is matter. The -lrsslVA must be before -lrssl.

     -lpthread -lema -lxml2 -lrsslVA -lrssl -ldl -lnsl -lrt -ldl -lm

    The full commands are:

    /usr/bin/g++ -c -m64 -D_REENTRANT -DLinux -O3 -DCOMPILE_64BITS -I/api/setup/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Ema/Src/Include -I/api/setup/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Ema/Src -o CENTOSL7_64_GCC482/Optimized/obj/Consumer.o Consumer.cpp

    /usr/bin/g++ -o CENTOSL7_64_GCC482/Optimized/Consumer100 CENTOSL7_64_GCC482/Optimized/obj/Consumer.o -L/api/setup/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Eta/Libs/OL7_64_GCC482/Debug -L/api/setup/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Ema/Libs/OL7_64_GCC482/Debug -lpthread -lema -lxml2 -lrsslVA -lrssl -ldl -lnsl -lrt -ldl -lm
  • From my test, the order of Elektron libraries in the link options is matter. -lrsslVA should be before -lrssl.

    -lpthread -lema -lxml2 -lrsslVA -lrssl -ldl -lnsl -lrt -ldl -lm

    The full commands are:

    /usr/bin/g++ -c -m64 -D_REENTRANT -DLinux -O3 -DCOMPILE_64BITS -I/api/setup/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Ema/Src/Include -I/api/setup/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Ema/Src -o CENTOSL7_64_GCC482/Optimized/obj/Consumer.o Consumer.cpp

    /usr/bin/g++ -o CENTOSL7_64_GCC482/Optimized/Consumer100 CENTOSL7_64_GCC482/Optimized/obj/Consumer.o -L/api/setup/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Eta/Libs/OL7_64_GCC482/Debug -L/api/setup/Elektron-SDK1.2.1.linux.rrg/Cpp-C/Ema/Libs/OL7_64_GCC482/Debug -lpthread -lema -lxml2 -lrsslVA -lrssl -ldl -lnsl -lrt -ldl -lm
  • Thank you for your answer.