15

I am trying to compile OpenWRT with a custom package I have made inside it. Here is the OpenWRT Makefile for my package:

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

When I compile I get the following error:

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

I am unsure of what to add, does anybody have any ideas? Thanks

Edit

Here is my Makefile for my package:

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

Update

Also see my question and answer here if you're still having trouble.

8
  • Why do you need this -I /usr/lib/i386-linux-gnu? AFAIK you should use only the headers provided by OpenWrt.
    – yegorich
    Oct 4, 2013 at 19:35
  • 1
    Try DEPENDS:=+libopenssl, like openssh package does.
    – yegorich
    Oct 4, 2013 at 19:39
  • Tried that @yegorich, no luck :[
    – TomSelleck
    Oct 7, 2013 at 14:49
  • 1
    Looks like removing the -lrt flags and the empty define build/configure might have done it
    – TomSelleck
    Oct 9, 2013 at 12:34
  • 1
    Sure, might even earn some of my bounty back xD
    – TomSelleck
    Oct 9, 2013 at 14:49

3 Answers 3

18

Finally got it, had to add change

$(eval $(call BuildPackage,amld))

to

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

Full 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
  • 5
    N.B: the important change here was using the correct library name. It should be libopenssl not libssl and libcrypto. Putting the dependency in the eval BuildPackage call or in the define Package/amld block would both have worked if the correct name had been used.
    – Segfault
    Nov 1, 2017 at 16:39
1

Please check OpenWRT\tmp\.config-package.in . This has the dependency tree generated as soon as build starts. It can give some hints

1
  • there's no such file on my machine
    – Daniel
    Nov 4, 2021 at 23:09
0

If you recompiled a package that produces a new lib that's not being installed in build_dir/root-xyz, and that lib is now needed by another package (for example you rebuilt gcc and enabled libasan.so, so now packages that require libasan.so will complain), you can fix things up manually:

  • copy the new libs manually into build_dir
  • add the new libs to the generated provides file (e.g. libc.provides)
  • re-run make for that package

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.