1. 程式人生 > >[PandoraBox SDK]交叉編譯libpcap提示configure: error: C compiler cannot create executables錯誤

[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

[[email protected] libpcap]$ yaourt -S cloog

[[email protected] 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庫上。

[[email protected] libpcap]$ sudo ln -s /usr/lib/libisl.so.15.3.0 /usr/lib/libisl.so.10

此時再執行配置
[[email protected] 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

[[email protected] libpcap]$ make
……中間省略……
config.status: creating pcap-config.tmp
mv pcap-config.tmp pcap-config

[[email protected] libpcap]$ find . -name “*.a”
./libpcap.a

編譯通過~