【发布时间】:2011-12-19 10:35:57
【问题描述】:
我正在尝试在 Mac OS X 10.5 (Leopard) 服务器上构建 GnuTLS(是的,我知道,它有点过时了,但这就是该服务器目前正在运行的内容)并且遇到了构建问题Nettle:我已经构建并安装了GMP,但Nettle 的configure 找不到它。
我构建并安装了GMP 5.0.2如下(GCC版本解决方案来自here):
curl -O ftp://ftp.gmplib.org/pub/gmp-5.0.2/gmp-5.0.2.tar.bz2
tar xjf gmp-5.0.2.tar.bz2
pushd gmp-5.0.2
CC=gcc-4.2 CXX=g++4.2 ./configure --prefix=/usr/local
make
sudo make install
popd
make check 通过了所有测试,我最终安装了以下 GMP 文件:
/usr/local/include/gmp.h
/usr/local/lib/libgmp.10.dylib
/usr/local/lib/libgmp.a
/usr/local/lib/libgmp.dylib
/usr/local/lib/libgmp.la
/usr/local/share/info/gmp.info
/usr/local/share/info/gmp.info-1
/usr/local/share/info/gmp.info-2
但是,当我尝试构建 Nettle 2.4 时,如下:
curl -O http://www.lysator.liu.se/~nisse/archive/nettle-2.4.tar.gz
tar xzf nettle-2.4.tar.gz
pushd nettle-2.4
./configure --prefix=/usr/local
make
sudo make install
popd
它构建和安装成功,但它没有构建libhogweed,因为缺少 GMP。经过进一步检查,我在configure 输出中发现了以下警告:
checking for __gmpz_getlimbn in -lgmp... no
configure: WARNING: GNU MP not found, or not 3.1 or up, see http://gmplib.org/.
Support for public key algorithms will be unavailable.
checking for __gmpz_powm_sec... no
显然,GMP 5.0.2 比 3.1 更新,而且 '__gmpz_getlimbn' 和 '__gmpz_powm_sec' 都在 /usr/local/include/gmp.h 中定义,所以关于我的 GMP 安装的一切似乎都是正确的。
我尝试了各种configure 选项(尤其是寻找某种类型的“--with-gmp”选项)都无济于事。我还尝试使用与编译 GMP 相同版本的 GCC (CC=gcc-4.2 CXX=g++4.2 ./configure --prefix=/usr/local),结果没有任何变化。 --includedir & --libdir 应该分别设置为$PREFIX/include & $PREFIX/lib(尤其是因为我没有指定--exec-prefix)所以我不知道为什么它不能找到 GMP。
任何建议都会非常感谢。
更新:
我在config.log 中找到以下解释找不到 GMP 的原因:
configure:6469: checking for __gmpz_getlimbn in -lgmp
configure:6494: gcc -o conftest -g -O2 conftest.c -lgmp >&5
ld warning: in /usr/local/lib/libgmp.dylib, file is not of required architecture
Undefined symbols:
"___gmpz_getlimbn", referenced from:
_main in ccNP0jza.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
configure:6494: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "nettle"
| #define PACKAGE_TARNAME "nettle"
| #define PACKAGE_VERSION "2.4"
| #define PACKAGE_STRING "nettle 2.4"
| #define PACKAGE_BUGREPORT "nettle-bugs@lists.lysator.liu.se"
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define TIME_WITH_SYS_TIME 1
| #define SIZEOF_LONG 4
| #define HAVE_OPENSSL_BLOWFISH_H 1
| #define HAVE_OPENSSL_DES_H 1
| #define HAVE_OPENSSL_CAST_H 1
| #define HAVE_OPENSSL_AES_H 1
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| #define HAVE_STRERROR 1
| #define HAVE_GCC_ATTRIBUTE 1
| #define HAVE_FCNTL_LOCKING 1
| /* end confdefs.h. */
|
| /* Override any GCC internal prototype to avoid an error.
| Use char because int might match the return type of a GCC
| builtin and then its argument prototype would still apply. */
| #ifdef __cplusplus
| extern "C"
| #endif
| char __gmpz_getlimbn ();
| int
| main ()
| {
| return __gmpz_getlimbn ();
| ;
| return 0;
| }
configure:6503: result: no
configure:6514: WARNING: GNU MP not found, or not 3.1 or up, see http://gmplib.org/.
Support for public key algorithms will be unavailable.
运行 file /usr/local/lib/libgmp.dylib 返回以下内容:
/usr/local/lib/libgmp.dylib: Mach-O 64-bit dynamically linked shared library x86_64
此服务器运行的是 Intel Core 2 Duo 处理器,因此 64 位 Mach 库对我来说是正确的。我不知道如何判断 nettle 是在尝试构建 32 位还是 64 位架构,所以我尝试了 CC=gcc-4.2 CXX=g++4.2 ABI=64 ./configure --prefix=/usr/local 没有任何变化(同样,即使指定 ABI=32 Nettle 的 configure 总是说“ABI : 标准"...它不通过 ABI 吗?)。
将 GMP 重新编译为静态库会有什么不同吗?(不,默认情况下,GMP 同时构建静态库和动态库。我在显示所有已安装文件时都在上面列出了。)
【问题讨论】:
标签: macos gnu configure ssl gmp