在编译系统移植的时候,不同的编译器的配置经常因为配置的系统硬件不同而需要跳转。
例如从cmake系统到gyp系统,有时候一些宏定义的编译器内部默认的,通过编译选项才能修改,尤其带“__xx”开头的编译宏定义。
本文尝试记录工作中遇到的一些,隐晦的编译错误和找不到的编译宏所对应的编译选项
cmake添加编译选项,
这个编译宏的意思是, __VFP_FP__ which merely indicates presence of VFP unit 表示当前硬件能否支持。VFP是ARM某些芯片的浮点运算模块,不是所有的都有。
报错往往是找不到硬件定义,
clang -mfpu=vfp -mfloat-abi=hard test.c
In file included from test.c:1:
In file included from /usr/include/stdio.h:27:
In file included from /usr/include/features.h:399:
/usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-soft.h' file not found
# include <gnu/stubs-soft.h>^
1 error generated.
arm用什么软件编译?
: No such file or directory# include <gnu/stubs-hard.h>
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
编译顺序,
ARM cotext9 这个模块是可选的,那么如果编译的时候使能了这个选项,会造成运行的时候指令错误的提示。
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态