交叉编译Python扩展

时间:2011-12-23 09:26:30

标签: python cross-compiling setuptools distutils

我在Buildroot Linux发行版ARM(Python 2.7.2)下交叉编译netifaces扩展时遇到了问题。根据这篇博客http://whatschrisdoing.com/blog/2009/10/16/cross-compiling-python-extensions/我已经定义了CC,LDSHARE等环境变量,但是distutils / setuptools没有将CC考虑在内,所以所有的测试都会失败:

running build
Setting prefix
Setting prefix
running build_ext
checking for getifaddrs... not found. (cached)
checking for getnameinfo... not found. (cached)
checking for socket IOCTLs... not found. (cached)
checking for optional header files... netash/ash.h netatalk/at.h netax25/ax25.h neteconet/ec.h netipx/ipx.h netpacket/packet.h linux/irda.h linux/atm.h linux/llc.h linux/tipc.h linux/dn.h. (cached)
checking whether struct sockaddr has a length field... no. (cached)
checking which sockaddr_xxx structs are defined... at ax25 in in6 ipx un ash ec ll  atmpvc atmsvc dn irda llc. (cached)
building 'netifaces' extension

是否有其他交叉编译示例/教程或我出错了什么?

2 个答案:

答案 0 :(得分:0)

确保您已按照所链接文章中的说明安装了distutilscross package。这为PYTHONXCPREFIX / LDSHARED / etc环境变量添加了-x选项和支持。

答案 1 :(得分:-1)

我不知道你是否还在关心这个问题。 看来你已经有了一些构建目标,所以它不再编译c程序了。尝试清理“build”文件夹下的所有文件和目录,然后重新构建。