linux下libxml2的问题?

时间:2021-02-08 20:15:43
  我的libxml2.so的版本是2.7.1 x86_64的,但是我程序的环境是AMD x86_64。
  我想问下,这样libxml2.so 能否使用在AMD x86_64的机子系统上?

4 个解决方案

#1


没有问题!!

#2


不是吧,但是我专门冲官网上下的源码,然后MAKE生成.a文件,我本地服务器能用,但是在客户的服务器上就报:

/home/libxml2/libxml2-2.9.1/ 为源码的目录
/home/db2inst6/counter/cntps/src 为程序目录
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a  为复制过去的.a文件目录

db2inst6@ZhangWuTest:~/counter/cntps/src> make
gcc -g -O2 -Wall -c ./pub/public.c
mv public.o ../lib 
gcc -g -O2 -Wall -o psstart psstart.c ../lib/public.o 
mv psstart ../bin
gcc -g -O2 -Wall -o psstop psstop.c ../lib/public.o 
mv psstop ../bin
gcc -g -L/home/db2inst1/sqllib/lib/ -O2 -Wall -o countMain countMain.c -ldb2 ../lib/public.o ./pub/my.a /home/db2inst6/counter/lib/libpos.a /home/db2inst6/counter/cntps/lib/libpkg.a /home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a /home/db2inst6/counter/lib/libposa.a /home/db2inst6/counter/lib/libstl.a /home/db2inst6/counter/lib/libacc.a /home/db2inst6/counter/lib/libagt.a /home/db2inst6/counter/lib/libsys.a /home/db2inst6/counter/lib/libdbf.a /home/db2inst6/counter/lib/libmac.a /home/db2inst6/counter/lib/libpub.a -lncurses
countMain.c: In function 'fPrint8583':
countMain.c:248: warning: cast from pointer to integer of different size
countMain.c:248: warning: cast to pointer from integer of different size
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlGzfileOpenW':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1261: undefined reference to `gzopen'
/home/libxml2/libxml2-2.9.1/xmlIO.c:1236: undefined reference to `gzdopen'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `__xmlParserInputBufferCreateFilename':
/home/libxml2/libxml2-2.9.1/xmlIO.c:2656: undefined reference to `gzdirect'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlFreeZMemBuff':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1542: undefined reference to `deflateEnd'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlZMemBuffGetContent':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1744: undefined reference to `deflate'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlZMemBuffAppend':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1703: undefined reference to `deflate'
/home/libxml2/libxml2-2.9.1/xmlIO.c:1715: undefined reference to `crc32'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlCreateZMemBuff':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1586: undefined reference to `deflateInit2_'
/home/libxml2/libxml2-2.9.1/xmlIO.c:1601: undefined reference to `crc32'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlGzfileClose':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1317: undefined reference to `gzclose'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlGzfileWrite':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1301: undefined reference to `gzwrite'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlGzfileRead':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1281: undefined reference to `gzread'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlGzfileOpen_real':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1189: undefined reference to `gzopen'
/home/libxml2/libxml2-2.9.1/xmlIO.c:1162: undefined reference to `gzdopen'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(nanohttp.o): In function `xmlNanoHTTPFreeCtxt':
/home/libxml2/libxml2-2.9.1/nanohttp.c:432: undefined reference to `inflateEnd'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(nanohttp.o): In function `xmlNanoHTTPRead':
/home/libxml2/libxml2-2.9.1/nanohttp.c:1291: undefined reference to `inflate'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(nanohttp.o): In function `xmlNanoHTTPScanAnswer':
/home/libxml2/libxml2-2.9.1/nanohttp.c:829: undefined reference to `inflateInit2_'
collect2: ld returned 1 exit status
make: *** [countMain] 错误 1

#3


/home/db2inst1/sqllib/lib/  这个路径不对吧

#4


链接命令的最后加上 -lz -lm

#1


没有问题!!

#2


不是吧,但是我专门冲官网上下的源码,然后MAKE生成.a文件,我本地服务器能用,但是在客户的服务器上就报:

/home/libxml2/libxml2-2.9.1/ 为源码的目录
/home/db2inst6/counter/cntps/src 为程序目录
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a  为复制过去的.a文件目录

db2inst6@ZhangWuTest:~/counter/cntps/src> make
gcc -g -O2 -Wall -c ./pub/public.c
mv public.o ../lib 
gcc -g -O2 -Wall -o psstart psstart.c ../lib/public.o 
mv psstart ../bin
gcc -g -O2 -Wall -o psstop psstop.c ../lib/public.o 
mv psstop ../bin
gcc -g -L/home/db2inst1/sqllib/lib/ -O2 -Wall -o countMain countMain.c -ldb2 ../lib/public.o ./pub/my.a /home/db2inst6/counter/lib/libpos.a /home/db2inst6/counter/cntps/lib/libpkg.a /home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a /home/db2inst6/counter/lib/libposa.a /home/db2inst6/counter/lib/libstl.a /home/db2inst6/counter/lib/libacc.a /home/db2inst6/counter/lib/libagt.a /home/db2inst6/counter/lib/libsys.a /home/db2inst6/counter/lib/libdbf.a /home/db2inst6/counter/lib/libmac.a /home/db2inst6/counter/lib/libpub.a -lncurses
countMain.c: In function 'fPrint8583':
countMain.c:248: warning: cast from pointer to integer of different size
countMain.c:248: warning: cast to pointer from integer of different size
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlGzfileOpenW':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1261: undefined reference to `gzopen'
/home/libxml2/libxml2-2.9.1/xmlIO.c:1236: undefined reference to `gzdopen'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `__xmlParserInputBufferCreateFilename':
/home/libxml2/libxml2-2.9.1/xmlIO.c:2656: undefined reference to `gzdirect'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlFreeZMemBuff':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1542: undefined reference to `deflateEnd'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlZMemBuffGetContent':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1744: undefined reference to `deflate'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlZMemBuffAppend':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1703: undefined reference to `deflate'
/home/libxml2/libxml2-2.9.1/xmlIO.c:1715: undefined reference to `crc32'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlCreateZMemBuff':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1586: undefined reference to `deflateInit2_'
/home/libxml2/libxml2-2.9.1/xmlIO.c:1601: undefined reference to `crc32'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlGzfileClose':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1317: undefined reference to `gzclose'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlGzfileWrite':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1301: undefined reference to `gzwrite'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlGzfileRead':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1281: undefined reference to `gzread'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(xmlIO.o): In function `xmlGzfileOpen_real':
/home/libxml2/libxml2-2.9.1/xmlIO.c:1189: undefined reference to `gzopen'
/home/libxml2/libxml2-2.9.1/xmlIO.c:1162: undefined reference to `gzdopen'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(nanohttp.o): In function `xmlNanoHTTPFreeCtxt':
/home/libxml2/libxml2-2.9.1/nanohttp.c:432: undefined reference to `inflateEnd'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(nanohttp.o): In function `xmlNanoHTTPRead':
/home/libxml2/libxml2-2.9.1/nanohttp.c:1291: undefined reference to `inflate'
/home/db2inst6/counter/cntps/libpkg/include/lib64/libxml2.a(nanohttp.o): In function `xmlNanoHTTPScanAnswer':
/home/libxml2/libxml2-2.9.1/nanohttp.c:829: undefined reference to `inflateInit2_'
collect2: ld returned 1 exit status
make: *** [countMain] 错误 1

#3


/home/db2inst1/sqllib/lib/  这个路径不对吧

#4


链接命令的最后加上 -lz -lm