对“__strtof128_nan@GLIBC_PRIVATE”的未定义引用

undefined reference to `__strtof128_nan@GLIBC_PRIVATE'

我正在尝试交叉编译一个包到 glibc-2.19 附带的 debian-8 (jessie)。交叉编译包时抛出以下错误。

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 ]

经过一番谷歌搜索后,我找到了 ABI Laboratory。这是否意味着我需要 glibc 至少 2.26 才能编译包?

有办法解决这个问题吗?

谢谢..

交叉编译器的设置方式有问题。 看起来您的 sysroot 包含 Debian jessie 的较新 libm 和较旧 libc 的副本。

__strtof128_nan@GLIBC_PRIVATE是glibc的libm库中的内部引用,用于调用libc库。这些内部引用只有在 libmlibc 是同一个 glibc 构建的一部分时才能正常工作。