我继承了一个基于Open Embedded/Yocto的项目,为此我需要修改操作系统映像。我想添加一个新的python模块-pycrypto。在我做出更改之前,该项目构建得很好。
我为pycrypto添加了以下BitBake配方:
DESCRIPTION = "Python crypto"
SECTION = "devel/python"
LICENSE = "PD"
SRC_URI = "https://pypi.python.org/packages/source/p/pycrypto/pycrypto-${PV}.tar.gz"
SRC_URI[md5sum] = "55a61a054aa66812daf5161a0d5d7eda"
SRC_URI[sha256sum] = "f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c"
LIC_FILES_CHKSUM = "file://README;md5=453a552a607fd82384e25db312340e9a"
S = "${WORKDIR}/pycrypto-${PV}"
inherit setuptools
作为python-crypto2.6.1.bb。
然后我在我的主要操作系统镜像配方中使用这个:
PYTHON_INSTALL = "
python-ctypes python-subprocess python-threading python-json
python-pyopenssl python-audio python-bsddb python-codecs python-compile python-compiler python-compression python-core python-crypt python-curses python-datetime python-db python-debugger python-dev python-difflib python-distutils python-doctest python-elementtree python-email python-fcntl python-gdbm python-hotshot python-html python-idle python-image python-io python-lang python-logging python-mailbox python-math python-mime python-mmap python-multiprocessing python-netclient python-netserver python-numbers python-pickle python-pkgutil python-pprint python-profile python-pydoc python-re python-readline python-resource python-robotparser python-shell python-smtpd python-sqlite3 python-sqlite3-tests python-stringold python-syslog python-terminal python-tests python-textutils python-tkinter python-unittest python-unixadmin python-xml python-xmlrpc python-zlib python-modules python-pyserial python-misc python-mysql python-crypto
"
当构建执行(bitbake my-image
)时,检索pycrypto的源似乎一切都很顺利。然而,在编译之后,configure尝试运行交叉编译的程序,但这不起作用(它是为不同的体系结构构建的),并停止bitbake创建我的图像。
这是日志文件:
DEBUG: Executing shell function do_compile
running build
running build_py
running build_ext
running build_configure
checking for gcc... arm-poky-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8 --sysroot=/media/parallels/build/tmp/sysroots/overo
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/media/parallels/build/tmp/work/cortexa8hf-vfp-neon-poky-linux-gnueabi/python-crypto/2.6.1-r0/pycrypto-2.6.1':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Traceback (most recent call last):
File "setup.py", line 456, in <module>
core.setup(**kw)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/command/build.py", line 127, in run
self.run_command(cmd_name)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 251, in run
self.run_command(cmd_name)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/media/parallels/build/tmp/sysroots/x86_64-linux/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "setup.py", line 278, in run
raise RuntimeError("autoconf error")
RuntimeError: autoconf error
ERROR: python setup.py build_ext execution failed.
WARNING: exit code 1 from a shell command.
ERROR: Function failed: do_compile (log file is located at /media/parallels/build/tmp/work/cortexa8hf-vfp-neon-poky-linux-gnueabi/python-crypto/2.6.1-r0/temp/log.do_compile.6553)
我正在从x64主机构建,目标是ARM处理器。
日志文件中的建议似乎是合理的——"如果你想交叉编译,请使用`--host'。"——唯一的问题是我在哪里使用--host?
此外,有点令人不安的是,对现有项目源的搜索没有发现使用--host
的其他实例,而且它都是为ARM构建的,所以这条消息可能会让我误入歧途。
有人能帮助配置BitBake/automake/开放嵌入式工具链的任何部分吗?这样,一旦我的模块被交叉编译,它就不会试图在我的主机上执行它(错误的体系结构)?
谢谢!
layers.openembedded.org是您的朋友:http://git.yoctoproject.org/cgit/cgit.cgi/meta-security/tree/recipes-devtools/python/python-pycrypto_2.6.1.bb?h=master
这需要进行审查,最好将其转移到meta-python,但它应该可以工作。具体来说,我看到它包括自动工具,然后为您完成交叉编译魔术。