构建python扩展时如何指定链接器? [英] How do I specify the linker when building python extensions?
本文介绍了构建python扩展时如何指定链接器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用macports gcc-4.6安装了python2.7.当我构建扩展模块(python setup.py build_ext)时,将调用正确的gcc(/opt/local/bin/gcc),但链接器错误(其调用/Developer/usr/bin/clang).有没有办法重写python链接的调用?
I have python2.7 installed using macports gcc-4.6. When I build an extension module (python setup.py build_ext) the correct gcc (/opt/local/bin/gcc) gets called but the wrong linker (it call /Developer/usr/bin/clang). Is there a way to override the call that python is linking with?
推荐答案
您可以自定义与LDSHARED环境变量一起使用的链接器:
You can customize the linker used with LDSHARED environment variable:
LDSHARED=/usr/bin/ld python setup.py build_ext
这篇关于构建python扩展时如何指定链接器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文