relocation errors

Daniel Green ddgreen at gmail.com
Mon Nov 9 23:34:53 UTC 2020


I have been attempting to switch MoarVM (one of the VMs that Rakudo, the
Raku (nee Perl 6) compiler, targets) from using libtommath to libgmp. I
have all the source code changes done, but when compiling/linking, I get:

/usr/bin/ld: 3rdparty/gmp/libgmp.a(dive_1.o): warning: relocation against
`__gmp_binvert_limb_table' in read-only section `.text'
/usr/bin/ld: 3rdparty/gmp/libgmp.a(mode1o.o): relocation R_X86_64_PC32
against symbol `__gmp_binvert_limb_table' can not be used when making a
shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value

even though MoarVM and our libgmp submodule are in fact being compiled with
-fPIC. I can actually get it to build by linking against my system gmp
(fwiw, I'm using Arch linux), but I also need to get it building with our
submodule'd version.

My CINCLUDES has `-I3rdparty/gmp` in it and my LDLIBS is `-L./3rdparty/gmp
-lgmp -lm -lpthread -lrt -ldl -lzstd`. The Make target to build the
submodule is `cd 3rdparty/gmp && sh .bootstrap && CC='$(CC)' CFLAGS='
$(CFLAGS)' ./configure   && $(MAKE) && cp .libs/libgmp.a . && cd .. $(NOOUT)`.
I am happy to give any more information needed over email, but I'm also in
the #moarvm channel on freenode.net.

Thanks,
Dan


More information about the gmp-discuss mailing list