amd64 and -fPIC

pfgshield-freebsd at yahoo.com pfgshield-freebsd at yahoo.com
Sun Feb 19 20:18:16 PST 2006


Hi;

amd64 has a rather nasty issue: in order to mix shared and static libraries
everything has to be built with -fPIC. Most ports are either static or dynamic
so it's usually not a problem, but I'm stating to find problems in the math
section: packages like arpack and glpk are only built static and without -fPIC.
And lately we are only building the dynamic version of ATLAS so packages that
use many math libraries will have problems on amd64.

Someone would say the easy way out of this would be to add -fPIC to everything
by default, which works, but has some performance issues. If someone has a
better solution I would like to hear it (please!) but if not I would like to
suggest instead a general guideline:

If the package includes a library that might be used frequently and doesn't
include a shared version please add -fPIC to the amd64 version of the port, for
example for math/arpack (and feel free to commit this):

diff -ruN arpack.orig/Makefile arpack/Makefile
--- arpack.orig/Makefile	Sun Feb 19 22:42:24 2006
+++ arpack/Makefile	Sun Feb 19 22:45:11 2006
@@ -29,7 +29,6 @@
 BLAS_LIBS?=	${LOCALBASE}/lib/libblas.a
 
 INSTALLS_SHLIB=	yes
-USE_REINPLACE=	yes
 
 pre-patch:
 	@(cd ${WRKSRC}; ${TAR} -xzf ${DISTDIR}/${DIST_SUBDIR}/patch.tar.gz)
@@ -51,4 +50,10 @@
 	${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/ug.ps.gz ${DOCSDIR}
 .endif
 
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == "amd64"
+FFLAGS+=	-fPIC
+.endif
+
+.include <bsd.port.post.mk>





---
     Pedro F. Giffuni
     M. Sc. Industrial Eng. University of Pittsburgh
     Mech. Eng.      Universidad Nacional de Colombia
---
Yahoo is powered by FreeBSD    http://www.FreeBSD.org/


		
___________________________________ 
Yahoo! Messenger with Voice: chiama da PC a telefono a tariffe esclusive 
http://it.messenger.yahoo.com


More information about the freebsd-ports mailing list