LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1988|回复: 1

使用交叉编译过的xml静态库的问题??

[复制链接]
发表于 2008-2-21 12:51:24 | 显示全部楼层 |阅读模式
我从网上下载的libxml2-2.6.30,解压后用
./configure --host=arm-linux-gnu --target=arm-linux CC=arm-linux-gcc AR=arm-linux-ar LD=arm-linux-ld RANLIB=arm-linux-ranlib --prefix=/usr/local/arm/3.4.1/arm-linux/
进行配置,然后
make
make install
将/usr/local/arm/3.4.1/arm-linux/lib/libxml2.a和/usr/local/arm/3.4.1/arm-linux/include/libxml2下的包含头文件的文件夹libxml一起拷贝到我的程序文件夹下,用
arm-linux-gcc -Wall -lm -L ./ -I ./ xmlfile.c -o testxml -lxml2
交叉编译,结果出现错误如下:
.//libxml2.a(xmlIO.o)(.text+0xa68): In function `xmlGzfileOpen_real':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1108: undefined reference to `gzdopen'
.//libxml2.a(xmlIO.o)(.text+0xaa8):/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1132: undefined reference to `gzopen'
.//libxml2.a(xmlIO.o)(.text+0xb7c): In function `xmlGzfileOpenW':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1178: undefined reference to `gzdopen'
.//libxml2.a(xmlIO.o)(.text+0xbb0):/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1200: undefined reference to `gzopen'
.//libxml2.a(xmlIO.o)(.text+0xbe8): In function `xmlGzfileRead':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1219: undefined reference to `gzread'
.//libxml2.a(xmlIO.o)(.text+0xc18): In function `xmlGzfileWrite':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1239: undefined reference to `gzwrite'
.//libxml2.a(xmlIO.o)(.text+0xc48): In function `xmlGzfileClose':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1255: undefined reference to `gzclose'
.//libxml2.a(xmlIO.o)(.text+0xccc): In function `xmlFreeZMemBuff':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1361: undefined reference to `deflateEnd'
.//libxml2.a(xmlIO.o)(.text+0x141c): In function `__xmlParserInputBufferCreateFilename':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:2411: undefined reference to `gzread'
.//libxml2.a(xmlIO.o)(.text+0x144c):/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:2416: undefined reference to `gzrewind'
.//libxml2.a(xmlIO.o)(.text+0x1ea0): In function `xmlIOHTTPCloseWrite':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1563: undefined reference to `deflate'
.//libxml2.a(xmlIO.o)(.text+0x2184): In function `xmlIOHTTPOpenW':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1405: undefined reference to `deflateInit2_'
.//libxml2.a(xmlIO.o)(.text+0x2230):/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1420: undefined reference to `crc32'
.//libxml2.a(xmlIO.o)(.text+0x288c): In function `xmlIOHTTPWrite':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1522: undefined reference to `deflate'
.//libxml2.a(xmlIO.o)(.text+0x28b0):/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/xmlIO.c:1534: undefined reference to `crc32'
.//libxml2.a(nanohttp.o)(.text+0x4dc): In function `xmlNanoHTTPFreeCtxt':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/nanohttp.c:422: undefined reference to `inflateEnd'
.//libxml2.a(nanohttp.o)(.text+0x1068): In function `xmlNanoHTTPRead':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/nanohttp.c:1214: undefined reference to `inflate'
.//libxml2.a(nanohttp.o)(.text+0x1a98): In function `xmlNanoHTTPMethodRedir':
/home/lixin/WORK/XML/CreateXmlStaticLib/libxml2-2.6.30/nanohttp.c:782: undefined reference to `inflateInit2_'
collect2: ld returned 1 exit status

是什么原因呢??该如何解决呢??各位帮忙看看。
我用动态库链接时没有问题。
 楼主| 发表于 2008-2-21 17:11:01 | 显示全部楼层
仔细查看源码后发现所有这些未定义函数都包含在zlib.h头文件中,在程序里这些函数都是根据如下宏定义去执行的:
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
............
#ifdef HAVE_ZLIB_H
.......执行函数........
#endif
但我找了好久也没找到在其他文件的什么位置有#define HAVE_ZLIB_H出现。即根本就没有包含头文件。
不知道是不是这个原因,仅当参考吧,各位再帮忙看看该怎么解决,谢了!!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表