交叉编译Python扩展

2024-06-12 02:02:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我在Buildroot Linux发行版for ARM(Python 2.7.2)下交叉编译netipfaces扩展时遇到问题。根据这个博客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

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


Tags: buildforprefixlinuxnotsettingrunning交叉
2条回答

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

确保您已经安装了链接文章中提到的distutilscross package。这将添加-x选项并支持PYTHONXCPREFIX/LDSHARED/etc环境变量。

相关问题 更多 >