Building a python module and linking it against a MacOSX framework

前端 未结 5 1720
没有蜡笔的小新
没有蜡笔的小新 2021-02-19 05:46

I\'m trying to build a Python extension on MacOSX 10.6 and to link it against several frameworks (i386 only). I made a setup.py file, using distutils and the Extension object.

5条回答
  •  独厮守ぢ
    2021-02-19 06:23

    It seems that my framework is compiled for ppc and i386 but not x86_64 :

    $ file /Library/Frameworks/fwk1.framework/Versions/A/fwk1 
    /Library/Frameworks/fwk1.framework/Versions/A/fwk1: Mach-O universal binary with 2 architectures
    /Library/Frameworks/fwk1.framework/Versions/A/fwk1 (for architecture ppc):  Mach-O dynamically linked shared library ppc
    /Library/Frameworks/fwk1.framework/Versions/A/fwk1 (for architecture i386): Mach-O dynamically linked shared library i386
    

    I removed the -arch x86_64 flag from my linking line. My library is linked against my frameworks :

    $ otool -L  test.so
    test.so:
        /Library/Frameworks/fwk1.framework/Versions/A/fwk1 (compatibility version 1.0.0, current version 1.0.0)
        /Library/Frameworks/fwk2.framework/Versions/A/fwk2 (compatibility version 1.0.0, current version 1.0.0)
        /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.0.1)
    

    If someone know how to force the -arch to be used at compile and link time with Python's distutils... please share your advice.

提交回复
热议问题