amd64/127640: GCC will not build shared libraries with -fprofile-generate on amd64

Dieter freebsd at sopwith.solgatos.com
Fri Sep 26 18:14:52 UTC 2008


> > > Note that libgcov needs to be recompiled with -fPIC.
> > > The R_X86_64_32 issue is systematic on amd64. When you build a shared
> > > object, better make sure that all .o are compiled with -fPIC.
> >=20
> > So shouldn't the system come with both static and shared versions
> > of all the libraries?
> 
> The system does. OP linked system supplied libgcov.a into .so.
> Should /usr/lib/libgcov.a be built with -fPIC, is debatable. I think it
> is overkill for most other static libs from /usr/lib. Note that there
> are reasonable arguments against supplying static system libraries like
> libc and libpthread.

The thread started with "porting a specialized database library to FreeBSD".
One can expect problems when porting new code.  But the PIC problem is
bigger than that.  Ports don't compile due to this problem.  Ports should
compile cleanly out of the box, on all archs, with no problems.

Example:  On amd64, 7.0, try to build python25.  I get:

/usr/bin/ld: /usr/lib/crtbeginT.o: relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/usr/lib/crtbeginT.o: could not read symbols: Bad value
*** Error code 1

Stop in /usr/ports/lang/python25/work/Python-2.5.1/portbld.shared.


More information about the freebsd-amd64 mailing list