交叉编译Python扩展

yeg*_*ich 15 python distutils setuptools cross-compiling

我在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
Run Code Online (Sandbox Code Playgroud)

有没有其他交叉编译示例/教程或我做错了什么?

A. *_*cox 1

确保您已安装distutilscross 软件包,如您链接的文章中所述。这添加了 -x 选项并支持 PYTHONXCPREFIX/LDSHARED/etc 环境变量。