简体   繁体   English

Openwrt:如何在新包中添加特定的库依赖项

[英]Openwrt : How to add a specific library dependency in new package

I am trying to add a package for directfb tutorials.我正在尝试为 directfb 教程添加一个包。 I followed the instructions in http://wiki.openwrt.org/doc/devel/packages .我按照http://wiki.openwrt.org/doc/devel/packages 中的说明进行操作。 Currently the package is downloaded successfully to the dl folder and even compiled in the build directory, but when I add the install section to the makefile I get dependency error:目前,该包已成功下载到 dl 文件夹,甚至在构建目录中进行了编译,但是当我将安装部分添加到 makefile 时,出现依赖项错误:

Package directfb_tutorials is missing dependencies for the following libraries:
libdirect-1.4.so.0
libdirectfb-1.4.so.0
libfusion-1.4.so.0
libpthread.so.0

The package Makefile (I put it under package/utils/directfb_tutorials/):包 Makefile(我把它放在 package/utils/directfb_tutorials/ 下):

include $(TOPDIR)/rules.mk
PKG_NAME:=DFBTutorials
PKG_VERSION:=0.5.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.directfb.org/downloads/Extras/
PKG_MD5SUM:=13e443a64bddd68835b574045d9025e9
PKG_LICENSE:=LGPLv2.1
PKG_LICENSE_FILES:=COPYING
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/directfb_tutorials
    TITLE:=directfb_tutorials
    SECTION:=utils
    CATEGORY:=Utilities
    URL:=http://directfb.org
    DEPENDS:=+libdirectfb
endef
define Package/directfb_tutorials/description
    DirectFB Tutorials
endef

define Build/Configure
    $(call Build/Configure/Default,)
endef
define Package/directfb_tutorials/Build/Compile
    $(MAKE) -C $(PKG_BUILD_DIR)
endef
define Package/directfb_tutorials/install
    $(INSTALL_DIR) $(1)/bin/dfb_tutorials
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/image/image $(1)/bin/dfb_tutorials/
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/simple/simple $(1)/bin/dfb_tutorials/
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/keybuffer/keybuffer $(1)/bin/dfb_tutorials/
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/text/text $(1)/bin/dfb_tutorials/
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/sprite/sprite $(1)/bin/dfb_tutorials/
endef
$(eval $(call BuildPackage,directfb_tutorials))

When adding +libpthread to the DEPENDS section, libpthread.so.0 does not appear in the missing dependencies error message above:将 +libpthread 添加到 DEPENDS 部分时,libpthread.so.0 不会出现在上面的缺失依赖项错误消息中:

Package directfb_tutorials is missing dependencies for the following libraries:
libdirect-1.4.so.0
libdirectfb-1.4.so.0
libfusion-1.4.so.0

is because I must have used DEPENDS in a wrong manner (DEPENDS= +libdirectfb).是因为我一定以错误的方式使用了 DEPENDS (DEPENDS= +libdirectfb)。 How can I tell the correct name of the library for the DEPENDS flag?如何为 DEPENDS 标志判断库的正确名称? Is the fact that the library is installed to /usr/lib instead of just /lib (like libpthread) makes a difference?将库安装到 /usr/lib 而不仅仅是 /lib(如 libpthread)这一事实是否有所不同?

Thanks in advance, Tomer提前致谢,托默

The message about missing libraries comes from check fired from include/package-ipkg.mk.关于缺少库的消息来自从 include/package-ipkg.mk 触发的检查。 It is the latest stage of package creation.这是包创建的最新阶段。 This check is verifying all executable files have all needed libraries available in the system.此检查是验证所有可执行文件都具有系统中可用的所有所需库。 To enforce that, system requires you to add some entries in "DEPENDS" section.为了强制执行,系统要求您在“DEPENDS”部分添加一些条目。 But before - you need of course to know, which one(s) to add.但在此之前 - 您当然需要知道要添加哪些。

To find missing library provider, if the case is not obvious (usually it is just a library name), you may search in $STAGING_DIR/pkginfo folder.要查找缺少的库提供者,如果大小写不明显(通常只是库名),您可以在 $STAGING_DIR/pkginfo 文件夹中搜索。 In my case it is staging_dir/target-mips_mips32_uClibc-0.9.33.2/pkginfo.就我而言,它是 staging_dir/target-mips_mips32_uClibc-0.9.33.2/pkginfo。

Just cd to that folder and run something like:只需 cd 到该文件夹​​并运行如下内容:

grep libdirect-1.4.so.0 "*.provides"

You should see one or more results.您应该会看到一个或多个结果。 Use common sense to pick the best one, usually it is a package named similar to the library, but not always.用常识挑一个最好的,通常是一个名字类似于库的包,但也不一定。 This is a generic way, should be helpful in case you miss the package in DEPENDS and cannot easily guess the correct one(s).这是一种通用方法,如果您错过了 DEPENDS 中的包并且无法轻易猜出正确的包,则应该会有所帮助。

My guess is, that you should modify DEPENDS in your Makefile to contain this:我的猜测是,您应该修改 Makefile 中的 DEPENDS 以包含以下内容:

DEPENDS:=+libdirect +libdirectfb +libfusion +libpthread

Look at the iftop core package for a syntax example:查看 iftop 核心包的语法示例:

https://github.com/openwrt/openwrt/blob/master/package/network/utils/iftop/Makefile#L28 https://github.com/openwrt/openwrt/blob/master/package/network/utils/iftop/Makefile#L28

It is the perfect example.这是一个完美的例子。 The right syntax should be:正确的语法应该是:

DEPENDS:=+libdirectfb +libpthread

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM