【已解决】cygwin下用arm-xscale-linux-gnueabi-gcc交叉编译xmlrpc出错:xmltok.c:9:21: fatal error: nametab.h: No such file or directory

【问题】

折腾:

【记录】Cygwin下用arm-xscale-linux-gnueabi交叉编译xmlrpc

期间,编译出错:

CLi@PC-CLI-1 ~/develop/xmlrpc/xmlrpc-c-1.06.31
$ make
make -C include/ -f /home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/./include/Makefile \
    all
make[1]: Entering directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/include'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/include'
make -C lib/ -f /home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/./lib/Makefile \
    all
make[1]: Entering directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib'
make -C util/ -f /home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/../lib/util/Makefile \
    all
make[2]: Entering directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/util'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/util'
make -C libutil/ -f /home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/../lib/libutil/Makefile \
    all
make[2]: Entering directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/libutil'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/libutil'
make -C abyss/ -f /home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/../lib/abyss/Makefile \
    all
make[2]: Entering directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/abyss'
make -C src/ -f /home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/abyss/../../lib/abyss/src/Makefile \
    all
make[3]: Entering directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/abyss/src'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/abyss/src'
make[2]: Leaving directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/abyss'
make -C curl_transport/ -f /home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/../lib/curl_transport/Makefile \
    all
make[2]: Entering directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport'
/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport/../../libtool --mode=compile arm-xscale-linux-gnueabi-gcc -c -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport/../.. -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport/../../include -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport/../../lib/util/include  -I/home/CLi/develop/crosstool-ng/x-tools/armxscalecurl/include -DNDEBUG -Wall -Wundef -Wimplicit -W -Winline -Wundef  -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -fno-common -g -O3   xmlrpc_curl_transport.c
rm -f .libs/xmlrpc_curl_transport.lo
arm-xscale-linux-gnueabi-gcc -c -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport/../.. -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport/../../include -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport/../../lib/util/include -I/home/CLi/develop/crosstool-ng/x-tools/armxscalecurl/include -DNDEBUG -Wall -Wundef -Wimplicit -W -Winline -Wundef -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -fno-common -g -O3 xmlrpc_curl_transport.c  -fPIC -DPIC -o .libs/xmlrpc_curl_transport.lo
xmlrpc_curl_transport.c: In function 'finishAsynch':
xmlrpc_curl_transport.c:1703:20: warning: 'waitTimeoutTime.tv_usec' may be used uninitialized in this function [-Wuninitialized]
xmlrpc_curl_transport.c:1741:20: note: 'waitTimeoutTime.tv_usec' was declared here
xmlrpc_curl_transport.c:1703:20: warning: 'waitTimeoutTime.tv_sec' may be used uninitialized in this function [-Wuninitialized]
xmlrpc_curl_transport.c:1741:20: note: 'waitTimeoutTime.tv_sec' was declared here
In function 'finishCurlTransaction',
    inlined from 'processCurlMessages' at xmlrpc_curl_transport.c:1595:38,
    inlined from 'doCurlWork' at xmlrpc_curl_transport.c:1682:28,
    inlined from 'finishCurlSessions' at xmlrpc_curl_transport.c:1708:23,
    inlined from 'finishAsynch' at xmlrpc_curl_transport.c:1752:23:
xmlrpc_curl_transport.c:1508:5: warning: call to '_curl_easy_getinfo_err_string' declared with attribute warning: curl_easy_getinfo expects a pointer to char * for this info [enabled by default]
arm-xscale-linux-gnueabi-gcc -c -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport/../.. -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport/../../include -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport/../../lib/util/include -I/home/CLi/develop/crosstool-ng/x-tools/armxscalecurl/include -DNDEBUG -Wall -Wundef -Wimplicit -W -Winline -Wundef -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -fno-common -g -O3 xmlrpc_curl_transport.c -o xmlrpc_curl_transport.o >/dev/null 2>&1
mv -f .libs/xmlrpc_curl_transport.lo xmlrpc_curl_transport.lo
make[2]: Leaving directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/curl_transport'
make -C expat/ -f /home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/../lib/expat/Makefile \
    all
make[2]: Entering directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat'
make -C gennmtab/ -f /home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/../../lib/expat/gennmtab/Makefile \
    all
make[3]: Entering directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/gennmtab'
arm-xscale-linux-gnueabi-gcc -c gennmtab.c -o gennmtab.o -DNDEBUG -Wall -Wundef -Wimplicit -W -Winline -Wundef  -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -fno-common -g -O3   -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/gennmtab/../../.. -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/gennmtab/../../../lib/util/include
arm-xscale-linux-gnueabi-gcc -o gennmtab  gennmtab.o
make[3]: Leaving directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/gennmtab'
make -C xmlparse/ -f /home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/../../lib/expat/xmlparse/Makefile \
    all
make[3]: Entering directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmlparse'
/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmlparse/../../../libtool --mode=compile arm-xscale-linux-gnueabi-gcc -c -Iblddir -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmlparse/../../.. -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmlparse/../../../lib/util/include -I../xmltok -DNDEBUG -Wall -Wundef -Wimplicit -W -Winline -Wundef  -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -fno-common -g -O3   xmlparse.c
mkdir .libs
arm-xscale-linux-gnueabi-gcc -c -Iblddir -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmlparse/../../.. -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmlparse/../../../lib/util/include -I../xmltok -DNDEBUG -Wall -Wundef -Wimplicit -W -Winline -Wundef -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -fno-common -g -O3 xmlparse.c  -fPIC -DPIC -o .libs/xmlparse.lo
arm-xscale-linux-gnueabi-gcc -c -Iblddir -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmlparse/../../.. -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmlparse/../../../lib/util/include -I../xmltok -DNDEBUG -Wall -Wundef -Wimplicit -W -Winline -Wundef -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -fno-common -g -O3 xmlparse.c -o xmlparse.o >/dev/null 2>&1
mv -f .libs/xmlparse.lo xmlparse.lo
/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmlparse/../../../libtool --mode=link arm-xscale-linux-gnueabi-gcc -o libxmlrpc_xmlparse.la -version-info 9:15:6   -rpath /home/CLi/develop/crosstool-ng/x-tools/armxscalexmlrpc/lib  xmlparse.lo
rm -fr .libs/libxmlrpc_xmlparse.la .libs/libxmlrpc_xmlparse.* .libs/libxmlrpc_xmlparse.*

*** Warning: This library needs some functionality provided by -lc.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have.
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.
arm-xscale-linux-gnueabi-gcc -shared  xmlparse.lo   -Wl,-soname -Wl,libxmlrpc_xmlparse.so.3 -o .libs/libxmlrpc_xmlparse.so.3.6.15
(cd .libs && rm -f libxmlrpc_xmlparse.so.3 && ln -s libxmlrpc_xmlparse.so.3.6.15 libxmlrpc_xmlparse.so.3)
(cd .libs && rm -f libxmlrpc_xmlparse.so && ln -s libxmlrpc_xmlparse.so.3.6.15 libxmlrpc_xmlparse.so)
ar cru .libs/libxmlrpc_xmlparse.a  xmlparse.o
ranlib .libs/libxmlrpc_xmlparse.a
creating libxmlrpc_xmlparse.la
(cd .libs && rm -f libxmlrpc_xmlparse.la && ln -s ../libxmlrpc_xmlparse.la libxmlrpc_xmlparse.la)
make[3]: Leaving directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmlparse'
make -C xmltok/ -f /home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/../../lib/expat/xmltok/Makefile \
    all
make[3]: Entering directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmltok'
rm -f nametab.h
../gennmtab/gennmtab >nametab.h || (rm -f nametab.h || false)
/bin/sh: ../gennmtab/gennmtab: cannot execute binary file
/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmltok/../../../libtool --mode=compile arm-xscale-linux-gnueabi-gcc -c -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmltok/../../.. -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmltok/../../../lib/util/include  \
  -DNDEBUG -Wall -Wundef -Wimplicit -W -Winline -Wundef  -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -fno-common -g -O3 -DXML_BYTE_ORDER=0   xmltok.c
mkdir .libs
arm-xscale-linux-gnueabi-gcc -c -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmltok/../../.. -I/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmltok/../../../lib/util/include -DNDEBUG -Wall -Wundef -Wimplicit -W -Winline -Wundef -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -fno-common -g -O3 -DXML_BYTE_ORDER=0 xmltok.c  -fPIC -DPIC -o .libs/xmltok.lo
xmltok.c:9:21: fatal error: nametab.h: No such file or directory
compilation terminated.
/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/../../lib/expat/xmltok/Makefile:52: recipe for target `xmltok.lo' failed
make[3]: *** [xmltok.lo] Error 1
make[3]: Leaving directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmltok'
/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/../../Makefile.common:147: recipe for target `xmltok/all' failed
make[2]: *** [xmltok/all] Error 2
make[2]: Leaving directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat'
/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib/../Makefile.common:147: recipe for target `expat/all' failed
make[1]: *** [expat/all] Error 2
make[1]: Leaving directory `/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/lib'
/home/CLi/develop/xmlrpc/xmlrpc-c-1.06.31/Makefile.common:147: recipe for target `lib/all' failed
make: *** [lib/all] Error 2

CLi@PC-CLI-1 ~/develop/xmlrpc/xmlrpc-c-1.06.31
$

即:

xmltok.c:9:21: fatal error: nametab.h: No such file or directory

 

【解决过程】

1.参考:

Build error on Windows (efter commit 6b6c83a7180afa31a6bf0b2ea6a04a0b316652f4, new xmlrpc stuff)

去看看:

dependency-fix-diff.txt

结果没帮助。

2.看了看源码:

xmlrpc-c-1.06.31\lib\expat\xmltok\xmltok.c

中,的确是:

/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/

#include "xmlrpc_config.h"
#include "xmldef.h"
#include "xmltok.h"
#include "nametab.h"

但是目录下没有nametab.h

3.参考:

http://ftp.cse.yzu.edu.tw/raspbian/raspbian/logs/main/x/xmlrpc-c.log

看到是:

make[5]: Entering directory `/«PKGBUILDDIR»/lib/expat/xmltok'
rm -f nametab.h
../gennmtab/gennmtab >nametab.h

然后也看到,的确有gennmtab:

CLi@PC-CLI-1 ~/develop/xmlrpc/xmlrpc-c-1.06.31
$ ls lib/expat/gennmtab/ -la
total 54
drwxr-x---+ 1 CLi Domänen-Benutzer     0 Aug  2 14:23 .
drwxr-x---+ 1 CLi Domänen-Benutzer     0 Nov  3  2008 ..
-rw-r-----  1 CLi Domänen-Benutzer     9 Mar  1  2005 .cvsignore
-rwxr-xr-x  1 CLi Domänen-Benutzer 15642 Aug  2 14:23 gennmtab
-rw-r-----  1 CLi Domänen-Benutzer  9515 Mar  1  2005 gennmtab.c
-rw-r-----  1 CLi Domänen-Benutzer  4058 Mar 28  2005 gennmtab.dsp
-rw-r--r--  1 CLi Domänen-Benutzer 11868 Aug  2 14:23 gennmtab.o
-rw-r-----  1 CLi Domänen-Benutzer   652 Nov  7  2005 Makefile
-rw-r-----  1 CLi Domänen-Benutzer     0 Oct 24  2007 Makefile.depend

所以,试试手动去生成一下,结果没发执行:

CLi@PC-CLI-1 ~/develop/xmlrpc/xmlrpc-c-1.06.31
$ cd lib/expat/xmltok/

CLi@PC-CLI-1 ~/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmltok
$ ../gennmtab/gennmtab > nametab.h
bash: ../gennmtab/gennmtab: cannot execute binary file

然后发现是arm的:

CLi@PC-CLI-1 ~/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmltok
$ file ../gennmtab/gennmtab
../gennmtab/gennmtab: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.19, not stripped

4.参考:

https://github.com/gooselinux/xmlrpc-c/blob/master/xmlrpc-c-cmake.patch

发现,好像此patch,就是加了相关的,如何生成nametab.h的动作的。

但是却没发移植过来。

5.后来看到了makefile:

xmlrpc-c-1.06.31\lib\expat\xmltok\Makefile

中是:

GENNMTAB = ../gennmtab/gennmtab

nametab.h: $(GENNMTAB)
	rm -f $@
	$(GENNMTAB) >$@ || (rm -f $@ || false)

$(GENNMTAB):
	$(MAKE) -C $(dir $@) $(notdir $@)

xmltok.lo: nametab.h

即,makefile中,本身就有此逻辑了。

然后才注意到,之前的编译输出信息中的:

rm -f nametab.h
../gennmtab/gennmtab >nametab.h || (rm -f nametab.h || false)
/bin/sh: ../gennmtab/gennmtab: cannot execute binary file

即,那时候,就发现没发执行对应的gennmtab了。

所以,问题转化为:

/bin/sh: ../gennmtab/gennmtab: cannot execute binary file

了。

6.参考:

http://sourceforge.net/mailarchive/forum.php?thread_name=4FE83F61.5070305%40m1stereo.tv&forum_name=xmlrpc-c-devel

去试试:

CLi@PC-CLI-1 ~/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmltok
$ ls
ascii.h     dllmain.c    latin1tab.h  Makefile.depend  utf8tab.h  xmlrole.c  xmltok.c    xmltok.h       xmltok_impl.h
asciitab.h  iasciitab.h  Makefile     nametab.h        xmldef.h   xmlrole.h  xmltok.dsp  xmltok_impl.c  xmltok_ns.c

CLi@PC-CLI-1 ~/develop/xmlrpc/xmlrpc-c-1.06.31/lib/expat/xmltok
$ cd ../../

CLi@PC-CLI-1 ~/develop/xmlrpc/xmlrpc-c-1.06.31/lib
$ cd ..

CLi@PC-CLI-1 ~/develop/xmlrpc/xmlrpc-c-1.06.31
$ gcc -I. lib/expat/gennmtab/gennmtab.c -o lib/expat/gennmtab/gennmtab

然后再继续去make,就可以继续编译了。

 

【总结】

arm-xscale-linux-gnueabi-gcc交叉编译xmlrpc的话,期间虽然会正常的编译出来gennmtab,但是由于是arm平台的,无法运行,所以无法生成对应的nametab.h,导致后续找不到对应的nametab.h。

结果,暂时只能是手动用gcc编译生成gennmtab,暂时规避此问题。

感觉也不是很好的解决办法。

希望以后可以找到根本的解决办法。

 


虽然可以继续编译了,但是又出现其他问题:

【已解决】cygwin下用arm-xscale-linux-gnueabi-gcc交叉编译xmlrpc出错:xmltok.c:83:10: error: ‘namingBitmap’ undeclared (first use in this function)



发表评论

电子邮件地址不会被公开。 必填项已用*标注

无觅相关文章插件,快速提升流量