当前位置: 技术问答>linux和unix
Linux交叉编译问题
来源: 互联网 发布时间:2016-06-04
本文导语: 本人在交叉编译过程中,编译时要用到一个libjpng.a的库,该库在/usr/lib下面有,我的makefile如下: # # Linux Frame Buffer Device Configuration # CC = arm-linux-gcc -Wall -O2 -I. -I/usr/include -I/mnt/student/hubenlong/csapi/include -L/m...
本人在交叉编译过程中,编译时要用到一个libjpng.a的库,该库在/usr/lib下面有,我的makefile如下:
#
# Linux Frame Buffer Device Configuration
#
CC = arm-linux-gcc -Wall -O2 -I. -I/usr/include -I/mnt/student/hubenlong/csapi/include -L/mnt/student/hubenlong/csapi/lib -L/usr/lib
RM = rm -f
All: test
test: fb_display.o test.o
$(CC) -m32 -lpng -ljpeg -lcsosd -o test fb_display.o test.o
test.o: test.c
fb_display.o: fb_display.c fb_display.h
clean:
$(RM) *.o test
make报错如下:
/opt/crosstool/gcc-3.4.6-glibc-2.3.6/arm-linux/lib/gcc/arm-linux/3.4.6/../../.
../arm-linux/bin/ld: skipping incompatible /usr/lib/libpng.so when searching f
-lpng
/opt/crosstool/gcc-3.4.6-glibc-2.3.6/arm-linux/lib/gcc/arm-linux/3.4.6/../../.
../arm-linux/bin/ld: skipping incompatible /usr/lib/libpng.a when searching fo
-lpng
/opt/crosstool/gcc-3.4.6-glibc-2.3.6/arm-linux/lib/gcc/arm-linux/3.4.6/../../.
../arm-linux/bin/ld: cannot find -lpng
collect2: ld returned 1 exit status
也就是说,在/usr/lib下面的库与所需的不兼容,应该是32位和64位的问题,注意,我用的Linux没有/usr/lib64,请教各位大侠,急!
#
# Linux Frame Buffer Device Configuration
#
CC = arm-linux-gcc -Wall -O2 -I. -I/usr/include -I/mnt/student/hubenlong/csapi/include -L/mnt/student/hubenlong/csapi/lib -L/usr/lib
RM = rm -f
All: test
test: fb_display.o test.o
$(CC) -m32 -lpng -ljpeg -lcsosd -o test fb_display.o test.o
test.o: test.c
fb_display.o: fb_display.c fb_display.h
clean:
$(RM) *.o test
make报错如下:
/opt/crosstool/gcc-3.4.6-glibc-2.3.6/arm-linux/lib/gcc/arm-linux/3.4.6/../../.
../arm-linux/bin/ld: skipping incompatible /usr/lib/libpng.so when searching f
-lpng
/opt/crosstool/gcc-3.4.6-glibc-2.3.6/arm-linux/lib/gcc/arm-linux/3.4.6/../../.
../arm-linux/bin/ld: skipping incompatible /usr/lib/libpng.a when searching fo
-lpng
/opt/crosstool/gcc-3.4.6-glibc-2.3.6/arm-linux/lib/gcc/arm-linux/3.4.6/../../.
../arm-linux/bin/ld: cannot find -lpng
collect2: ld returned 1 exit status
也就是说,在/usr/lib下面的库与所需的不兼容,应该是32位和64位的问题,注意,我用的Linux没有/usr/lib64,请教各位大侠,急!
|
好像你用的是主机版本的 libpng.a ,而不是目标机器版本的。(libpng.a的项目)如果开源的话可以先下载,交叉编译,安装,然后再编译你的模块。