我正在尝试在我的OpenWRT构建中构建backports-abc python模块,并且需要在构建/提取过程中提供一些帮助。
我的问题似乎是由于底层的tar文件结构,下载的backports-abc tar文件将内容提取到backports_abc-0.5,但构建过程正在backports-abc-0.5下寻找setup.py等(见下文)。我可以手动复制文件并重建,这样可以正常工作,但这并不理想。此外,虽然它构建正常,但当我将图像加载到设备时,后端模块丢失了。
/home/ubuntu/build2/openwrt/staging_dir/host/bin/python2: can't open file './setup.py': [Errno 2] No such file or directory
Makefile:59: recipe for target '/home/ubuntu/build2/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/backports-abc-0.5//.built' failed
make[3]: *** [/home/ubuntu/build2/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/backports-abc-0.5//.built] Error 2
make[3]: Leaving directory '/home/ubuntu/build2/openwrt/feeds/linkit/python-backports-abc
围绕Makefile的openWRT文档有点模糊,我对该过程的理解也是如此。
如何将tar文件解压缩到正确的文件夹,或者在Makefile过程中我应该将文件复制到正确的文件夹?
这是我的Makefile。
include $(TOPDIR)/rules.mk
PKG_NAME:=backports_abc
PKG_VERSION:=0.5
PKG_RELEASE:=1
PKG_SOURCE:=backports_abc-0.5.tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/68/3c/1317a9113c377d1e33711ca8de1e80afbaf4a3c950dd0edfaf61f9bfe6d8/
PKG_MD5SUM:=7d1936ec183a3586290adf60f6f96764
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/
#PKG_BUILD_DEPENDS:=python-setuptools
include $(INCLUDE_DIR)/package.mk
$(call include_mk, python-package.mk)
define Package/backports_abc
SECTION:=lang-python
CATEGORY:=Languages
SUBMENU:=Python
TITLE:=backports_abc
URL:=https://pypi.python.org/pypi/backports_abc/0.5
DEPENDS:=+python
endef
define Package/backports_abc/description
A backport of recent additions to the 'collections.abc' module.
endef
define Build/Compile
$(call Build/Compile/PyMod,., \
install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
)
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR)$(PYTHON_PKG_DIR)
$(CP) \
$(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
$(STAGING_DIR)$(PYTHON_PKG_DIR)/
[ ! -e $(PKG_INSTALL_DIR)/usr/include ] || $(CP) \
$(PKG_INSTALL_DIR)/usr/include/* \
$(STAGING_DIR)/usr/include/
endef
define Package/backportsabc/install
$(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/
$(CP) \
$(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
$(1)$(PYTHON_PKG_DIR)/
endef
$(eval $(call BuildPackage,backports_abc))
答案 0 :(得分:0)
将Makefile复制到packages目录中的某个位置,并克服此问题从Makefile中删除PKG_BUILD_DIR变量。
答案 1 :(得分:0)
我通过修复一些下划线和连字符来解决这个问题...即:backports_abc和backports-abc
基本上..
这...... PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/
意味着它正在查找基于PKG_NAME
变量的文件。
include $(TOPDIR)/rules.mk
PKG_NAME:=backports_abc
PKG_VERSION:=0.5
PKG_RELEASE:=1
PKG_SOURCE:=backports_abc-0.5.tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/68/3c/1317a9113c377d1e33711ca8de1e80afbaf4a3c950dd0edfaf61f9bfe6d8/
PKG_MD5SUM:=7d1936ec183a3586290adf60f6f96764
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/
#PKG_BUILD_DEPENDS:=python-setuptools
include $(INCLUDE_DIR)/package.mk
$(call include_mk, python-package.mk)
define Package/backports-abc
SECTION:=lang-python
CATEGORY:=Languages
SUBMENU:=Python
TITLE:=backports-abc
URL:=https://pypi.python.org/pypi/backports_abc/0.5
DEPENDS:=+python
endef
define Package/backports-abc/description
A backport of recent additions to the 'collections.abc' module.
endef
define Build/Compile
$(call Build/Compile/PyMod,., \
install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
)
endef
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR)$(PYTHON_PKG_DIR)
$(CP) \
$(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
$(STAGING_DIR)$(PYTHON_PKG_DIR)/
[ ! -e $(PKG_INSTALL_DIR)/usr/include ] || $(CP) \
$(PKG_INSTALL_DIR)/usr/include/* \
$(STAGING_DIR)/usr/include/
endef
define Package/backports-abc/install
$(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/
$(CP) \
$(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
$(1)$(PYTHON_PKG_DIR)/
endef
$(eval $(call BuildPackage,backports-abc))