This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

急请教:交叉编译工具arm-linux-gnueabihf-g++编译libxml2问题

Other Parts Discussed in Thread: AM4378

大神们好,我在安装libxml2库时遇到如下问题,大家帮忙指点指点:

虚拟机系统:Ubuntu16.04

ARM芯片:AM4378,Linux系统

待安装Libxml版本:libxml2-2.9.4

交叉编译链版本:gcc version 4.9.3 20150413 (prerelease) (Linaro GCC 4.9-2015.05)

安装编译方式

(1)sudo ./configure --host=arm-linux CC=/usr/crosstools/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++

(2)make

(3)make install

 问题描述:

     采用默认的config编译安装没问题,但生成的库libxml2.so,交叉编译工具arm-linux-gnueabihf-g++无法识别,所以尝试采用arm-linux-gnueabihf-g++进行编译,但不能正常编译,具体情况如下:

    之前未指定arm-linux-gnueabihf-g++路径设置编译选项(sudo ./configure --host=arm-linux CC=arm-linux-gnueabihf-g++),报错如下

     checking whether the C compiler works... no

     configure: error: in `/home/nextev/Softwores/libxml2-2.9.4':

     configure: error: C compiler cannot create executables

    指定arm-linux-gnueabihf-g++绝对路径后,./configure没问题,但编译报错如下

root@ubuntu:~/Softwores/libxml2-2.9.4# make
make all-recursive
make[1]: Entering directory '/home/nextev/Softwores/libxml2-2.9.4'
Making all in include
make[2]: Entering directory '/home/nextev/Softwores/libxml2-2.9.4/include'
Making all in libxml
make[3]: Entering directory '/home/nextev/Softwores/libxml2-2.9.4/include/libxml'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/nextev/Softwores/libxml2-2.9.4/include/libxml'
make[3]: Entering directory '/home/nextev/Softwores/libxml2-2.9.4/include'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/nextev/Softwores/libxml2-2.9.4/include'
make[2]: Leaving directory '/home/nextev/Softwores/libxml2-2.9.4/include'
Making all in .
make[2]: Entering directory '/home/nextev/Softwores/libxml2-2.9.4'
CC SAX.lo
cc1plus: warning: command line option '-Wimplicit' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wnested-externs' is valid for C/ObjC but not for C++
CC entities.lo
cc1plus: warning: command line option '-Wimplicit' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wmissing-prototypes' is valid for C/ObjC but not for C++
cc1plus: warning: command line option '-Wnested-externs' is valid for C/ObjC but not for C++
entities.c: In function 'xmlEntity* xmlAddEntity(xmlDtdPtr, const xmlChar*, int, const xmlChar*, const xmlChar*, const xmlChar*)':
entities.c:223:12: error: invalid conversion from 'void*' to 'xmlEntitiesTablePtr {aka _xmlHashTable*}' [-fpermissive]
table = dtd->entities;
^
entities.c:229:12: error: invalid conversion from 'void*' to 'xmlEntitiesTablePtr {aka _xmlHashTable*}' [-fpermissive]
table = dtd->pentities;
^
In file included from entities.c:1105:0:
elfgcchack.h: At global scope:
elfgcchack.h:996:35: error: 'xmlEntity* xmlAddDocEntity(xmlDocPtr, const xmlChar*, int, const xmlChar*, const xmlChar*, const xmlChar*)' aliased to undefined symbol 'xmlAddDocEntity__internal_alias'
extern __typeof (xmlAddDocEntity) xmlAddDocEntity __attribute((alias("xmlAddDocEntity__internal_alias")));
^
elfgcchack.h:6196:32: error: 'xmlEntity* xmlNewEntity(xmlDocPtr, const xmlChar*, int, const xmlChar*, const xmlChar*, const xmlChar*)' aliased to undefined symbol 'xmlNewEntity__internal_alias'
extern __typeof (xmlNewEntity) xmlNewEntity __attribute((alias("xmlNewEntity__internal_alias")));
^
elfgcchack.h:4164:42: error: 'xmlEntity* xmlGetPredefinedEntity(const xmlChar*)' aliased to undefined symbol 'xmlGetPredefinedEntity__internal_alias'
extern __typeof (xmlGetPredefinedEntity) xmlGetPredefinedEntity __attribute((alias("xmlGetPredefinedEntity__internal_alias")));
^
elfgcchack.h:4154:41: error: 'xmlEntity* xmlGetParameterEntity(xmlDocPtr, const xmlChar*)' aliased to undefined symbol 'xmlGetParameterEntity__internal_alias'
extern __typeof (xmlGetParameterEntity) xmlGetParameterEntity __attribute((alias("xmlGetParameterEntity__internal_alias")));
^
elfgcchack.h:3966:35: error: 'xmlEntity* xmlGetDtdEntity(xmlDocPtr, const xmlChar*)' aliased to undefined symbol 'xmlGetDtdEntity__internal_alias'
extern __typeof (xmlGetDtdEntity) xmlGetDtdEntity __attribute((alias("xmlGetDtdEntity__internal_alias")));
^
elfgcchack.h:3936:35: error: 'xmlEntity* xmlGetDocEntity(const xmlDoc*, const xmlChar*)' aliased to undefined symbol 'xmlGetDocEntity__internal_alias'
extern __typeof (xmlGetDocEntity) xmlGetDocEntity __attribute((alias("xmlGetDocEntity__internal_alias")));
^
elfgcchack.h:3624:40: error: 'void xmlFreeEntitiesTable(xmlEntitiesTablePtr)' aliased to undefined symbol 'xmlFreeEntitiesTable__internal_alias'
extern __typeof (xmlFreeEntitiesTable) xmlFreeEntitiesTable __attribute((alias("xmlFreeEntitiesTable__internal_alias")));
^
elfgcchack.h:3230:41: error: 'xmlChar* xmlEncodeSpecialChars(const xmlDoc*, const xmlChar*)' aliased to undefined symbol 'xmlEncodeSpecialChars__internal_alias'
extern __typeof (xmlEncodeSpecialChars) xmlEncodeSpecialChars __attribute((alias("xmlEncodeSpecialChars__internal_alias")));
^
elfgcchack.h:3220:46: error: 'xmlChar* xmlEncodeEntitiesReentrant(xmlDocPtr, const xmlChar*)' aliased to undefined symbol 'xmlEncodeEntitiesReentrant__internal_alias'
extern __typeof (xmlEncodeEntitiesReentrant) xmlEncodeEntitiesReentrant __attribute((alias("xmlEncodeEntitiesReentrant__internal_alias")));
^
elfgcchack.h:3161:37: error: 'void xmlDumpEntityDecl(xmlBufferPtr, xmlEntityPtr)' aliased to undefined symbol 'xmlDumpEntityDecl__internal_alias'
extern __typeof (xmlDumpEntityDecl) xmlDumpEntityDecl __attribute((alias("xmlDumpEntityDecl__internal_alias")));
^
elfgcchack.h:3149:40: error: 'void xmlDumpEntitiesTable(xmlBufferPtr, xmlEntitiesTablePtr)' aliased to undefined symbol 'xmlDumpEntitiesTable__internal_alias'
extern __typeof (xmlDumpEntitiesTable) xmlDumpEntitiesTable __attribute((alias("xmlDumpEntitiesTable__internal_alias")));
^
elfgcchack.h:2410:42: error: 'xmlEntitiesTable* xmlCreateEntitiesTable()' aliased to undefined symbol 'xmlCreateEntitiesTable__internal_alias'
extern __typeof (xmlCreateEntitiesTable) xmlCreateEntitiesTable __attribute((alias("xmlCreateEntitiesTable__internal_alias")));
^
elfgcchack.h:2295:40: error: 'xmlEntitiesTable* xmlCopyEntitiesTable(xmlEntitiesTablePtr)' aliased to undefined symbol 'xmlCopyEntitiesTable__internal_alias'
extern __typeof (xmlCopyEntitiesTable) xmlCopyEntitiesTable __attribute((alias("xmlCopyEntitiesTable__internal_alias")));
^
elfgcchack.h:1006:35: error: 'xmlEntity* xmlAddDtdEntity(xmlDocPtr, const xmlChar*, int, const xmlChar*, const xmlChar*, const xmlChar*)' aliased to undefined symbol 'xmlAddDtdEntity__internal_alias'
extern __typeof (xmlAddDtdEntity) xmlAddDtdEntity __attribute((alias("xmlAddDtdEntity__internal_alias")));
^
Makefile:1248: recipe for target 'entities.lo' failed
make[2]: *** [entities.lo] Error 1
make[2]: Leaving directory '/home/nextev/Softwores/libxml2-2.9.4'
Makefile:1440: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/nextev/Softwores/libxml2-2.9.4'
Makefile:859: recipe for target 'all' failed
make: *** [all] Error 2

另外,只有采用默认的编译选项可以正常编译安装,g++、arm-linux-gnueabihf-gcc、arm-linux-gnueabihf-g++均无法用

大家多多指点啊,不胜感激!