Subject: pkg/34563: math/pari misbuilt on FreeBSD 6
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <lminder@gmx.net>
List: pkgsrc-bugs
Date: 09/19/2006 22:30:00
>Number:         34563
>Category:       pkg
>Synopsis:       math/pari misbuilt on FreeBSD 6
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 19 22:30:00 +0000 2006
>Originator:     Lorenz Minder
>Release:        FreeBSD 6.0-STABLE
>Organization:
>Environment:
FreeBSD lorenzdesktop 6.0-STABLE FreeBSD 6.0-STABLE #2: Tue Jan 17 22:36:27 CET 2006     lorinder@lorenzdesktop:/usr/obj/usr/src/sys/MYKERNEL  i386

>Description:
math/pari is misbuilt on my FreeBSD box; I'm not exactly sure what
exactly triggers the bug though. After building and installing, if
you try to run "gp", it complains about missing libX11.so.6. The
problem is that the rpath for the xorg library is not being added to
the linker. (I'm using pkgsrc xorg, btw, but I also do so on my
NetBSD box, where I did not see the bug.)

Here's the last lines from the build stage:

libtool  --mode=link cc -o gp -O3 -DGCC_INLINE -Wall -Wno-implicit -fomit-frame-pointer -O2 -march=athlon-xp -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 gp.lo gp_init.lo gp_rl.lo highlvl.lo whatnow.lo plot.lo plotport.lo  -Wl,-R -L -lX11 -lm  libpari.la
cc -o .libs/gp -O3 -DGCC_INLINE -Wall -Wno-implicit -fomit-frame-pointer -O2 -march=athlon-xp -I/usr/pkgsrc/math/pari/work/.buildlink/include -I/usr/pkgsrc/math/pari/work/.buildlink/include/freetype2 .libs/gp.o .libs/gp_init.o .libs/gp_rl.o .libs/highlvl.o .libs/whatnow.o .libs/plot.o .libs/plotport.o  -lX11 -lm ./.libs/libpari.so -L/usr/pkgsrc/math/pari/work/.buildlink/lib  -Wl,--rpath -Wl,/usr/pkg/lib
creating gp
=> Unwrapping files-to-be-installed.

Note the "-Wl,-R -L -lX11" part, which should read "-Wl,-R/usr/pkg/xorg/lib -L/usr/pkg/xorg/lib -lX11" instead.

The problem is that the ${X11} variable is not set in config/Makefile.SH.

I see this empty $X11 even on my NetBSD box, but there the rpath
for libX11 is pulled in elsewhere on the linker line for some reason,
and this hides the problem. I don't know the reason for this
difference though.
>How-To-Repeat:
On FreeBSD, do "make && make install && gp". (However, I'm not exactly
sure, what conditions trigger the bug; there might be a bit more to it.)
>Fix:
In config/Makefile.SH, use ${X11BASE} instead of ${X11}. The following
patch fixes this for me.

--- config/Makefile.SH.orig     Tue Sep 19 00:19:35 2006
+++ config/Makefile.SH  Tue Sep 19 00:19:42 2006
@@ -88,7 +88,7 @@
 X11)
   PLOTFILE=plotX.c
   PLOTCFLAGS=-I$Xincroot
-  PLOTLIBS="-Wl,-R$X11 -L$X11 -lX11 $extralib"
+  PLOTLIBS="-Wl,-R${X11BASE}/lib -L${X11BASE}/lib -lX11 $extralib"
   if test "$osname" = concentrix; then PLOTLIBS="-lX11"; fi
   plotrunpath=$X11
   ;;