OpenWrt Forum Archive

Topic: Package compiles without errors but index does not create ipk

The content of this topic has been archived on 25 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am trying to compile a package that just contains scripts and configuration files.  It compiles without errors, but will not crate the ipk when I run make package/index.

Below is the Makefile I think I am doing something wrong:

#
# 
#
# This is copywrited software, 
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=
PKG_VERSION:=1a
PKG_RELEASE:=1

PKG_MAINTAINER:=test@test.com

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

define Package/testpackage
  SECTION:=net
  CATEGORY:=Network
  TITLE:=testpackage
  PKGARCH:=all
endef

define Package/testpackage/description
 Installs all needed files
endef

define Build/Prepare
endef

define Build/Configure
endef

define Build/Compile
endef

define Package/testpackage/install
    $(INSTALL_DIR) $(1)/bin $(1)/etc/testpackage/docs/ $(1)/etc/init.d 
    $(PKG_INSTALL_DIR) $(1)/www/demo $(1)/etc/config
    $(INSTALL_BIN) ./files/testpackagescript $(1)/bin/testpackagescript
    $(INSTAL_BIN)  ./files/testpackage_start $(1)/etc/init.d/testpackage_start
    $(INSTALL_DATA) ./files/testpackage.txt $(1)/etc/testpackage/docs/test.txt
    $(CP) $(PKG_INSTALL_DIR)./files/demo  $(1)/www/demo/
    $(CP) $(PKG_INSTALL_DIR)./files/configs $(1)/etc/config
endef


$(eval $(call BuildPackage,testpackage))

Thanks in advance

I believe you will need to assign a value to the PKG_NAME.

mazilo wrote:

I believe you will need to assign a value to the PKG_NAME.

Thank you, I added the missing variable, but still no dice.  I am a bit new to the dev side. Is there any other issues that may cause it?  I noticed that in he staging dir there is no default.install, just default.install.clean and default.install.flags

(Last edited by gfem on 10 Feb 2016, 19:07)

You will need to post the compilation log so that readers will be able to help.

Below are the commands I ran, but there was no dump.txt file under the logs folder, and I don't see any errors.

~/openwrt-cc$ make package/testpackage/compile -j1 V=s
make[1]: Entering directory `/home/user/openwrt-cc'
make[2]: Entering directory `/home/user/openwrt-cc/package/libs/toolchain'
if [ -f /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install.clean ]; then rm -f /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install.clean; fi; echo "libc" >> /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install
if [ -f /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install.clean ]; then rm -f /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install.clean; fi; echo "libgcc" >> /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install
if [ -f /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install.clean ]; then rm -f /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install.clean; fi; echo "libpthread" >> /home/user/openwrt-cc/staging_dir/target-mips_34kc_uClibc-0.9.33.2/pkginfo/toolchain.default.install
make[2]: Leaving directory `/home/user/openwrt-cc/package/libs/toolchain'
make[2]: Entering directory `/home/user/openwrt-cc/package/network/testpackage'
make[2]: Leaving directory `/home/user/openwrt-cc/package/network/testpackage'
make[1]: Leaving directory `/home/user/openwrt-cc'

openwrt-cc$ make package/testpackage/install -j1 V=s
make[1]: Entering directory `/home/user/openwrt-cc'
make[2]: Entering directory `/home/user/openwrt-cc/package/network/testpackage'
make[2]: Leaving directory `/home/user/openwrt-cc/package/network/testpackage'
make[1]: Leaving directory `/home/user/openwrt-cc'

~/openwrt-cc$ make package/index 
 make[1] package/index
 

AFAICT, there is something wrong with your OpenWRT Makefile for the package. For instance and under the define Package/testpackage/install section, this recipe $(PKG_INSTALL_DIR) $(1)/www/demo $(1)/etc/config looks like is missing the operator, i.e. $(CP), etc. OTOH, did you do a feed update/install for your newly created package?

define Package/testpackage/install
    $(INSTALL_DIR) $(1)/bin $(1)/etc/testpackage/docs/ $(1)/etc/init.d 
    $(PKG_INSTALL_DIR) $(1)/www/demo $(1)/etc/config
    $(INSTALL_BIN) ./files/testpackagescript $(1)/bin/testpackagescript
    $(INSTAL_BIN)  ./files/testpackage_start $(1)/etc/init.d/testpackage_start
    $(INSTALL_DATA) ./files/testpackage.txt $(1)/etc/testpackage/docs/test.txt
    $(CP) $(PKG_INSTALL_DIR)./files/demo  $(1)/www/demo/
    $(CP) $(PKG_INSTALL_DIR)./files/configs $(1)/etc/config
endef

I removed $(PKG_INSTALL_DIR) $(1)/www/demo $(1)/etc/config just to test, and still no success.  Just for fun I took another package renamed the files,moved it to the packages dir, and tried to compile it. It did not work either.  I think I will just create a tar file and pull it with wget.

Thanks for your help mazilo

When you created the test package, I suppose you did do a feed update and feed install package? Otherwise, the new test package won't show up in make menuconfig.

I think its is the unusual install define you have there, also,as mazilo suggested you need to define the PKG_NAME aswell , try something like this ...

#
# 
#
# This is copywrited software, 
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=testpackage
PKG_VERSION:=1a
PKG_RELEASE:=1

PKG_MAINTAINER:=test@test.com

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

define Package/testpackage
  SECTION:=net
  CATEGORY:=Network
  TITLE:=testpackage
  PKGARCH:=all
endef

define Package/testpackage/description
 Installs all needed files
endef

define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
endef

define Build/Configure
endef

define Build/Compile
endef

define Package/testpackage/install
    $(INSTALL_DIR) $(1)/bin
    $(INSTALL_BIN) ./files/testpackagescript $(1)/bin/testpackagescript
    
    $(INSTALL_DIR) $(1)/etc/init.d
    $(INSTAL_BIN) ./files/testpackage_start $(1)/etc/init.d/testpackage_start

    $(INSTALL_DIR) $(1)/etc/testpackage/docs
    $(INSTALL_DATA) ./files/testpackage.txt $(1)/etc/testpackage/docs/test.txt
    
    $(INSTALL_DIR) $(1)/www/demo
    $(INSTALL_DATA) ./files/demo/*  $(1)/www/demo/

    $(INSTALL_DIR) $(1)/etc/config
    $(INSTALL_CONF) ./files/configs/* $(1)/etc/config/
endef


$(eval $(call BuildPackage,testpackage))

make package/testpackage/clean -j1 V=s
make package/testpackage/compile -j1 V=s

(Last edited by hostle19 on 12 Feb 2016, 04:19)

To answer the previous question yes it appears in make menuconfig.  It looks like the Makefile you created is giving results.  Now I can see the ipk created, but it errors out on rc.common, strange because rc.common is not referenced in the Makefile, although it does appear in testpackage_start. Could that file be the problem? it is a service and defined with #!/bin/sh /etc/rc.common.  I have included the tail end of the compile where the error happens.

./files/testpackage_start /home/user/openwrt-cc/build_dir/target-mips_34kc_uClibc-0.9.33.2//ipkg-all/testpackage/etc/init.d/testpackage_start
/bin/sh: 0: Can't open /etc/rc.common
make[2]: *** [/home/user/openwrt-cc/bin/ar71xx/packages/base/testpackage_1a-1_all.ipk] Error 127
make[2]: Leaving directory `/home/user/openwrt-cc/package/network/testpackage'
make[1]: *** [package/network/testpackage/compile] Error 2
make[1]: Leaving directory `/home/user/openwrt-cc'
make: *** [package/testpackage/compile] Error 2

(Last edited by gfem on 12 Feb 2016, 05:11)

can you show the contents of that init script ? seems there is an error within it. Do you have a START value defined ? if not double check it for errors, if it looks good ... open in vi and check for windows style line feeds, i have lost hours of my life searching for script errors just to find out that i had windows style line feeds from using windows editor,,grrr

(Last edited by hostle19 on 12 Feb 2016, 05:57)

Below is the script.  I ran  cat -e -t -v on it so it displays the eol characters.

#!/bin/sh /etc/rc.common$
$
START=99$
$
wlan="wlan0-1"$
destdir=/tmp/alive.txt$
$
start() {$
while true; do$
wlanState=$(/sbin/ifconfig $wlan)$
sleep 2 $
echo "in loop" >> "$destdir"$
echo "var:$wlanState" >>"$destdir"$
if [ -n $wlanState ]   $
then $
  echo "no" >> "$destdir"$
  sleep 1$
else$
 echo "yes" >> "$destdir"$
sleep 3$
break$
fi $
done$
}$

try just recreating the file with ...

#!/bin/sh /etc/rc.common

START=99

wlan="wlan0-1"
destdir=/tmp/alive.txt

start() {
while true; do
wlanState=$(/sbin/ifconfig $wlan)
sleep 2 
echo "in loop" >> "$destdir"
echo "var:$wlanState" >>"$destdir"
if [ -n $wlanState ]
then 
  echo "no" >> "$destdir"
  sleep 1
else
 echo "yes" >> "$destdir"
sleep 3
break
fi 
done
}

it compiles fine for me, I did notice an error in the Makefile i posted ...

change

 $(INSTAL_BIN) ./files/testpackage_start $(1)/etc/init.d/testpackage_start

to

 $(INSTALL_BIN) ./files/testpackage_start $(1)/etc/init.d/testpackage_start

cheers

(Last edited by hostle19 on 12 Feb 2016, 13:34)

Changing $(INSTAL_BIN) to $(INSTALL_BIN) did the trick.  I guess that is why they say reading is fundamental smile

Thanks again for all your help!

The discussion might have continued from here.