Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am trying to add a package for directfb tutorials. I followed the instructions in 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:

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/):

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:

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). How can I tell the correct name of the library for the DEPENDS flag? Is the fact that the library is installed to /usr/lib instead of just /lib (like libpthread) makes a difference?

Thanks in advance, Tomer

like image 904
tomereli Avatar asked Jan 09 '23 21:01

tomereli


1 Answers

The message about missing libraries comes from check fired from 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. 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. In my case it is staging_dir/target-mips_mips32_uClibc-0.9.33.2/pkginfo.

Just cd to that folder and run something like:

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).

My guess is, that you should modify DEPENDS in your Makefile to contain this:

DEPENDS:=+libdirect +libdirectfb +libfusion +libpthread
like image 82
Marek Avatar answered Jan 31 '23 09:01

Marek