2017-08-15 65 views
3

我使用Yocto在Ubuntu x86,Raspberry Pi,BeagleBone Black和TI AM57XX EVM(Dev Kit)上構建和安裝Python和python-twisted。除了AM57XX開發工具包之外,Python-Twisted沒有導入所有上述機器的問題。它吐出以下錯誤的:如何讓Yocto構建模塊fcntl作爲Python的一部分構建

Python 2.7.11 (default, Aug 7 2017, 12:07:27) 
[GCC 5.3.1 20160113] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> from txdbus import client,error 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/usr/lib/python2.7/site-packages/txdbus/client.py", line 11, in <module> 
    from twisted.internet import defer, reactor 
    File "/usr/lib/python2.7/site-packages/twisted/internet/reactor.py", line 39, in <module> 
    File "/usr/lib/python2.7/site-packages/twisted/internet/epollreactor.py", line 405, in install 
    File "/usr/lib/python2.7/site-packages/twisted/internet/epollreactor.py", line 235, in __init__ 
    File "/usr/lib/python2.7/site-packages/twisted/internet/base.py", line 498, in __init__ 
    File "/usr/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 289, in installWaker 
    File "/usr/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 139, in __init__ 
    File "/usr/lib/python2.7/site-packages/twisted/internet/fdesc.py", line 25, in setNonBlocking 
AttributeError: 'NoneType' object has no attribute 'fcntl' 

如果我發動對板Python和嘗試導入的fcntl模塊,它確實是丟失:

Python 2.7.11 (default, Aug 7 2017, 12:07:27) 
[GCC 5.3.1 20160113] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 
>>> import fcntl 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ImportError: No module named fcntl 

軟件包列表是每臺機器上相同。我錯過了什麼?內核是否需要配置不同?

雖然我是谷歌搜索的時候,我發現這個職位: https://lists.yoctoproject.org/pipermail/yocto/2013-May/013953.html

這似乎表明,Python從Yocto有一個問題,是錯誤配置,使其不包括的fcntl模塊:

>> ImportError: No module named fcntl 
>> ======== 
>> 
>> So it looks like the Python included with the SDK is crippled or mis-configured: 
> 
> Yeah, the Python we build is split up massively, so clearly the SDK is 
> missing the packages that are needed to run bitbake. But as I said, 
> using our SDK to build is over-complicating things as Ubuntu should 
> work fine. What problems were you seeing? 

當Yocto構建的Python的腳本log.do_package提到了蟒蛇-的fcntl需要的依賴 - 但他們似乎並不像錯誤:

log.do_package:DEBUG: runstrip: 'arm-linux-gnueabihf-strip' --remove-section=.comment --remove-section=.note --strip-unneeded '/home/me/am57xx/build/tmp-external-linaro-toolchain/work/armv7ahf-neon-linux-gnueabi/python/2.7.11-r1/package/usr/lib/python2.7/lib-dynload/fcntl.so' 
log.do_package:DEBUG: LIBNAMES: pkg python-fcntl libs 0 bins 0 sonames [] 
log.do_package:DEBUG: calculating shlib provides for python-fcntl 
log.do_package:DEBUG: LIBNAMES: pkg python-fcntl sonames [] 
log.do_package:DEBUG: calculating shlib requirements for python-fcntl 
log.do_package:DEBUG: python-fcntl: Dependency libpython2.7.so.1.0 requires package libpython2 (used by files: /home/me/am57xx/build/tmp-external-linaro-toolchain/work/armv7ahf-neon-linux-gnueabi/python/2.7.11-r1/packages-split/python-fcntl/usr/lib/python2.7/lib-dynload/fcntl.so) 
log.do_package:DEBUG: python-fcntl: Dependency libc.so.6 requires package external-linaro-toolchain (used by files: /home/me/am57xx/build/tmp-external-linaro-toolchain/work/armv7ahf-neon-linux-gnueabi/python/2.7.11-r1/packages-split/python-fcntl/usr/lib/python2.7/lib-dynload/fcntl.so) 
log.do_package.17147:DEBUG: runstrip: 'arm-linux-gnueabihf-strip' --remove-section=.comment --remove-section=.note --strip-unneeded '/home/me/am57xx/build/tmp-external-linaro-toolchain/work/armv7ahf-neon-linux-gnueabi/python/2.7.11-r1/package/usr/lib/python2.7/lib-dynload/fcntl.so' 
log.do_package.17147:DEBUG: LIBNAMES: pkg python-fcntl libs 0 bins 0 sonames [] 
log.do_package.17147:DEBUG: calculating shlib provides for python-fcntl 
log.do_package.17147:DEBUG: LIBNAMES: pkg python-fcntl sonames [] 
log.do_package.17147:DEBUG: calculating shlib requirements for python-fcntl 
log.do_package.17147:DEBUG: python-fcntl: Dependency libpython2.7.so.1.0 requires package libpython2 (used by files: /home/me/am57xx/build/tmp-external-linaro-toolchain/work/armv7ahf-neon-linux-gnueabi/python/2.7.11-r1/packages-split/python-fcntl/usr/lib/python2.7/lib-dynload/fcntl.so) 
log.do_package.17147:DEBUG: python-fcntl: Dependency libc.so.6 requires package external-linaro-toolchain (used by files: /home/me/am57xx/build/tmp-external-linaro-toolchain/work/armv7ahf-neon-linux-gnueabi/python/2.7.11-r1/packages-split/python-fcntl/usr/lib/python2.7/lib-dynload/fcntl.so) 
log.do_populate_sysroot:DEBUG: runstrip: 'arm-linux-gnueabihf-strip' --remove-section=.comment --remove-section=.note --strip-unneeded '/home/me/am57xx/build/tmp-external-linaro-toolchain/work/armv7ahf-neon-linux-gnueabi/python/2.7.11-r1/sysroot-destdir/usr/lib/python2.7/lib-dynload/fcntl.so' 
log.do_populate_sysroot.17148:DEBUG: runstrip: 'arm-linux-gnueabihf-strip' --remove-section=.comment --remove-section=.note --strip-unneeded '/home/me/am57xx/build/tmp-external-linaro-toolchain/work/armv7ahf-neon-linux-gnueabi/python/2.7.11-r1/sysroot-destdir/usr/lib/python2.7/lib-dynload/fcntl.so' 

所以我認爲它構建了模塊,但無法將其打包到我的根文件系統中。

我下載了Python源代碼,並運行「help」配置並搜索了fcntl。

./configure --help | grep fcntl 

但是,沒有結果!

我可以對我的Yocto配置或Python配方做些什麼來將fcntl部署到根文件系統?

+0

'./configure --help | grep fcntl'不應該產生任何結果。你可以'貓配置| grep fcntl'和'cat setup.py | grep fcntl',但我不知道它有多相關。我知道_Yocto_蹲坐,但是你有訪問_Python_生成日誌嗎?如何構建目錄(檢查_fcntl.so_是否存在)? – CristiFati

回答

0

使用Yocto最新的食譜來構建最新的Python 2.7。