【已解决】Cygwin下用arm-xscale-linux-gnueabi交叉编译log4c出错:domnode-expat.c:51:19: fatal error: expat.h: No such file or directory

【问题】

折腾:

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

然后编译出错:

CLi@PC-CLI-1 ~/develop/log4c/log4c-1.2.1
$ make
make  all-recursive
make[1]: Entering directory `/home/CLi/develop/log4c/log4c-1.2.1'
Making all in config
make[2]: Entering directory `/home/CLi/develop/log4c/log4c-1.2.1/config'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/CLi/develop/log4c/log4c-1.2.1/config'
Making all in src
make[2]: Entering directory `/home/CLi/develop/log4c/log4c-1.2.1/src'
make  all-recursive
make[3]: Entering directory `/home/CLi/develop/log4c/log4c-1.2.1/src'
Making all in sd
make[4]: Entering directory `/home/CLi/develop/log4c/log4c-1.2.1/src/sd'
/bin/sh ../../libtool --tag=CC    --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src       -g -O2 -Wall -MT stack.lo -MD -MP -MF .deps/stack.Tpo -c -o stack.lo stack.c
mkdir .libs
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT stack.lo -MD -MP -MF .deps/stack.Tpo -c stack.c  -fPIC -DPIC -o .libs/stack.o
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT stack.lo -MD -MP -MF .deps/stack.Tpo -c stack.c -o stack.o >/dev/null 2>&1
mv -f .deps/stack.Tpo .deps/stack.Plo
/bin/sh ../../libtool --tag=CC    --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src       -g -O2 -Wall -MT list.lo -MD -MP -MF .deps/list.Tpo -c -o list.lo list.c
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT list.lo -MD -MP -MF .deps/list.Tpo -c list.c  -fPIC -DPIC -o .libs/list.o
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT list.lo -MD -MP -MF .deps/list.Tpo -c list.c -o list.o >/dev/null 2>&1
mv -f .deps/list.Tpo .deps/list.Plo
/bin/sh ../../libtool --tag=CC    --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src       -g -O2 -Wall -MT malloc.lo -MD -MP -MF .deps/malloc.Tpo -c -o malloc.lo malloc.c
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT malloc.lo -MD -MP -MF .deps/malloc.Tpo -c malloc.c  -fPIC -DPIC -o .libs/malloc.o
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT malloc.lo -MD -MP -MF .deps/malloc.Tpo -c malloc.c -o malloc.o >/dev/null 2>&1
mv -f .deps/malloc.Tpo .deps/malloc.Plo
/bin/sh ../../libtool --tag=CC    --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src       -g -O2 -Wall -MT factory.lo -MD -MP -MF .deps/factory.Tpo -c -o factory.lo factory.c
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT factory.lo -MD -MP -MF .deps/factory.Tpo -c factory.c  -fPIC -DPIC -o .libs/factory.o
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT factory.lo -MD -MP -MF .deps/factory.Tpo -c factory.c -o factory.o >/dev/null 2>&1
mv -f .deps/factory.Tpo .deps/factory.Plo
/bin/sh ../../libtool --tag=CC    --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src       -g -O2 -Wall -MT hash.lo -MD -MP -MF .deps/hash.Tpo -c -o hash.lo hash.c
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT hash.lo -MD -MP -MF .deps/hash.Tpo -c hash.c  -fPIC -DPIC -o .libs/hash.o
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT hash.lo -MD -MP -MF .deps/hash.Tpo -c hash.c -o hash.o >/dev/null 2>&1
mv -f .deps/hash.Tpo .deps/hash.Plo
/bin/sh ../../libtool --tag=CC    --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src       -g -O2 -Wall -MT sprintf.lo -MD -MP -MF .deps/sprintf.Tpo -c -o sprintf.lo sprintf.c
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT sprintf.lo -MD -MP -MF .deps/sprintf.Tpo -c sprintf.c  -fPIC -DPIC -o .libs/sprintf.o
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT sprintf.lo -MD -MP -MF .deps/sprintf.Tpo -c sprintf.c -o sprintf.o >/dev/null 2>&1
mv -f .deps/sprintf.Tpo .deps/sprintf.Plo
/bin/sh ../../libtool --tag=CC    --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src       -g -O2 -Wall -MT test.lo -MD -MP -MF .deps/test.Tpo -c -o test.lo test.c
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT test.lo -MD -MP -MF .deps/test.Tpo -c test.c  -fPIC -DPIC -o .libs/test.o
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT test.lo -MD -MP -MF .deps/test.Tpo -c test.c -o test.o >/dev/null 2>&1
mv -f .deps/test.Tpo .deps/test.Plo
/bin/sh ../../libtool --tag=CC    --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src       -g -O2 -Wall -MT sd_xplatform.lo -MD -MP -MF .deps/sd_xplatform.Tpo -c -o sd_xplatform.lo sd_xplatform.c
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT sd_xplatform.lo -MD -MP -MF .deps/sd_xplatform.Tpo -c sd_xplatform.c  -fPIC -DPIC -o .libs/sd_xplatform.o
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT sd_xplatform.lo -MD -MP -MF .deps/sd_xplatform.Tpo -c sd_xplatform.c -o sd_xplatform.o >/dev/null 2>&1
mv -f .deps/sd_xplatform.Tpo .deps/sd_xplatform.Plo
/bin/sh ../../libtool --tag=CC    --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src       -g -O2 -Wall -MT error.lo -MD -MP -MF .deps/error.Tpo -c -o error.lo error.c
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT error.lo -MD -MP -MF .deps/error.Tpo -c error.c  -fPIC -DPIC -o .libs/error.o
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT error.lo -MD -MP -MF .deps/error.Tpo -c error.c -o error.o >/dev/null 2>&1
mv -f .deps/error.Tpo .deps/error.Plo
/bin/sh ../../libtool --tag=CC    --mode=compile arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src       -g -O2 -Wall -MT domnode-expat.lo -MD -MP -MF .deps/domnode-expat.Tpo -c -o domnode-expat.lo domnode-expat.c
 arm-xscale-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I../../src -I../../src -g -O2 -Wall -MT domnode-expat.lo -MD -MP -MF .deps/domnode-expat.Tpo -c domnode-expat.c  -fPIC -DPIC -o .libs/domnode-expat.o
domnode-expat.c:51:19: fatal error: expat.h: No such file or directory
compilation terminated.
Makefile:318: recipe for target `domnode-expat.lo' failed
make[4]: *** [domnode-expat.lo] Error 1
make[4]: Leaving directory `/home/CLi/develop/log4c/log4c-1.2.1/src/sd'
Makefile:277: recipe for target `all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/CLi/develop/log4c/log4c-1.2.1/src'
Makefile:197: recipe for target `all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/CLi/develop/log4c/log4c-1.2.1/src'
Makefile:338: recipe for target `all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/CLi/develop/log4c/log4c-1.2.1'
Makefile:226: recipe for target `all' failed
make: *** [all] Error 2

CLi@PC-CLI-1 ~/develop/log4c/log4c-1.2.1
$

即:

domnode-expat.c:51:19: fatal error: expat.h: No such file or directory

 

【解决过程】

1.之前:

【已解决】Cygwin下用arm-xscale-linux-gnueabi交叉编译log4c出错:configure.in:194: warning: macro `AM_PATH_EXPAT’ not found in library

时,就注意到了:

此处记录一下,如果最后编译不成功,则,还是根据官网,去先下载和交叉编译expat:

http://expat.sourceforge.net/

然后再去编译此log4c。

所以,此处需要去下载并交叉编译expat:

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

2.然后再参考:

log4c交叉编译问题及解决方法

去-I加上路径:

export PATH=$PATH:$HOME/develop/crosstool-ng/x-tools/armxscaleexpat/bin
export LDFLAGS="-L$HOME/develop/crosstool-ng/x-tools/armxscaleexpat/lib"
export CFLAGS="-I$HOME/develop/crosstool-ng/x-tools/armxscaleexpat/include"

然后再去make试试,就可以了,至少解决了此问题了。

 

【总结】

出现:

fatal error: expat.h: No such file or directory

的错误时,加上对应的expat的环境变量:

export PATH=$PATH:$HOME/develop/crosstool-ng/x-tools/armxscaleexpat/bin
export LDFLAGS="-L$HOME/develop/crosstool-ng/x-tools/armxscaleexpat/lib"
export CFLAGS="-I$HOME/develop/crosstool-ng/x-tools/armxscaleexpat/include"

再去make即可解决此问题。


但是,又出现,其他的,感觉相关的问题:

【未解决】【已解决】Cygwin下用arm-xscale-linux-gnueabi交叉编译log4c出错:libtool: line 1326: bin/arm-xscale-linux-gnueabi-gcc: Bad address



发表评论

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

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