[C++-sig] Link trouble on OS X

David Abrahams david.abrahams at rcn.com
Thu May 30 22:29:09 CEST 2002


From: "Scott A. Smith" <ssmith at magnet.fsu.edu>


> Hi Dave,
>
> Du-oh! OK, I have done just that and been moving along. The reference
> sent in by Robert Andre
>
> http://fink.sourceforge.net/doc/porting/shared.php
>
> helps and agrees with what David Beasley wrote
>
> c++ -c
>
$(SRCS) -I/sw/include/python2.2 -I/sw/lib/python2.2/config -DHAVE_CONFIG_H
> c++ -bundle -undefined suppress -flat_namespace $(OBJS) -o somemodule.so

What is -DHAVE_CONFIG_H for? Doesn't compilation succeed without it?
I don't think -bundle sounds right for bpl.so, though you might want it for
your extension modules. From looking at the link above, bpl.so falls
squarely in the shared library category, NOT in the "module" category.

Since bpl.so uses symbols from the Python executable, -undefined suppress
looks like it might be needed. The link doesn't describe
what -flat_namespace does so I can't really say whether you want that or
not.

> For the source codes compiler commands, I removed the fPIC,

According to the link fPIC has no effect on PPC, so I guess that's
harmless.

> added the include of the python config directory

If everything was compiling into .o files, you probably didn't need that.
I'm guessing there's some interaction with HAVE_CONFIG_H, though. Is there
a header file in that directory?

-Dave






More information about the Cplusplus-sig mailing list