主题 : GD库函数交叉编译不通过--arm-none-linux-gnueabi/bin/ld: cannot find -lgd 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 74796
精华: 0
发帖: 17
金钱: 85 两
威望: 17 点
综合积分: 34 分
注册时间: 2012-07-29
最后登录: 2014-08-11
楼主  发表于: 2012-08-07 17:21

 GD库函数交叉编译不通过--arm-none-linux-gnueabi/bin/ld: cannot find -lgd


[root@foobo gdtest]# gcc zx.c -L /usr/local/lib -lgd -o zx
[root@foobo gdtest]# ls
test.png  zx  zx.c       ----------这里完全可以。运行都正确。


但是我交叉编译的时候 却出现下面 编译通过不过

[root@foobo gdtest]# arm-linux-gcc zx.c -I /usr/local/include/ -L /usr/local/lib/ -lgd  -o gd
/opt/FriendlyARM/toolschain/4.4.3/lib/gcc/arm-none-linux-gnueabi/4.4.3/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/lib//libgd.so when searching for -lgd
/opt/FriendlyARM/toolschain/4.4.3/lib/gcc/arm-none-linux-gnueabi/4.4.3/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/lib//libgd.a when searching for -lgd
/opt/FriendlyARM/toolschain/4.4.3/lib/gcc/arm-none-linux-gnueabi/4.4.3/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lgd
collect2: ld returned 1 exit status

提示说找不到GD库的共享库libgd.so,但是GD库已经正确安装,而且
l[root@foobo gdtest]# ls /usr/local/lib
gd.h              libfreetype.so.6.6.2  libgd.so.2.0.0  libjpeg.so.7.0.0      libpng.a
libfreetype.a     libgd.a               libjpeg.a       libpng12.a            libpng.so
libfreetype.la    libgd.la              libjpeg.la      libpng12.so           libpng.so.3
libfreetype.so   libgd.so              libjpeg.so      libpng12.so.0         libpng.so.3.1.2.44
libfreetype.so.6  libgd.so.2            libjpeg.so.7    libpng12.so.0.1.2.44  pkgco

[root@foobo gdtest]# ls /usr/local/include/
entities.h  gdcache.h  gdfontmb.h  gdfx.h   jconfig.h   jpeglib.h  pngconf.h
freetype2   gdfontg.h  gdfonts.h   gd.h     jerror.h    libpng     png.h
ft2build.h  gdfontl.h  gdfontt.h   gd_io.h  jmorecfg.h  libpng12
最后附上程序以方便给位分析:zx.c#include <stdio.h>#include <gd.h>

int main(void){ gdImagePtr im;  FILE *ground_fp;  char *ground_file;   int red,black;  ground_file="test.png";
  ground_fp = fopen(ground_file,"w+");

  im=gdImageCreate(50,100);
  black=gdImageColorAllocate(im,0,0,0);  red=gdImageColorAllocate(im,255,192,192);   gdImageLine(im,10,20,45,85,red);    gdImageLine(im,0,20,45,85,red);
    gdImagePng(im,ground_fp);    gdImageDestroy(im);    fclose(ground_fp);}


求各位大神指教解答 谢谢

级别: 新手上路
UID: 74796
精华: 0
发帖: 17
金钱: 85 两
威望: 17 点
综合积分: 34 分
注册时间: 2012-07-29
最后登录: 2014-08-11
1楼  发表于: 2012-08-07 17:40
坐等大神出现
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
2楼  发表于: 2012-08-07 21:56
/opt/FriendlyARM/toolschain/4.4.3/lib/gcc/arm-none-linux-gnueabi/4.4.3/../../../../arm-none-linux-gnueabi/bin/ld: skipping incompatible /usr/local/lib//libgd.so when searching for -lgd

你的libgd.so不是ARM的。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
努力,努力,努力
级别: 新手上路
UID: 80717
精华: 0
发帖: 3
金钱: 15 两
威望: 3 点
综合积分: 6 分
注册时间: 2012-10-29
最后登录: 2013-02-11
3楼  发表于: 2013-01-25 11:20
我也遇到了同样的问题,如果在命令行直接输入arm-linux-gcc *.o -o main是可以编译通过,且程序运行正常。但是编写Makefile就是不行,不知是何缘故?