ports/71803: [PATCH] math/pari-devel is now able to compile with gcc342 on 5.3 and 6.0-Current
Paul Seniura
pdseniura at techie.com
Thu Sep 16 21:00:50 UTC 2004
>Number: 71803
>Category: ports
>Synopsis: [PATCH] math/pari-devel is now able to compile with system-gcc342 on 5.3 and 6.0-Current
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Sep 16 21:00:48 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: "Paul Seniura" <pdseniura at techie.com>
>Release: FreeBSD 6.0-CURRENT i386
>Organization:
State of Okla. D.O.T.
>Environment:
System: FreeBSD techpc04.okladot.state.ok.us 6.0-CURRENT FreeBSD 6.0-CURRENT #2: Thu Sep 16 10:00:07 CDT 2004 root at techpc04.okladot.state.ok.us:/usr/obj/src/sys/IBM300SY_4BSD_Os i386
>Description:
I found the discussion of this problem here:
<http://pari.math.u-bordeaux.fr/archives/pari-dev-0404/msg00015.html>
The original project's ./Configure script is improperly
using "well-known constants" (for want of a better term ;) )
to test and detect math library functions.
For example, logN(1.0) == 0.0 (for any base N>0 IIRC).
The new optimizing versions of gcc know this, without
needing to compile and call the logN() function itself.
This causes the ./Configure script to falsely assume the
log2() library exists as a built-in function (or otherwise
provided outside this application).
The same goes for the exp2() function.
A snip from my portupgrade log for this app:
[...]
Checking some common types...
...I did not find ulong.
Looking in C lib for some symbols...
...Found exp2.
...Found log2.
...Found strftime.
[...]
cc -c -O3 -DGCC_INLINE -Wall -fomit-frame-pointer -O -pipe -Os -pipe -march=pentium2 -march=pentium2 -DBOTH_GNUPLOT_AND_X11 -I. -I../src/headers -o mpinl.o ../src/kernel/none/level1.c
rm -f libpari-2.2.so.7.0.0
cc -o libpari-2.2.so.7.0.0 -shared -O3 -DGCC_INLINE -Wall -fomit-frame-pointer -O -pipe -Os -pipe -march=pentium2 -march=pentium2 -DBOTH_GNUPLOT_AND_X11 -Wl,-shared,-soname=libpari-2.2.so.7 kernel.o mp.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 aprcl.o elliptic.o galois.o groupid.o kummer.o mpqs.o nffactor.o part.o stark.o subfield.o thue.o anal.o compat.o errmsg.o es.o init.o members.o sumiter.o mpinl.o -lc -lm
if test "libpari-2.2.so.7" != "libpari-2.2.so"; then rm -f libpari-2.2.so.7; rm -f libpari-2.2.so; ln -s libpari-2.2.so.7.0.0 libpari-2.2.so.7; ln -s libpari-2.2.so.7.0.0 libpari-2.2.so; fi
rm -f gp-dyn
cc -o gp-dyn -O3 -DGCC_INLINE -Wall -fomit-frame-pointer -O -pipe -Os -pipe -march=pentium2 -march=pentium2 -Wl,-export-dynamic gp.o gp_init.o gp_rl.o highlvl.o whatnow.o plotport.o plotgnuplot.o plotX.o -Wl,-rpath,/src/ports/math/pari-devel/work/pari-2.2.7.alpha/Ofreebsd-i386:/usr/local/lib:/usr/X11R6/lib:/usr/lib -L/src/ports/math/pari-devel/work/pari-2.2.7.alpha/Ofreebsd-i386 -L/usr/local/lib -lreadline -L/usr/lib -lncurses -L/usr/local/lib -lpari-2.2 -L/usr/X11R6/lib -lX11 -lm
/src/ports/math/pari-devel/work/pari-2.2.7.alpha/Ofreebsd-i386/libpari-2.2.so: undefined reference to `exp2'
/src/ports/math/pari-devel/work/pari-2.2.7.alpha/Ofreebsd-i386/libpari-2.2.so: undefined reference to `log2'
gmake[1]: *** [gp-dyn] Error 1
gmake[1]: Leaving directory `/src/ports/math/pari-devel/work/pari-2.2.7.alpha/Ofreebsd-i386'
gmake: *** [gp] Error 2
*** Error code 2
Stop in /src/ports/math/pari-devel.
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade16264.3 make
** Fix the problem and try again.
---> Build of math/pari-devel ended at: Thu, 16 Sep 2004 13:19:09 -0500 (consumed 00:09:28)
---> Reinstallation of math/pari-devel ended at: Thu, 16 Sep 2004 13:19:09 -0500 (consumed 00:09:28)
[...]
This clearly shows the newer gcc versions do not provide
the math functions exp2() and log2(), at least with the
system gcc342 as installed in 5.3 and 6-Current.
>How-To-Repeat:
Try building math/pari-devel on 5.3 or 6-Current.
>Fix:
>From the original discussion link above, we need to fix
the "has_*.c" modules to do a _real_ test for the library
in question. It seems, for now, we need to do this only
for has_log2.c and has_exp2.c under the expanded src
tarball subdir "config/" .
Someone really needs to update the project files in CVS,
as other *ix platforms with the newer gccs will come across
these malformed tests.
We can work around it now by creating two new files under
the port skeleton's files/ subdir with this patch:
===cut-here===
diff -urN files_orig/patch-has_exp2.c files/patch-has_exp2.c
--- files_orig/patch-has_exp2.c Wed Dec 31 18:00:00 1969
+++ files/patch-has_exp2.c Thu Sep 16 14:30:23 2004
@@ -0,0 +1,6 @@
+--- config/has_exp2.c_orig Thu Sep 16 08:46:59 1999
++++ config/has_exp2.c Thu Sep 16 14:27:18 2004
+@@ -1,2 +1,2 @@
+ #include <math.h>
+-main(){double x=exp2(1.0);}
++main(){double x=exp2(0.666);}
diff -urN files_orig/patch-has_log2.c files/patch-has_log2.c
--- files_orig/patch-has_log2.c Wed Dec 31 18:00:00 1969
+++ files/patch-has_log2.c Thu Sep 16 14:30:50 2004
@@ -0,0 +1,6 @@
+--- config/has_log2.c_orig Wed Jan 8 18:16:55 2003
++++ config/has_log2.c Thu Sep 16 14:27:07 2004
+@@ -1,2 +1,2 @@
+ #include <math.h>
+-main(){double x=log2(1.0);}
++main(){double x=log2(0.666);}
===cut-here===
As you can see, I have named the new patches as
files/patch-has_exp2.c
and
files/patch-has_log2.c
I hope these names are agreeable with style etc.
We are patching the modules used by ./Configure to use a
number that is not easily computed or optimized. As the
discussion link mentions in a later thread therein, the
compiler will not hard-code such an answer to a function.
BTW I chose 0.666 as per the original poster in that
discussion. ;)
At least the project can properly detect the lack of these
functions, as shown in my new portupgrade log:
[...]
Checking some common types...
...I did not find ulong.
Looking in C lib for some symbols...
...I did not find exp2.
...I did not find log2.
...Found strftime.
[...]
...and everything seems to build as it should.
Whether or not the app _works_ is a completely different
matter, as I am still getting other things caught-up while
the ports-freeze is in effect. That is a long-winded
explanation to say I haven't tested it yet. ;)
If the app does work properly with these patches, can
someone send up-stream the patches to fix their CVS copies
of these modules, please?
-- thx, Paul Seniura
System Specialist
State of Okla. D.O.T.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list