为什么 Nettle 2.4 的“configure”找不到 GMP 5.0.2?
我正在尝试在 Mac OS X 10.5 (Leopard) 服务器上构建 GnuTLS (是的,我知道,它有点过时了,但这就是该服务器目前正在运行的)并且遇到了构建 Nettle:我已经构建了&安装了 GMP,但 Nettle 的 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
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
:构建&安装成功,但由于缺少 GMP,因此无法构建 libhogweed
。经过进一步检查,我在 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_getlimbn' 。 “__gmpz_powm_sec”在 /usr/local/include/gmp.h
中定义,因此有关我的 GMP 安装的所有内容似乎都是正确的。
我尝试了各种配置选项(特别是寻找某种类型的“--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 "[email protected]"
| #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 会构建静态库和动态库。在显示所有已安装文件时,我在上面列出了这两个库。)
I'm attempting to build GnuTLS on Mac OS X 10.5 (Leopard) Server (yeah, I know, it's a bit dated, but that's what this server is running at the moment) and am running into an issue building Nettle: I've built & installed GMP, but Nettle's configure
cannot find it.
I built & installed GMP 5.0.2 as follows (the GCC version solution is from 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
A make check
passes all tests and I end up with the following GMP files installed:
/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
However, when I attempt to build Nettle 2.4, as follows:
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
It builds & installs successfully, but it doesn't build libhogweed
because GMP is missing. Upon further inspection, I've found the following warnings in the 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
Obviously, GMP 5.0.2 is newer than 3.1, plus both '__gmpz_getlimbn' & '__gmpz_powm_sec' are defined in /usr/local/include/gmp.h
, so everything about my GMP install seems correct.
I've tried all sorts of configure
options (esp. looking for some type of '--with-gmp' option) to no avail. I have also tried using the same version of GCC (CC=gcc-4.2 CXX=g++4.2 ./configure --prefix=/usr/local
) as I did to compile GMP, with no change in result. --includedir
& --libdir
should be set to $PREFIX/include
& $PREFIX/lib
, respectively, (esp. since I'm not specifying an --exec-prefix
) so I can't figure out why it wouldn't be able to find GMP.
Any suggestions would be greatly appreciated.
Update:
I found the following in config.log
explaining the failure to find 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]"
| #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
returns the following:
/usr/local/lib/libgmp.dylib: Mach-O 64-bit dynamically linked shared library x86_64
This server is running an Intel Core 2 Duo processor, so that 64-bit Mach library looks correct to me. I don't know how to tell whether nettle is trying to built for 32-bit or 64-bit architecture, so I tried CC=gcc-4.2 CXX=g++4.2 ABI=64 ./configure --prefix=/usr/local
with no change (also, even when specifying ABI=32
Nettle's configure
always says "ABI: standard"... does it not pass ABI through?).
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.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在2.7版本中也遇到了同样的问题。我最终让它工作的方法是通过以下方式强制它在 /usr/local 下查找:
直接使用 ./configure 选项再多也不会让 libnettle 为我识别 libgmp。
I was having the same problem with version 2.7. The way I finally got it to work was to force it to look under /usr/local via:
No amount of playing with ./configure options directly would get libnettle to recognize libgmp for me.
事实证明,Nettle 2.4 中包含的 config.guess 中存在一个错误,它无法在 Mac OS X 下检测到正确的 32 位/64 位类型,因此它默认为 32 位,在 GMP 库(编译为 64 位库)中找不到符号。正如 Nettle 开发者此处所述,您只需下载最新的config.guess 和/或禁用汇编器。
较新的
config.guess
对我来说不起作用,所以我强制它进入 64 位模式并禁用汇编器。 Libnettle(和 libhogweed;不包括 GMP 依赖项)的最终工作构建说明是:It turns out, there's a bug in
config.guess
included with Nettle 2.4 which does not detect the correct 32-bit/64-bit type under Mac OS X, so it was defaulting to 32-bit and couldn't find symbols in the GMP library (which was compiled as a 64-bit library). As the Nettle developer noted here, you can just download the latestconfig.guess
and or disable assembler.The newer
config.guess
didn't work for me, so I forced it into 64-bit mode and disabled assembler. The final working build instructions for Libnettle (and libhogweed; not including the GMP dependancy) are: