包缺少库的依赖 - OpenWRT

时间:2013-10-04 15:05:59

标签: dependencies package libraries dependency-management openwrt

我正在尝试使用我在其中制作的自定义包编译OpenWRT。这是我的包的 OpenWRT Makefile:

#
# Copyright (C) 2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id$

include $(TOPDIR)/rules.mk

PKG_NAME:=amld
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk

define Package/amld
 SECTION:=utils
 CATEGORY:=Utilities
 TITLE:=amld -- prints a snarky message  
 DEPENDS:=+libssl +libcrypto +librt
endef

define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
    $(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Build/Configure
endef

define Build/Compile
    $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS)
endef

define Package/amld/install
    $(INSTALL_DIR) $(1)/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/amld $(1)/bin/
endef

$(eval $(call BuildPackage,amld))

编译时出现以下错误:

Package amld is missing dependencies for the following libraries:
libcrypto.so.1.0.0
librt.so.0
libssl.so.1.0.0

我不确定要添加什么,有没有人有任何想法?感谢

修改

这是我的包的Makefile:

LDFLAGS=-lssl -lcrypto -lrt
CFLAGS=-g -I /usr/lib/i386-linux-gnu

all: amlpkcs12 amld

amlpkcs12:amlpkcs12.o
    $(CC) amlpkcs12.o -g -o amlpkcs12 $(LDFLAGS)

amld: amld.o iot.o bridge.o sysconf.o
    $(CC) bridge.o iot.o amld.o sysconf.o -g -o amld $(LDFLAGS)

amlpkcs12.o: amlpkcs12.c
    $(CC) $(CFLAGS) -c  amlpkcs12.c

amld.o: amld.c
    $(CC) $(CFLAGS) -c -g -DVERSION=\"1.0\" amld.c

sysconf.o: sysconf.c sysconf.h
    $(CC) $(CFLAGS) -c sysconf.c

bridge.o:bridge.c bridge.h iot.h
    $(CC) $(CFLAGS) -c bridge.c

iot.o: iot.c iot.h
    $(CC) $(CFLAGS) -c -g iot.c

clean:
    rm *.o amlpkcs12 amld

更新

如果您仍有问题,请参阅我的问题和回答here

3 个答案:

答案 0 :(得分:13)

终于搞定了,不得不添加更改

$(eval $(call BuildPackage,amld))

$(eval $(call BuildPackage,amld,+libopenssl))

完整的Makefile:

include $(TOPDIR)/rules.mk

PKG_NAME:=amld
PKG_RELEASE:=1

TARGET_LDFLAGS+=/usr/include/openssl
PKG_BUILD_DEPENDS:=libopenssl

include $(INCLUDE_DIR)/package.mk

define Package/amld
 SECTION:=utils
 DEPENDS:=+libopenssl
 CATEGORY:=Utilities
 TITLE:=amld -- AccessMyLan Daemon
endef

define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
    $(CP) ./files/* $(PKG_BUILD_DIR)/
endef

define Build/Compile
    $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS)
endef

define Package/amld/install
    $(INSTALL_DIR) $(1)/bin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/amld $(1)/bin/
endef

$(eval $(call BuildPackage,amld,+libopenssl))

答案 1 :(得分:0)

请检查OpenWRT\tmp\.config-package.in。一旦构建开始,就会生成依赖关系树。它可以提供一些提示

答案 2 :(得分:0)

如果重新编译的软件包生成的新lib尚未安装在build_dir / root-xyz中,并且另一个软件包现在需要该lib(例如,您重新构建了gcc并启用了libasan.so,那么现在需要该软件包libasan.so会抱怨),您可以手动解决问题:

  • 将新库手动复制到build_dir
  • 将新库添加到生成的提供文件(例如libc.provides)
  • 重新运行该软件包的make