【问题】
折腾:
【记录】Cygwin下用arm-xscale-linux-gnueabi交叉编译libxml2
期间,编译出错:
Making all in python make[2]: Entering directory `/home/CLi/develop/libxml2/libxml2-2.7.7/python' Making all in . make[3]: Entering directory `/home/CLi/develop/libxml2/libxml2-2.7.7/python' /bin/python ./generator.py . Found 1605 functions in libxml2-api.xml Found 55 functions in libxml2-python-api.xml Generated 886 wrapper functions, 558 failed, 216 skipped Missing type converters: xmlRelaxNGValidityErrorFunc *:2 xmlXPathObjectPtr:22 const htmlEntityDesc *:2 xmlOutputMatchCallback:1 xmlElementContentPtr *:1 xmlStructuredErrorFunc:5 xmlSchematronValidCtxtPtr:3 xmlParserInputBufferCreateFilenameFunc:2 xmlSchemaValType:2 size_t:1 xmlEnumerationPtr:5 xmlSchemaWildcardPtr:1 xmlXIncludeCtxtPtr:4 xmlRelaxNGValidityErrorFunc:2 xmlSAXHandler *:4 ...:1 xmlShellReadlineFunc:1 xmlDict *:1 xmlAutomataPtr:19 unsigned long:1 xmlParserInputPtr:17 xmlCatalogAllow:2 xmlExpNodePtr:3 xmlElementContent *:1 xmlCharEncodingOutputFunc:1 xmlDictPtr:10 xmlTextWriterPtr:77 const htmlElemDesc *:1 xmlChRangeGroup *:1 xmlIDPtr:1 xmlSchemaValPtr:13 xmlInputMatchCallback:1 xmlElementTablePtr:2 xmlChar **:16 xmlXPathCompExprPtr:6 xmlTextReaderErrorFunc:1 xmlExternalEntityLoader:2 xmlNotationTablePtr:2 xmlXPathVariableLookupFunc:1 xmlParserNodeInfoPtr:1 xmlExpCtxtPtr:14 xmlPatternPtr:8 xmlC14NIsVisibleCallback:1 xmlDeregisterNodeFunc:2 va_list:1 xmlSchemaTypePtr:9 htmlStatus:1 xmlRegisterNodeFunc:2 xmlAttributeType:2 xmlRefPtr:1 xmlCharEncodingHandler *:4 xmlNotationPtr:3 xmlSaveCtxtPtr:8 xmlRegExecCallbacks:1 xmlNsPtr *:1 xmlLocationSetPtr:6 xmlSchemaSAXPlugPtr:1 xmlModulePtr:4 xmlEnumerationPtr *:2 xmlShellCtxtPtr:10 xlinkNodeDetectFunc:2 xmlRefTablePtr:1 xmlStreamCtxtPtr:6 xmlSchemaValidityErrorFunc *:2 xmlAttributeTablePtr:2 xmlSchematronParserCtxtPtr:5 xmlCatalogPrefer:1 xmlParserNodeInfoSeqPtr:3 xmlSchematronPtr:2 xmlNodePtr *:2 xmlInputReadCallback:7 char **:5 xmlCharEncoding:13 xmlRegExecCtxtPtr:5 xmlElementContentType:2 void *:87 xmlTextReaderErrorFunc *:1 xmlSAXHandlerPtr *:1 xmlEntityReferenceFunc:1 xmlDocPtr *:1 xmlBufferAllocationScheme:3 xmlSchemaValidityErrorFunc:2 xmlDOMWrapCtxtPtr:6 xmlOutputWriteCallback:2 xmlSchemaFacetPtr:7 xlinkHandlerPtr:2 xmlXPathFuncLookupFunc:1 htmlElemDesc *:3 xmlCharEncodingHandlerPtr:7 xmlCharEncodingInputFunc:1 xmlFeature:1 const xmlParserNodeInfo *:1 xmlNodeSetPtr:32 xmlEntitiesTablePtr:3 xmlIDTablePtr:1 xmlXPathFunction:4 xmlOutputBufferCreateFilenameFunc:2 xmlElementContentPtr:8 xmlElementTypeVal:1 xlinkType:1 xmlGenericErrorFunc *:1 touch gen_prog /bin/sh ../libtool --tag=CC --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/python2.6 -I../include -I../include -I../python -g -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -MT libxml.lo -MD -MP -MF .deps/libxml.Tpo -c -o libxml.lo `test -f './libxml.c' || echo './'`./libxml.c libtool: compile: arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/python2.6 -I../include -I../include -I../python -g -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -MT libxml.lo -MD -MP -MF .deps/libxml.Tpo -c ./libxml.c -fPIC -DPIC -o .libs/libxml.o In file included from /usr/include/python2.6/Python.h:58:0, from ./libxml.c:14: /usr/include/python2.6/pyport.h:472:24: fatal error: sys/termio.h: No such file or directory compilation terminated. Makefile:518: recipe for target `libxml.lo' failed make[3]: *** [libxml.lo] Error 1 make[3]: Leaving directory `/home/CLi/develop/libxml2/libxml2-2.7.7/python' Makefile:598: recipe for target `all-recursive' failed make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/CLi/develop/libxml2/libxml2-2.7.7/python' Makefile:1225: recipe for target `all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/CLi/develop/libxml2/libxml2-2.7.7' Makefile:735: recipe for target `all' failed make: *** [all] Error 2 CLi@PC-CLI-1 ~/develop/libxml2/libxml2-2.7.7 $
即:
In file included from /usr/include/python2.6/Python.h:58:0, /usr/include/python2.6/pyport.h:472:24: fatal error: sys/termio.h: No such file or directory |
【解决过程】
1.参考:
How can I build the Python Sybase module on Windows?
但是没太大帮助。
2.参考:
则去看看代码:
libxml2\libxml2-2.7.7\python\libxml.c
找到:
#include <Python.h>
再去找Python.h对应的:
cgwin中的 usr\include\python2.6\pyport.h
的:
/* On QNX 6, struct termio must be declared by including sys/termio.h if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must be included before termios.h or it will generate an error. */ #ifdef HAVE_SYS_TERMIO_H #include <sys/termio.h> #endif
改为:
/* On QNX 6, struct termio must be declared by including sys/termio.h if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must be included before termios.h or it will generate an error. */ #ifdef HAVE_SYS_TERMIO_H //#include <sys/termio.h> #include <termio.h> #endif
再去make编译试试,结果就可以继续编译了:
make[3]: Entering directory `/home/CLi/develop/libxml2/libxml2-2.7.7/python' /bin/sh ../libtool --tag=CC --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/python2.6 -I../include -I../include -I../python -g -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -MT libxml.lo -MD -MP -MF .deps/libxml.Tpo -c -o libxml.lo `test -f './libxml.c' || echo './'`./libxml.c libtool: compile: arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I.. -I/usr/include/python2.6 -I../include -I../include -I../python -g -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -MT libxml.lo -MD -MP -MF .deps/libxml.Tpo -c ./libxml.c -fPIC -DPIC -o .libs/libxml.o In file included from /usr/include/python2.6/Python.h:58:0, from ./libxml.c:14: /usr/include/python2.6/pyport.h:472:1: warning: C++ style comments are not allowed in ISO C90 [enabled by default] /usr/include/python2.6/pyport.h:472:1: warning: (this will be reported only once per input file) [enabled by default] In file included from /usr/include/python2.6/Python.h:86:0, from ./libxml.c:14: /usr/include/python2.6/intobject.h:45:1: warning: ISO C90 does not support 'long long' [-Wlong-long] In file included from /usr/include/python2.6/Python.h:88:0, from ./libxml.c:14: /usr/include/python2.6/longobject.h:47:44: warning: ISO C90 does not support 'long long' [-Wlong-long] /usr/include/python2.6/longobject.h:48:61: warning: ISO C90 does not support 'long long' [-Wlong-long] /usr/include/python2.6/longobject.h:49:1: warning: ISO C90 does not support 'long long' [-Wlong-long] /usr/include/python2.6/longobject.h:50:1: warning: ISO C90 does not support 'long long' [-Wlong-long] /usr/include/python2.6/longobject.h:51:1: warning: ISO C90 does not support 'long long' [-Wlong-long] ./libxml.c: In function 'libxml_xmlValidCtxtGenericErrorFuncHandler': ./libxml.c:1748:59: warning: unused parameter 'severity' [-Wunused-parameter] ./libxml.c: In function 'libxml_xmlValidCtxtGenericWarningFuncHandler': ./libxml.c:1775:61: warning: unused parameter 'severity' [-Wunused-parameter] ./libxml.c: At top level: ./libxml.c:2677:1: warning: no previous prototype for 'libxml_xmlNodeRemoveNsDef' [-Wmissing-prototypes]
【总结】
cygwin下,交叉编译libxml2出现错误:
/usr/include/python2.6/pyport.h:472:24: fatal error: sys/termio.h: No such file or directory |
的原因是:
libxml2-2.7.7\python\libxml.c
中包含了Python.h,对应在cygwin下,是:
usr\include\python2.6\pyport.h
其中原先是:
#ifdef HAVE_SYS_TERMIO_H #include <sys/termio.h> #endif
而由于旧的系统中的termio.h才是在/usr/include/sys中,新的系统,是在/usr/include中,所以,改为:
#ifdef HAVE_SYS_TERMIO_H //#include <sys/termio.h> #include <termio.h> #endif
就可以找到termio.h,即可解决问题。
转载请注明:在路上 » 【已解决】cygwin下用arm-xscale-linux-gnueabi交叉编译libxml2出错:/usr/include/python2.6/pyport.h:472:24: fatal error: sys/termio.h: No such file or directory