我正在尝试在 Mac OS X 10.5 (Leopard) 服务器上构建GnuTLS(是的,我知道,它有点过时了,但这就是该服务器目前正在运行的)并且在构建Nettle时遇到了问题:我已经建造并安装了GMP,但荨麻configure
找不到它。
我按如下方式构建和安装了 GMP 5.0.2(GCC 版本解决方案来自这里):
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
Amake 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”选项)都无济于事。我也尝试使用与CC=gcc-4.2 CXX=g++4.2 ./configure --prefix=/usr/local
编译 GMP 相同版本的 GCC ( ),结果没有变化。--includedir
&--libdir
应该分别设置为$PREFIX/include
& $PREFIX/lib
(尤其是因为我没有指定 an --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
Nettleconfigure
总是说“ABI:标准”......不是吗?通过 ABI?)。
将 GMP 重新编译为静态库会有什么不同吗?(不,GMP 默认同时构建静态库和动态库。在显示所有已安装文件时,我在上面列出了这两个库。)