how do I force PIC code in libgmp.a on MacOSX (Intel)...?

Alex Martelli aleaxit at gmail.com
Tue Apr 18 02:43:33 CEST 2006


On 4/17/06, Steve M. Robbins <steven.robbins at videotron.ca> wrote:
   ...
> > > Did you try to add -fno-common to the CFLAGS ?
> >
> > No, I had tried -fPIC but not -fno-common yet -- I'll try that tonight
> > when I'm next to a mac-intel again, thanks for the suggestion.
   ...
> If the Makefiles are well-behaved, you can use
>
>     ./configure .... CFLAGS="bla bla bla"
>
> you might also need to set CXXFLAGS (for C++ compilation) in the same way.

Tx -- no need for the latter, since I only need to link libgmp.a with
gmpy.c, the Python C API "wrapper" around it.

I've found out that identical problems arise with traditional (PPC)
Macs, so I've been able to experiment a bit without needing to get
home first.  the CFLAFS=... on the ./configure line works.  Building
the library (on PPC) with just -fno-common fails -- some assembly
files are apparently trying to use "vector" ("velocity engine")
instructions that make the resulting .o incompatible with older PPC's
(such as the ones Apple called "G3"), so I also need to add
-force_cpusubtype_ALL (I don't really understand why -fno-common would
cause "VE" instructions to be used in the assembly code, ah well). 
Like this, GMP 4.2 builds fine and passes make check -- and then,.
trying to link gmpy.so (as a -bundle) keeps producing exactly the same
error message as before.  Some .o inside libgmp.a (in this case, it's
popcount.o which is singled out for the error message) "has local
relocation entries in non-writable section (__TEXT,__text)".

Ah well, at least now I know that the new intel-based Macs aren't
really part of the problem: GMP 4.2 appears to have this issue (which
4.1.4 does not) on _all_ Macs (with current MacOSX and Developer
Tools/XCode/gcc releases).  I guess I can try peering into the depths
of libtool &c to divine what changed 4.1.4 -> 4.2 to presumably cause
this breakage.

Thanks for the attempt to help, anyway!


Alex


More information about the gmp-bugs mailing list