1:修改makefile
CC = arm-poky-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon -mtune=cortex-a9 --sysroot=/opt/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi
2:修改这行 增加-lcap
LDFLAGS = -fPIE -pie -Wl,-z,relro -Wl,-z,now,-lcap
3:当前termnal 导出环境变量
export PATH=$PATH:/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/
4:make 即可
配置交叉编译时:
1:当前termnal 导出环境变量
export PATH=$PATH:/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/
2:执行脚本
source /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
然后配置交叉编译工具ok了
主要是这四部:
export PATH=$PATH:/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/
source /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
./configure --host=arm-poky-linux-gnueabi --prefix=/home/vmuser/install
make
make install
最后进入生成的目录/home/vmuser/install
执行命令 file libmodbus.so.5.0.5查看是否是ARM 32bit