Linux 编译应用程序报错:fatal error: gnu/stubs-soft.h: No such file or directory

自己编写Makefile编译应用程序报错如下:

wys@ubuntu:/mnt/hgfs/projects/bd3/zlg/lcd驱动$ make
make: Warning: File `Makefile' has modification time 6.5 s in the future
/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -o spidev_test spidev_test.c -lpthread -static -mfloat-abi=soft
In file included from /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/features.h:389:0,
                 from /opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/stdint.h:25,
                 from /opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.9.1/include/stdint.h:9,
                 from spidev_test.c:14:
/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or directory
 # include <gnu/stubs-soft.h>
                             ^
compilation terminated.

make: *** [modules] Error 1

解决办法:

cc has a builtin define to denote hard abi when in use, e.g. when using -mfloat-abi=hard it will define __ARM_PCS_VFP to 1 and therefore we should check that to determine which calling convention is in use and not __VFP_FP__ which merely indicates presence of VFP unit

这些其实是在编译选项里面设定的,如果你傻傻的去找 __ARM_PCS_VFP那就很惨了,你会完全没有头绪。

其实只需要修改编译参数,-mfloat-abi=hard 或者 -mfloat-abi=soft



猜你喜欢

转载自blog.csdn.net/wuyusheng314/article/details/79428996