我正在尝试在我的 x86 机器(VirtualBox 下的 Ubuntu 11.04)上为 arm 编译 gnutls。现在我一直在编译 libnettle。./configure脚本找不到 -lgmp 并在没有我需要的公钥加密(没有libhogweed )的情况下生成荨麻。config.log中的消息如下:
对于 x86:
configure:6976: checking for __gmpz_getlimbn in -lgmp
configure:7001: gcc -o conftest -L"/home/xena/gnutls/out/x86/lib/" conftest.c -lgmp >&5
/usr/bin/ld: cannot find -lgmp
collect2: ld returned 1 exit status
configure:7001: $? = 1
对于 ARM:
configure:6976: checking for __gmpz_getlimbn in -lgmp
configure:7001: arm-none-linux-gnueabi-gcc -o conftest -L"/home/xena/gnutls/out/arm/lib/" -mcpu=arm926ej-s -mthumb conftest.c -lgmp >&5
/usr/local/codesourcery/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.3/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
configure:7001: $? = 1
这些库在那里:
xena@xena-VirtualBox:~/gnutls$ ls /home/xena/gnutls/out/x86/lib/ | grep libgmp
libgmp.a
libgmp.la
libgmp.so
libgmp.so.10
libgmp.so.10.1.2
xena@xena-VirtualBox:~/gnutls$ ls /home/xena/gnutls/out/arm/lib/ | grep libgmp
libgmp.a
libgmp.la
libgmp.so
libgmp.so.10
libgmp.so.10.1.2
他们在./configure之外工作:
xena@xena-VirtualBox:~/gnutls$ gedit conftest.c
xena@xena-VirtualBox:~/gnutls$ gcc -o conftest -L"/home/xena/gnutls/out/x86/lib/" conftest.c -lgmp
xena@xena-VirtualBox:~/gnutls$ ls | grep conftest
conftest
conftest.c
xena@xena-VirtualBox:~/gnutls$ rm conftest
xena@xena-VirtualBox:~/gnutls$ gedit conftest.c
xena@xena-VirtualBox:~/gnutls$ arm-none-linux-gnueabi-gcc -o conftest -L"/home/xena/gnutls/out/arm/lib/" -mcpu=arm926ej-s -mthumb conftest.c -lgmp
xena@xena-VirtualBox:~/gnutls$ ls | grep conftest
conftest
conftest.c
xena@xena-VirtualBox:~/gnutls$ rm conftest
这是我的构建环境:
xena@xena-VirtualBox:~/gnutls$ pwd
/home/xena/gnutls
xena@xena-VirtualBox:~/gnutls$ ls
build.sh clean.sh gmp-5.1.2.tar.xz gmp-help.txt gnutls-3.2.2.tar.xz gnutls-help.txt nettle-2.7.1.tar.gz nettle-help.txt
还有我的构建脚本:
ROOT=/home/xena/gnutls
mkdir -p $ROOT/out
tar -xf gmp-5.1.2.tar.xz; cd gmp-5.1.2/
./configure --prefix=$ROOT/out/x86 && make && make install
cd ..; mv gmp-5.1.2 gmp-5.1.2.x86
tar -xf gmp-5.1.2.tar.xz; cd gmp-5.1.2/
./configure --prefix=$ROOT/out/arm --host=arm-none-linux-gnueabi CFLAGS="-mcpu=arm926ej-s -mthumb" && make && make install
cd ..; mv gmp-5.1.2 gmp-5.1.2.arm
tar -xf nettle-2.7.1.tar.gz; cd nettle-2.7.1/
./configure --prefix=$ROOT/out/x86 --disable-openssl --enable-shared CFLAGS="-L\"$ROOT/out/x86/lib/\"" && make && make install
cd ..; mv nettle-2.7.1 nettle-2.7.1.x86
tar -xf nettle-2.7.1.tar.gz; cd nettle-2.7.1/
./configure --prefix=$ROOT/out/arm --disable-openssl --enable-shared --host=arm-none-linux-gnueabi CFLAGS="-L\"$ROOT/out/arm/lib/\" -mcpu=arm926ej-s -mthumb" && make && make install
cd ..; mv nettle-2.7.1 nettle-2.7.1.arm
#tar -xf gnutls-3.2.2.tar.xz; cd gnutls-3.2.2/
#./configure --prefix=$ROOT/gnutls-out/x86 --enable-threads=posix --with-sysroot=$ROOT/out/x86 && make && make install
#cd ..; mv gnutls-3.2.2 gnutls-3.2.2.x86
#tar -xf gnutls-3.2.2.tar.xz; cd gnutls-3.2.2/
#./configure --prefix=$ROOT/gnutls-out/arm --enable-threads=posix --with-sysroot=$ROOT/out/arm --host=arm-none-linux-gnueabi CFLAGS="-mcpu=arm926ej-s -mthumb" && make && make install
#cd ..; mv gnutls-3.2.2 gnutls-3.2.2.arm