新闻  |   论坛  |   博客  |   在线研讨会
fatal error: gnu/stubs-soft.h: No such file or directory
电子禅石 | 2023-03-20 22:50:20    阅读:21073   发布文章

在给一个嵌入式平台开发时,编译项目出现如题所示错误。通常情况下这种问题表明某个文件缺失,但是先别急着去找那个文件或者从其他地方拷贝过来用。

参考来源1:https://blog.csdn.net/wuyusheng314/article/details/79428996

参考博文与我的情况相似,不过我是使用clion进行开发的,而clion使用cmake进行代码组织,这样免去了写makefile的痛苦。不过问题的本质是一样的。


从该文件看,引入stubs-soft.h头文件需要保证没有定义__ARM_PCS_VFP宏。

同样引用参考答案的一段内容:

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.

即,这个宏是通过编译参数来定义的,所以需要在编译参数中加上-mfloat-abi=hard 或者 -mfloat-abi=soft,具体的需要依据您使用的平台来决定。而使用cmake的话可以设定如下参数:

  1. set(CMAKE_C_FLAGS "-march=armv7-a -marm -mfpu=vfp -mfloat-abi=hard")

  2. set(CMAKE_CXX_FLAGS "-march=armv7-a -marm -mfpu=vfp -mfloat-abi=hard")

注:前面两个参数是架构相关的,并不影响此问题。

fatal error: gnu/stubs-soft.h: No such file or directory – OpenMind (lxins.com)

*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
属于自己的技术积累分享,成为嵌入式系统研发高手。
推荐文章
最近访客