building gmp-4.2.1 on OS X
diane at ghic.org
Sun Apr 8 22:53:59 CEST 2007
I was trying to link guile 1.8.1 against gmp-4.2.1 on OS X and ran afoul
of OS X's picky linker.
ld: common symbols not allowed with MH_DYLIB output format with the
/usr/local/lib/libgmp.a(mp_bpl.o) definition of common ___gmp_junk (size 16)
/usr/bin/libtool: internal link edit command failed
After some research it appears that in addition to fiddling with the
shared library type and -fno-common, you can also make the OS X linker
happier by initializing the global variable.
The following patch makes it possible to link to guile (and probably
other "-dynamiclib"s ) without odd OS X specific CFLAGS settings.
I'm currently using
$ ./configure --disable-shared --build=none-unknown-osx
to build gmp, and all the tests in make check pass (after this patch and
the gmp_x86check_workaround_apple_ld_bug patch)
--- gmp-4.2.1.orig/mp_bpl.c 2006-03-14 07:57:54.000000000 -0800
+++ gmp-4.2.1/mp_bpl.c 2007-04-08 13:35:25.000000000 -0700
@@ -23,5 +23,5 @@
const int mp_bits_per_limb = BITS_PER_MP_LIMB;
const int __gmp_0 = 0;
+int __gmp_junk = 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 249 bytes
Desc: OpenPGP digital signature
Url : http://gmplib.org/list-archives/gmp-discuss/attachments/20070408/8baa22df/attachment.bin
More information about the gmp-discuss