amd64 and -fPIC

Roman Neuhauser neuhauser at
Tue Mar 7 18:37:58 UTC 2006

# kris at / 2006-02-19 23:38:13 -0500:
> On Mon, Feb 20, 2006 at 05:18:15AM +0100, pfgshield-freebsd at wrote:
> > 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):
> The best solution is to make the port also build a shared version;
> it's usually not that difficult to modify the makefile.  That way you
> don't have to add nasty hacks.

    That doesn't solve the problem, which is: the static library is
    almost useless, and users might actually want or need to use the
    static library.

    net/libpcap only installs lib/ if you install into /usr,
    probably because all the dependent ports would need to be taught
    to look in /usr/local/lib first.

    misc/ossp-uuid's ${PREFIX}/lib/libuuid.a (it configures with
    --disable-shared) cannot be used in shared libraries on amd64
    because the port doesn't use -fPIC on this platform.

    Ports that install static libraries *need* to use -fPIC on amd64.

How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.   

More information about the freebsd-ports mailing list