[SciPy-user] g2c-pic

David M. Cooke cookedm at physics.mcmaster.ca
Thu Oct 28 13:15:32 CDT 2004

On Thu, Oct 28, 2004 at 01:36:13PM -0400, tom fogal wrote:
>  <41812971.5070606 at dwavesys.com>David Grant writes:
> <snip>
> >I've seen -fPIC used a lot...  Just looked at it's description on man 
> >gcc and I'm thinking that this will work on my machine but perhaps not 
> >on others?
> well, yes and no...
> I ran into this issue when I started using an AMD64 machine -- every
> library must be compiled with -fPIC or strange things happen on AMD64.

Also shared libraries on PowerPC linux (it's the default on OS X). From
when I ran linux on my iBook, you'd know when some programmer assumed
you didn't need it from the long list of RELOC errors the program would

My experience is everything *but* i386 needs -fPIC when compiling shared
libraries (which Python extensions are).

> The manual page says it will "only work on some architectures" but I
> don't think you actually need to worry about this. I can't remember
> exactly anymore but I think "some" in this definition encompasses very
> esoteric setups you'll likely never see. I've been paying attention to

If it doesn't work on an architecture, very likely it will be ignored.
(Not sure though).

> things that got compiled with the flag on all machines I use for a
> while now, and its never been a problem on any combination of hardware
> / free UNIX (inluding linux)  / compiler platform to date.
> I wouldn't think twice about it, unless you're on some ill-used
> architecture that few people have even heard of.
> Just my $.02...

Another $.02...

|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca

More information about the SciPy-user mailing list