The migration to the LLVM project's lld linker as the system linker (/usr/bin/ld) for FreeBSD is in progress - it is the case for arm64 and amd64 today, and i386 will switch once ports issues are addressed - see exp-run in PR214864. Linking math/p5-Math-Pari with lld fails with errors of the form: /usr/bin/ld: error: can't create dynamic relocation R_386_32 against local symbol in readonly segment; recompile object files with -fPIC >>> defined in mp.o >>> referenced by mp.c >>> mp.o:(pari_kernel_init) /usr/bin/ld: error: can't create dynamic relocation R_386_32 against symbol: gpmalloc in readonly segment; recompile object files with -fPIC >>> defined in init.o >>> referenced by mp.c >>> mp.o:(pari_kernel_init) http://package18.nyi.freebsd.org/data/headi386PR214864-default/2018-07-30_18h09m59s/logs/errors/p5-Math-Pari-2.01080900.log
I added -fuse-ld=lld to LDFLAGS and it currently has LLD_UNSAFE=yes already in ports and I did not get an error in poudriere on 12-current i386
(In reply to Nathan from comment #1) It looks like this port does not honour LDFLAGS, so adding -fuse-ld=lld there likely has no effect. With LLD_UNSAFE=yes and -Wl,-znotext in LDFLAGS it still fails with: cc -o libpari-gmp.so.2.3.5 -shared -O2 -pipe -I/usr/ports/math/p5-Math-Pari/work/pari-2.3.5/src/headers -I/usr/ports/math/p5-Math-Pari/work/pari-2.3.5/build -fstack-protector -fno-strict-aliasing -Wl,-shared,-soname=libpari-gmp.so.2 mp.o mpinl.o Flx.o Qfb.o RgX.o alglin1.o alglin2.o arith1.o arith2.o base1.o base2.o base3.o base4.o base5.o bibli1.o bibli2.o buch1.o buch2.o buch3.o buch4.o galconj.o gen1.o gen2.o gen3.o ifactor1.o perm.o polarit1.o polarit2.o polarit3.o rootpol.o subcyclo.o subgroup.o trans1.o trans2.o trans3.o anal.o compat.o default.o errmsg.o es.o init.o intnum.o members.o sumiter.o aprcl.o elldata.o elliptic.o galois.o groupid.o kummer.o mpqs.o nffactor.o part.o stark.o subfield.o thue.o -lc -lm -L/usr/local/lib -lgmp /usr/bin/ld: error: can't create dynamic relocation R_386_32 against local symbol in readonly segment; recompile object files with -fPIC >>> defined in mp.o >>> referenced by mp.c >>> mp.o:(pari_kernel_init)
Created attachment 197219 [details] Fix LLD on i386 Tried with and without patch on 12-i386
Just tested it on 11.2 poudriere jail successfully
Comment on attachment 197219 [details] Fix LLD on i386 Patch looks reasonable
(In reply to Ed Maste from comment #5) Makefile.PL pulls the info from config/ldflags, and it had just -Wl in the script, so replaced it and worked
Patch works for me.
lld has been enabled as system linker for i386 on stable/12 in advance of 12.1
Adding CFLAGS_i386=-fPIC (as is done for powerpc/powerpc64) and removing the BROKEN_i386 fixes it for me. I imagine the same thing will be true for aarch64, adding -fPIC and removing BROKEN_aarch64. Hopefully someone can make the change above or use the patch referenced in comment 3.
(In reply to Ed Maste from comment #9) I confirmed it builds fine on aarch64 (12.1, 13-current) with your suggestions.
(In reply to Mikael Urankar from comment #10) Great, thank you for checking.
A commit references this bug: Author: mikael Date: Wed Jun 10 17:46:30 UTC 2020 New revision: 538415 URL: https://svnweb.freebsd.org/changeset/ports/538415 Log: math/p5-Math-Pari: fix build on i386 PR: 230213 Submitted by: Nathan ndowens04@gmail.com Reviewed by: emaste, mikael Approved by: perl (maintainer timeout, > 1 year) Changes: head/math/p5-Math-Pari/Makefile