ARM NEON 程序debug: error识别arm neon intrinsics 命令, LD_LIBRARY_PATH shouldn‘t

本文介绍了解决ARM交叉编译中出现的inlining失败及配置glibc时LD_LIBRARY_PATH包含当前目录的问题。针对inlining失败,通过指定正确的编译器选项解决了vdupq_n_s32函数的target specific option mismatch错误。对于glibc配置问题,通过调整环境变量LD_LIBRARY_PATH,去除了对当前目录的引用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错1:error: inlining failed in call to always_inline ‘vdupq_n_s32’: target specific option mismatch

/usr/lib/gcc/arm-linux-gnueabihf/6/include/arm_neon.h:5792:1: error: inlining failed in call to always_inline ‘vdupq_n_s32’: target specific option mismatch
 vdupq_n_s32 (int32_t __a)
 ^~~~~~~~~~~
neon_test.c:94:13: note: called from here
   int32x4_t sum_t = vdupq_n_s32(0);
             ^~~~~

如果已安装好arm-linux-gnueabihf-gcc交叉编译器,

运行编译时加入选项:-march=armv8-a -marm -mfpu=neon

arm-linux-gnueabihf-gcc -march=armv8-a -marm -mfpu=neon  neon_test.c -o neon_test.out

or

arm-linux-gnueabihf-gcc -march=armv8-a -marm -mfpu=neon  ./test_neon.cpp

报错2: 编译glibc 执行configure 遇到报错:LD_LIBRARY_PATH shouldn't contain the current directory when building glibc

.....

checking LD_LIBRARY_PATH variable... contains current directory

configure: error:

*** LD_LIBRARY_PATH shouldn't contain the current directory when

*** building glibc. Please change the environment variable

*** and run configure again.

检查  LD_LIBRARY_PATH:

查看/etc/profile里设置:

export LD_LIBRARY_PATH=/usr/local/gcc-7.3.0/lib64:/notebook/3rdlib/lib:/usr/lib64: $LD_LIBRARY_PATH

echo看下:

[root@taishan build]# echo $LD_LIBRARY_PATH

/usr/local/gcc-7.3.0/lib64:/notebook/3rdlib/lib:/usr/lib64:     最后这里多了个冒号分隔符,(因为系统默认LD_LIBRARY_PATH可能是空的,分隔符后面没东西)

去掉多余冒号即可)修改成:

vim ~/.bashrc

export LD_LIBRARY_PATH=/usr/local/gcc-7.3.0/lib64

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/notebook/3rdlib/lib:/usr/lib64

修改保存后查看:

echo $LD_LIBRARY_PATH

/usr/local/gcc-7.3.0/lib64:/notebook/3rdlib/lib:/usr/lib64

成功解决error.

Note:

1. 运行命令汇总:

arm-linux-gnueabihf-g++ -O3 -march=armv7-a -mcpu=cortex-a9 -ftree-vectorize -mfpu=neon -mfpu=vfpv3-fp16 -mfloat-abi=hard -ffast-math 

2.安装arm-linux-gnueabihf-gcc可参考如下链接:

     arm-linux-gnueabihf gcc8.3交叉编译工具搭建教程

     Building GCC as a cross compiler for Raspberry Pi | Solarian Programmer


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xiangyong58

喝杯茶还能肝到天亮,共同进步

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值