报错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