首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >致命错误: gnu/stubs-soft.h:没有这样的文件或目录

致命错误: gnu/stubs-soft.h:没有这样的文件或目录
EN

Stack Overflow用户
提问于 2018-03-07 04:06:14
回答 1查看 19.4K关注 0票数 9

当我在64位Ubuntu16.04和32位Cortex A9平台上交叉编译helloworld程序时,我遇到了以下错误。

代码语言:javascript
复制
$ make
/usr/local/comp/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mtune=cortex-a9 --sysroot=/usr/local/comp/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi -Iinclude -Wall -O3 -c -o main.o main.c
In file included from /usr/local/comp/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/features.h:389:0,
             from /usr/local/comp/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/stdio.h:27,
             from main.c:5:
/usr/local/comp/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.
makefile:45: recipe for target 'main.o' failed
make: *** [main.o] Error 1

然后检查stubs.h文件的内容:

代码语言:javascript
复制
$ cat /usr/local/comp/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/gnu/stubs.h 
/* This file is automatically generated.
   This file selects the right generated file of `__stub_FUNCTION' macros
   based on the architecture being compiled for.  */


#if !defined __ARM_PCS_VFP
# include <gnu/stubs-soft.h>
#endif
#if defined __ARM_PCS_VFP
# include <gnu/stubs-hard.h>
#endif

我应该在makefile中定义_ARM_PCS_VFP吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-03-07 04:21:59

从交叉编译器的名称"cortexa9hf- VFP - neon -poky-linux-gnueabi“可以看出,它针对的是带有VFP体系结构和启用了neon的Cortex-A9。添加-mfloat-abi=hard交换机应该可以解决此问题。

来自GCC手册的

-mfloat-abi=名称:

指定要使用的浮点ABI。允许值为:‘soft’、‘softfp’和‘hard’。

指定‘soft’会导致GCC生成包含浮点运算的库调用的输出。“‘softfp”允许使用硬件浮点指令生成代码,但仍使用软浮点调用约定。‘’hard‘允许生成浮点指令,并使用特定于FPU的调用约定。

默认值取决于特定的目标配置。请注意,硬浮点ABI和软浮点ABI不是链接兼容的;您必须使用相同的ABI编译整个程序,并使用一组兼容的库进行链接。

票数 19
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49139125

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档