为什么 Nettle 2.4 的 `configure` 找不到 GMP 5.0.2?

2024-01-27

我正在尝试建立GnuTLS http://www.gnu.org/software/gnutls/在 Mac OS X 10.5 (Leopard) 服务器上(是的,我知道,它有点过时,但这就是该服务器目前正在运行的)并且遇到了构建问题Nettle http://www.lysator.liu.se/~nisse/nettle/: 我已经构建并安装了GMP http://gmplib.org/,但是荨麻的configure找不到。

我构建并安装了 GMP 5.0.2,如下(GCC 版本解决方案来自here http://gmplib.org/list-archives/gmp-bugs/2010-January/001838.html):

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

A 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 output:

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”选项)无济于事。我也尝试过使用相同版本的 GCC (CC=gcc-4.2 CXX=g++4.2 ./configure --prefix=/usr/local)就像我编译 GMP 一样,结果没有变化。--includedir & --libdir应设置为$PREFIX/include & $PREFIX/lib分别(特别是因为我没有指定--exec-prefix)所以我不明白为什么它找不到 GMP。

任何建议都会greatly赞赏。

Update:

我在中找到了以下内容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 "[email protected] /cdn-cgi/l/email-protection"
| #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.

Running 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荨麻的configure总是说“ABI:标准”...它没有通过 ABI 吗?)。

Would re-compiling GMP as a static library make any difference? (Nope, GMP builds both static & dynamic libraries, by default. I listed both above when showing all the installed files.)


我在2.7版本中也遇到了同样的问题。我最终让它工作的方法是通过以下方式强制它在 /usr/local 下查找:

export CPPFLAGS="-I/usr/local/include"
export LDFLAGS="-L/usr/local/lib"
./configure

直接使用 ./configure 选项再多也不能让 libnettle 识别 libgmp 。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

为什么 Nettle 2.4 的 `configure` 找不到 GMP 5.0.2? 的相关文章

随机推荐