[PandoraBox SDK]交叉编译libpcap提示configure: error: C compiler cannot create executables错误

环境:ArchLinux
源码:libpcap


下面开始编译libpcap,先将toolchain和staging_dir加入环境变量中

[form@Felicity libpcap]$ export PATH=$PATH:/home/form/K2_mt7620/PandoraBox-SDK-ralink-mt7620_gcc-4.8-linaro_uClibc-1.0.x.Linux-x86_64/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-1.0.x/bin
[form@Felicity libpcap]$ export STAGING_DIR=/home/form/K2_mt7620/PandoraBox-SDK-ralink-mt7620_gcc-4.8-linaro_uClibc-1.0.x.Linux-x86_64/staging_dir/:$STAGING_DIR
[form@Felicity libpcap]$ ./configure --host=mipsel-openwrt-linux --with-pcap=linux
checking build system type... x86_64-unknown-linux-gnu
checking host system type... mipsel-openwrt-linux-gnu
checking target system type... mipsel-openwrt-linux-gnu
checking for mipsel-openwrt-linux-gcc... mipsel-openwrt-linux-gcc
checking whether the C compiler works... no
configure: error: in `/home/form/K2_mt7620/libpcap':
configure: error: C compiler cannot create executables
See `config.log' for more details

配置错误,configure: error: C compiler cannot create executables。


错误原因分析

然后找到config.log截取其中的error段,找到具体的原因是缺libcloog-isl.so库。

/home/form/K2_mt7620/PandoraBox-SDK-ralink-mt7620_gcc-4.8-linaro_uClibc-1.0.x.Linux-x86_64/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-1.0.x/bin/../libexec/gcc/mipsel-openwrt-linux-uclibc/4.8.3/cc1: error while loading shared libraries: libcloog-isl.so.4: cannot open shared object file: No such file or directory

下面把cloog和isl库装上,包名可在https://aur.archlinux.org/packages/上找。

[form@Felicity libpcap]$ yaourt -S cloog

[form@Felicity libpcap]$ yaourt -S isl

提示:ukylin可以使用apt-get install libcloog-isl-dev命令来安装

再执行配置./configure还是报同样的错误,此时打开config.log截取error段,此时还是提示缺isl

/home/form/K2_mt7620/PandoraBox-SDK-ralink-mt7620_gcc-4.8-linaro_uClibc-1.0.x.Linux-x86_64/staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-1.0.x/bin/../libexec/gcc/mipsel-openwrt-linux-uclibc/4.8.3/cc1: error while loading shared libraries: libisl.so.10: cannot open shared object file: No such file or directory

在/usr/lib/目录可以找到libisl.so.15.3.0库文件是存在的,而且还有libisl.so和libisl.so.15两个软链接,但在配置时仍然提示找不到libisl.so.10。


解决方案

将libisl.so.10也通过软链接到libisl.so.15.3.0库上。

[form@Felicity libpcap]$ sudo ln -s /usr/lib/libisl.so.15.3.0 /usr/lib/libisl.so.10

此时再执行配置
[form@Felicity libpcap]$ ./configure –host=mipsel-openwrt-linux –with-pcap=linux
checking build system type… x86_64-unknown-linux-uclibc
checking host system type… mipsel-openwrt-linux-gnu
checking target system type… mipsel-openwrt-linux-gnu
checking for mipsel-openwrt-linux-gcc… mipsel-openwrt-linux-gcc
checking whether the C compiler works… yes
checking for C compiler default output file name… a.out
checking for suffix of executables…
checking whether we are cross compiling… yes

……中间省略……

config.status: creating Makefile
config.status: creating rpcapd/Makefile
config.status: creating config.h
config.status: executing default-1 commands

[form@Felicity libpcap]$ make
……中间省略……
config.status: creating pcap-config.tmp
mv pcap-config.tmp pcap-config

[form@F3licity libpcap]$ find . -name “*.a”
./libpcap.a

编译通过~


参考:
http://blog.csdn.net/lvshaorong/article/details/62215033
http://www.right.com.cn/forum/forum.php?mod=viewthread&tid=251362&page=1#pid2067470

你可能感兴趣的:(Router)