我在我的ubuntu16x86u64上有一个简单的python+cython项目(来自http://docs.cython.org/src/tutorial/cython_tutorial.html的hello world示例)。我可以用cython为x86\u64构建这个项目。在
我如何在不使用真正的armv7板/cpu的情况下为ubuntu15的armv7版本构建项目?在
我有arm-linux-gnueabihf-gcc
(http://packages.ubuntu.com/xenial/devel/gcc-arm-linux-gnueabihf),它可以为armv7编译简单的C程序。如何更改cython的设置以使用交叉编译器为arm构建共享对象?在
交叉编译需要依赖于体系结构的库和头文件。在
当测试python3.5-dev包和其他包是否可以安装在}(在对来源.列表),结果基本上是。在
dpkg add-architecture armhf
和{apt-get install python3.5:armhf
是不起作用的,seeQEMU和chroot提供了一种不需要“完整”虚拟机的解决方案。可以通过
debootstrap
命令为chroot创建一个合适的目录。{cd5>创建后可以访问环境。在在以下命令中替换
^{pr2}$<DIRECTORY>
和<USER>
:环境应通过
对于根用户会话(用户必须位于根组中列出的组中)
在此之后,还可以交叉编译cython模块:
在你好.pyx公司名称:
编译(}在chroot中用于选项,请注意
python3.5-config cflags
和{-fPIC
):然后可以测试模块
交叉编译基于cython的python模块也可以工作。与设置.py在
用这种方法可以构建一个简单的
hello world
模块。模块的文件名错误,在本例中是hello.cpython-35m-x86_64-linux-gnu.so
。在将其重命名为hello.so
之后,就可以导入它了。在相关问题 更多 >
编程相关推荐