我正在使用ARM的10.3-2021.07 GCC 工具链(具体来说是this文件未压缩到
当使用以下编译行(为了易读性而编辑,
我遇到了以下错误:
ARMGCC
中)为Raspberry Pi 4B进行交叉编译。同时,我还使用最新的Raspberry OS image作为sysroot(通过loop-mounted挂载到RPISYSROOT
)。主机是运行在Windows主机上的Ubuntu Xenial虚拟机。当使用以下编译行(为了易读性而编辑,
CFLAGS
受树莓派的 /proc/cpuinfo
、Gentoo 和 GNU 的启发)时:${ARMGCC}/bin/arm-none-linux-gnueabihf-g++ -std=c++11 \
-v -w -fexceptions -fpermissive --sysroot=$RPISYSROOT \
-pipe -mcpu=cortex-a72 -mfpu=neon-vfpv4 -mfloat-abi=hard -g \
-I . -I .. -I libA/include -I libB/include \
-I ${ARMGCC}/arm-none-linux-gnueabihf/libc/usr/include \
-I ${RPISYSROOT}/usr/include/arm-linux-gnueabihf \
-c file.cpp -o obj/debug/file.o
我遇到了以下错误:
$ARMGCC/arm-none-linux-gnueabihf/libc/usr/include/bits/mathcalls-helper-functions.h:20:24: error: ‘__fpclassify’ has not been declared
20 | __MATHDECL_ALIAS (int, __fpclassify,, (_Mdouble_ __value), fpclassify)
| ^~~~~~~~~~~~
我看到在ARMGCC
,RPISYSROOT
和Raspberry Pi的tools git仓库中都有使用__fpclassify
,它们似乎都是同一文件的不同版本:
usr/include/math.h
usr/include/bits/mathcalls-helper-functions.h
路径可能略有不同。然而,这些都没有提供__fpclassify
的声明或实现。这似乎来自libm
,我想它已经成为libc
的一部分了。我已经在RPISYSROOT
上安装了libc。
我找到的唯一实现是来自uCLibc,但我不认为混合使用libc实现是个好主意。
另外,由于树莓派是armhf架构,我应该看到这些错误吗?
libm
提供的,您可能需要在命令中使用-lm
进行链接。 - msbit