[Pythonmac-SIG] Missing symbols in module compiled with distutils

Tom Birch tbirch at cse.unsw.edu.au
Mon Jun 19 13:29:40 CEST 2006


really really weird, I changed my setup.py to this:

def frameworks(*args):
     lst = []
     for arg in args:
         lst.extend(['-framework', arg])
     return lst

module1 = Extension('pysearchkit',
                     extra_link_args = frameworks 
('CoreServices','CoreFoundation'),
                     sources = ['module.c','index.c']
                     )

and it worked, I'm still confused as to how that really changes  
anything... anyway sorry for the trouble

cheers,
Tom

On 19/06/2006, at 21:10:58, Tom Birch wrote:

> I just tried with the Python2.4.3 binary release for OSX from
> python.org and i get the same error
>
> cheers,
> Tom
>
> On 19/06/2006, at 20:30:22, Tom Birch wrote:
>
>> I'm just playing around with writing a Python wrapper for SearchKit,
>> and when I was just getting the very basics down of the first class,
>> I ran into this problem when importing my module:
>>
>> ImportError: Failure linking new module: /Library/Frameworks/
>> Python.framework/Versions/2.4/lib/python2.4/site-packages/
>> pysearchkit.so: Symbol not found: _CFRelease
>>    Referenced from: /Library/Frameworks/Python.framework/Versions/ 
>> 2.4/
>> lib/python2.4/site-packages/pysearchkit.so
>>    Expected in: dynamic lookup
>>
>> I went and double-checked my setup.py file:
>>
>> module1 = Extension('pysearchkit',
>>                      extra_link_args = ['-framework CoreServices', '-
>> framework CoreFoundation'],
>>                      sources = ['module.c','index.c'])
>>
>> but I couldn't find any problem. I looked at the last link command
>> and it seemed ok, I tried running it again manually and it didn't
>> work:
>>
>> % gcc -bundle -undefined dynamic_lookup build/temp.darwin-8.6.0-
>> Power_Macintosh-2.4/module.o build/temp.darwin-8.6.0-
>> Power_Macintosh-2.4/index.o -o build/lib.darwin-8.6.0-
>> Power_Macintosh-2.4/pysearchkit.so -framework CoreServices -framework
>> CoreFoundation
>> /usr/bin/ld: flag: -undefined dynamic_lookup can't be used with
>> MACOSX_DEPLOYMENT_TARGET environment variable set to: 10.1
>> collect2: ld returned 1 exit status
>>
>> so I fixed that with adding 'MACOSX_DEPLOYMENT_TARGET=10.4' to the
>> start, and it worked:
>>
>> % MACOSX_DEPLOYMENT_TARGET=10.4 gcc -bundle -undefined dynamic_lookup
>> build/temp.darwin-8.6.0-Power_Macintosh-2.4/module.o build/
>> temp.darwin-8.6.0-Power_Macintosh-2.4/index.o -o build/
>> lib.darwin-8.6.0-Power_Macintosh-2.4/pysearchkit.so -framework
>> CoreServices -framework CoreFoundation
>> %
>>
>> Running 'sudo python setup.py install' after this results in an
>> installed module that imports correctly, so I was wondering exactly
>> what the issue is. I'm sure it's something to do with the environment
>> passed to the link command, but a look at
>> distutils.sysconfig.get_config_vars() didn't show up anything
>> interesting (although I'm not an expert on ld). I was wondering if
>> anyone had an idea as to why this is broken. I'm running python2.4 on
>> ppc (installed as a framework), and interestingly enough it works
>> fine with python2.3. Could this be a problem with my python2.4
>> install? I haven't had any problems with PyObjC and that seems to
>> link things the same way as I am (and uses plenty of stuff in
>> frameworks) so I'm at a complete loss as to what's happening here.
>>
>> The source for everything is available here if you want to try and
>> replicate it:
>> http://www.cse.unsw.edu.au/~tbirch/pysearchkit.tar.bz2
>>
>> cheers,
>> Tom
>> _______________________________________________
>> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>> http://mail.python.org/mailman/listinfo/pythonmac-sig
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig



More information about the Pythonmac-SIG mailing list