Search code examples
cross-platformcross-compilingglibc

undefined reference to `__strtof128_nan@GLIBC_PRIVATE'


I am trying to cross-compiling a packing to debian-8 (jessie), which comes with glibc-2.19. While cross-compiling the package it throwed the following error.

CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCXXCompiler.cmake:45 (message):
  The C++ compiler

    "/opt/jessiesdk-cxx/bin/i686-pc-linux-gnu-g++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/ach/ros2/ros2_core/build/ament_index_cpp/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/bin/make" "cmTC_04f3a/fast"
    /usr/bin/make -f CMakeFiles/cmTC_04f3a.dir/build.make CMakeFiles/cmTC_04f3a.dir/build
    make[1]: Entering directory '/home/ach/ros2/ros2_core/build/ament_index_cpp/CMakeFiles/CMakeTmp'
    Building CXX object CMakeFiles/cmTC_04f3a.dir/testCXXCompiler.cxx.o
    /opt/jessiesdk-cxx/bin/i686-pc-linux-gnu-g++ --sysroot=/opt/jessiesdk-cxx/i686-pc-linux-gnu/sysroot     -o CMakeFiles/cmTC_04f3a.dir/testCXXCompiler.cxx.o -c /home/ach/ros2/ros2_core/build/ament_index_cpp/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    Linking CXX executable cmTC_04f3a
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_04f3a.dir/link.txt --verbose=1
    /opt/jessiesdk-cxx/bin/i686-pc-linux-gnu-g++ --sysroot=/opt/jessiesdk-cxx/i686-pc-linux-gnu/sysroot       CMakeFiles/cmTC_04f3a.dir/testCXXCompiler.cxx.o  -o cmTC_04f3a 
    /opt/jessiesdk-cxx/lib/gcc/i686-pc-linux-gnu/7.5.0/../../../../i686-pc-linux-gnu/bin/ld: /opt/jessiesdk-cxx/i686-pc-linux-gnu/sysroot/usr/lib/i386-linux-gnu/libm.so: undefined reference to `__strtold_nan@GLIBC_PRIVATE'
    /opt/jessiesdk-cxx/lib/gcc/i686-pc-linux-gnu/7.5.0/../../../../i686-pc-linux-gnu/bin/ld: /opt/jessiesdk-cxx/i686-pc-linux-gnu/sysroot/usr/lib/i386-linux-gnu/libm.so: undefined reference to `__strtof_nan@GLIBC_PRIVATE'
    /opt/jessiesdk-cxx/lib/gcc/i686-pc-linux-gnu/7.5.0/../../../../i686-pc-linux-gnu/bin/ld: /opt/jessiesdk-cxx/i686-pc-linux-gnu/sysroot/usr/lib/i386-linux-gnu/libm.so: undefined reference to `__strtod_nan@GLIBC_PRIVATE'
    /opt/jessiesdk-cxx/lib/gcc/i686-pc-linux-gnu/7.5.0/../../../../i686-pc-linux-gnu/bin/ld: /opt/jessiesdk-cxx/i686-pc-linux-gnu/sysroot/usr/lib/i386-linux-gnu/libm.so: undefined reference to `__strtof128_nan@GLIBC_PRIVATE'
    collect2: error: ld returned 1 exit status
    CMakeFiles/cmTC_04f3a.dir/build.make:97: recipe for target 'cmTC_04f3a' failed
    make[1]: *** [cmTC_04f3a] Error 1
    make[1]: Leaving directory '/home/ach/ros2/ros2_core/build/ament_index_cpp/CMakeFiles/CMakeTmp'
    Makefile:126: recipe for target 'cmTC_04f3a/fast' failed
    make: *** [cmTC_04f3a/fast] Error 2


  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


---
Failed   <<< ament_index_cpp    [ Exited with code 1 ]

After a bit of googling i found ABI Laboratory. Does this mean i require a glibc at least 2.26 in order to compile the package ?

Is there a way around this ?

Thanks..


Solution

  • Something is wrong with the way the cross-compiler has been set up. It looks like your sysroot contains a copy of a newer libm along with the older libc for Debian jessie.

    __strtof128_nan@GLIBC_PRIVATE is an internal reference in the libm library of glibc, used to call into the libc library. These internal references only work properly if libm and libc were part of the same glibc build.