Issue with GMP static linkage (and bundle)

Daniele Ghisi danieleghisi at gmail.com
Fri Sep 22 19:19:30 UTC 2017


Dear GMP users,

I need to link GMP statically to a project (written in C).

I can't seem to do it if the Mach-O Type of my target is set to "Bundle".
No issues when it is set to "executable" or "static library".
No issues when I use dynamic linkage either (with -lgmp)

I am on OS X 10.10.5, Xcode 7.2
I have tried to install GMP manually or with homebrew, in both cases I
still get the issue.

The specific error is
"ld: illegal text-relocation to '___gmp_binvert_limb_table' in
/usr/local/lib/libgmp.a(mp_minv_tab.o) from '___gmpn_divexact_1' in
/usr/local/lib/libgmp.a(dive_1.o) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)"

I've tried to google in search of solutions, but I had no luck.

Does anyone have a clue why this only happen when i'm building a Bundle?
Is there anything I can do?

Thanks a lot,
Daniele


More information about the gmp-discuss mailing list