MPC 0.8.2/0.9和GCC 4.6.2 的一处兼容性问题

作者:

在

在用GCC 4.6.2编译MPC 0.8.2/0.9的时候(动态链接),在configure的时候出现这样的错误:

checking for __gmpz_init in -lgmp... no
configure: error: libgmp not found or uses a different ABI.

在config.log里面可以看到这样的信息:

configure:10833: checking for __gmpz_init in -lgmp
configure:10858: gcc -std=gnu99 -o conftest.exe -m32 -O2 -pedantic -fomit-frame-pointer -mtune=pentiumpro -march=pentiumpro -I/mingwlibs/include -I/mingwlibs/include  -L/mingwlibs/lib -L/mingwlibs/lib  -no-undefined conftest.c -lgmp   >&5
gcc.exe: error: unrecognized option '-no-undefined'
configure:10858: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "mpc"
| #define PACKAGE_TARNAME "mpc"
| #define PACKAGE_VERSION "0.8.2"
| #define PACKAGE_STRING "mpc 0.8.2"
| #define PACKAGE_BUGREPORT "mpc-discuss@lists.gforge.inria.fr"
| #define PACKAGE_URL ""
| #define PACKAGE "mpc"
| #define VERSION "0.8.2"
| #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 LT_OBJDIR ".libs/"
| /* 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_init ();
| int
| main ()
| {
| return __gmpz_init ();
|   ;
|   return 0;
| }
configure:10867: result: no
configure:10872: error: libgmp not found or uses a different ABI.

其实这儿的参数-no-undefined本该传给链接器的,所以直接把configure里面行#4457(0.8.2)或#4501(0.9)从

LDFLAGS="$LDFLAGS -no-undefined"

改成

LDFLAGS="$LDFLAGS -Wl,-no-undefined"

就好了。

————————————————————————————————

更多信息:http://lists.gnu.org/archive/html/libtool/2011-03/msg00015.html

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注