[Pyrex] problems Linking under Mac OSX
Bob Ippolito
bob at redivi.com
Thu Oct 9 16:33:22 CEST 2003
On Oct 9, 2003, at 3:48, Andreas Kostyrka wrote:
> On Thu, Oct 09, 2003 at 09:25:17PM +1300, David McNab wrote:
>> For most people, the link args '-lcrypto -lpython2.x' suffice. But my
>> poor old Mac OSX user is getting hordes of undefined symbols.
>>
>> To anyone who's conversant with Mac OSX, can you please tell me:
> Ok, I've never seen MacOSX, but I'll try anyway.
>> 1) What's the proper way to locate the needed libcrypto.so and
>> libpython2.x.so (or equivalent) files on OSX?
> Well, you could just distribute a setup.py (distutils), and depending
> upon if pyrex is installed, you probably could even make the module
> depend upon the pregenerated .c file or upon the .pyx source :)
>
> The key is basically that you have to run the python executable and
> wrink the data out of it. Ideas would be sys.prefix, etc.
> Distutils basically does that for you :)
>
>> 2) Given my Pyrex-generated file 'SSLCrypto.c', which has compiled ok
>> into 'SSLCrypto.o', what gcc options should I use to link it into a
>> module that can be imported into Python?
> gcc -shared -o SSLCrypto.so SSLCrypto.o # or SSLCrypto.c
Those link flags are still wrong for OS X. There's a few different
versions of Python you could run into on OS X and the link flags are
slightly different for each. Please just use distutils, it will take
care of this, that's why it exists. If that doesn't work, let me know,
and I'll help you fix it.
-bob
More information about the Pyrex
mailing list