Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#7825 closed defect (fixed)

pari-2.3.3.p5 compilation fails on FreeBSD/amd64

Reported by: Peter Jeremy Owned by: Peter Jeremy
Priority: major Milestone: sage-4.3.1
Component: porting: BSD Keywords:
Cc: David Kirkby, William Stein, Craig Citro Merged in: sage-4.3.1.alpha0
Authors: Peter Jeremy Reviewers: David Kirkby
Report Upstream: Completely fixed; Fix reported upstream Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


FreeBSD refers to the x86_64 architecture under its original name of 'amd64' so use this as an alias for x86_64. The `-fPIC' fix is needed to correct:

gcc  -o -shared  -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer  -Wl,-shared, 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/home/peter/sage/sage-4.3/local/lib -lgmp 
/usr/bin/ld: mp.o: relocation R_X86_64_32S can not be used when making a shared object; recompile with -fPIC
mp.o: could not read symbols: Bad value
*** Error code 1

Stop in /home/peter/sage/sage-4.3/spkg/build/pari-2.3.3.p5/src/Ofreebsd-amd64.

Attachments (1)

7825.pari.patch (1011 bytes) - added by Peter Jeremy 13 years ago.

Download all attachments as: .zip

Change History (7)

Changed 13 years ago by Peter Jeremy

Attachment: 7825.pari.patch added

comment:1 Changed 13 years ago by David Kirkby

Hi Peter,

Thank you for cc'ing me.

The fix looks like it will resolve the FreeBSD issue, but there is an obvious problem with the SPARC platform on that line, as -fPIC will be selected there too, which may not always be appropriate.

If #7818 gets implemented, it will add a variable FPIC_FLAG which could be set once for any compiler. I don't know if you could change this so spkg-install has something like


then use $FPIC_FLAG in pari-2.3.3.p5/patches/get_dlcflags.

That way, it should work today, and with simple removal of the one line from spkg-install, this could work with any compiler.

Oh why was there never a standard for compiler flags! Life would be so much easier.


comment:2 Changed 13 years ago by Peter Jeremy

Report Upstream: Not yet reported upstream; Will do shortly.Completely fixed; Fix reported upstream
Status: newneeds_review

Reported upstream as

Regarding Dave's comment above, get_dlcflags is part of pari and already has checks for GNU vs Sun CC. My patch is inside a 'if test -n "$gnuc"' block. If this test fails then '-KPIC' will be used on Solaris/SPARC. I agree that #7818 represents a more general solution that would simplify get_dlcflags.

comment:3 Changed 13 years ago by David Kirkby

Status: needs_reviewpositive_review

That looks good to me then.

I'll give that positive review.

BTW, I see you have gnuc underlined in your comments. I assume you meant to put __gnuc__ The trick to avoiding the underlining is to put exclamation marks before the occurrence of the two underscores. Hence you need to do it twice here. That used to drive me round the twist sometimes, but I finally found out how to escape things like that. It also allows one to write VirtualBox without it comping out as VirtualBox?, which I find a bit annoying.


comment:4 Changed 13 years ago by Mike Hansen

Authors: Peter Jeremy
Merged in: sage-4.3.1.alpha0
Resolution: fixed
Reviewers: David Kirkby
Status: positive_reviewclosed

I've made an SPKG out of this fix and merged it in 4.3.1.alpha0. The spkg can be found at

comment:5 Changed 13 years ago by David Kirkby

I note the date in SPKG.txt was 2009 and not 2010. I'm just about to update this again, due to the SAGE64 issues (#7133), so I'll correct that then.

comment:6 Changed 13 years ago by Minh Van Nguyen

Milestone: sage-4.3.1
Note: See TracTickets for help on using tickets.