OpenWrt Forum Archive

Topic: Building a package against Barrier Breaker silently fails?

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

Hi Guys,

I'm trying to create packages for Seafile (server components only) using the 14.07 sources and it seems I'm stuck at the very beginning of the process.

I've read these wiki articles already:

http://wiki.openwrt.org/es/doc/howto/build
http://wiki.openwrt.org/doc/devel/packages
http://wiki.openwrt.org/doc/devel/feeds

Here's what I did:

1. pulled the sources from Git for version 14.07
2. created a custom feed named "seafile", added a line to "feeds.conf.default" to include it
3. ran the scripts to update and install all feeds which found my custom feed and installed it to the build system (the package I want to build has shown up in the make menuconfig interface)
4. ran "make defconfig" and then "make"
5. selected my custom package in the menuconfig interface as a module ("M" marker) and ran make again

All the packages build fine except my package and the most annoying thing is that I don't see any error messages, make just silently steps over my package's Makefile even if I run it "V=99" or "V=s".

Here's the the output I can see when running "make V=s" command:

[...]
mkdir -p /home/nb/openwrt_build/openwrt/staging_dir/host/stamp
touch /home/nb/openwrt_build/openwrt/staging_dir/host/stamp/.glib2_installed
make[2]: Leaving directory `/home/nb/openwrt_build/openwrt/feeds/packages/libs/glib2'
make[2]: Entering directory `/home/nb/openwrt_build/openwrt/package/libs/gettext'
WARNING: skipping libintl -- package not selected
make[2]: Leaving directory `/home/nb/openwrt_build/openwrt/package/libs/gettext'
make[2]: Entering directory `/home/nb/openwrt_build/openwrt/package/libs/libiconv'
WARNING: skipping libiconv -- package not selected
make[2]: Leaving directory `/home/nb/openwrt_build/openwrt/package/libs/libiconv'
make[2]: Entering directory `/home/nb/openwrt_build/openwrt/feeds/packages/libs/glib2'
make[2]: Leaving directory `/home/nb/openwrt_build/openwrt/feeds/packages/libs/glib2'
make[2]: Entering directory `/home/nb/openwrt_build/seafile/libs/libsearpc'
make[2]: Leaving directory `/home/nb/openwrt_build/seafile/libs/libsearpc'
make[1]: Leaving directory `/home/nb/openwrt_build/openwrt'

The Makefile I've assembled looks like this:

include $(TOPDIR)/rules.mk

PKG_NAME:=libsearpc
PKG_VERSION:=3.0
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/libsearpc-$(PKG_VERSION)-latest
PKG_SOURCE:=v$(PKG_VERSION)-latest.tar.gz
PKG_SOURCE_URL:=https://github.com/haiwen/libsearpc/archive
PKG_MD5SUM:=32a6eaafe16d8c0c0e320b4a08a4d8f6
PKG_CAT:=zcat
PKG_INSTALL:=1
PKG_FIXUP:=autoreconf

include $(INCLUDE_DIR)/package.mk

define Package/libsearpc
    SECTION:=libs
    CATEGORY:=Libraries
    TITLE:=Seafile RPC library
    MAINTAINER:=Gergely Kiss <mail.gery@...>
    URL:=http://seafile.com/
    DEPENDS:=+glib2 +jansson +python
endef

define Package/libsearpc/description
    Searpc is a simple C language RPC framework based on GObject system. Searpc
    handles the serialization/deserialization part of RPC, the transport
    part is left to users.
endef

CONFIGURE_ARGS += --enable-compile-demo=no

$(eval $(call BuildPackage,libsearpc))

Please assist, I'm totally clueless with this... sad

Thanks,
George

(Last edited by geryhun on 17 Nov 2014, 19:49)

Have you selected the target architecture in .config?
You need to select x86, ar71xx or something.

Sure, in fact I've created a build script to automate the process:

#!/bin/sh

if [ -f .config ]
then
   make dirclean
   rm -f .config
fi

./scripts/feeds update -a
./scripts/feeds install -a

export PATH=/home/nb/openwrt_build/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin:$PATH
export STAGING_DIR=/home/nb/openwrt_build/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2
export CFLAGS=-I/home/nb/openwrt_build/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/include
export LDFLAGS=-L/home/nb/openwrt_build/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/lib
echo "CONFIG_TARGET_ar71xx=y" > .config
echo "CONFIG_TARGET_ar71xx_nand=y" >> .config
echo "CONFIG_TARGET_ar71xx_nand_WNDR4300=y" >> .config
make defconfig
make -j 9

As I mentioned, all the originally provided packages build and install just fine, it's juts my package that won't build.

(Last edited by geryhun on 17 Nov 2014, 15:10)

Have you checked at which step does it fail? Does it compile? (do binaries get created in the source directory?)

Your Makefile seems to be missing the install section, so eventhough it may be compiled, the package does not get installed. I think that you need Package/libsearpc/install section with the correct copy/install commands.

EDIT:
I also wonder about the need to export build environment variables, but if your other modules compile ok, then they are probably ok.

You might do this to get a better error log:
make package/libsearpc/{clean,compile} V=s

EDIT2:
Are, the rarely used PKG_INSTALL section may cover that, but what does the original installer actually do?

(Last edited by hnyman on 17 Nov 2014, 15:30)

No, it looks like the process doesn't even start, the source package doesn't show up in the dl subfolder, where other source packages are located.

This is the output I see when I simply run make without any params:

[nb@nb openwrt]$ make
 make[1] world
 make[2] target/compile
 make[3] -C target/linux compile
 make[2] package/cleanup
 make[2] package/compile
 make[3] -C package/libs/toolchain compile
 make[3] -C package/libs/libnl-tiny compile
 make[3] -C package/libs/libjson-c compile
 make[3] -C package/utils/lua compile
 make[3] -C package/libs/libubox compile
 make[3] -C package/system/ubus compile
 make[3] -C package/system/uci compile
 make[3] -C package/network/config/netifd compile
 make[3] -C package/system/opkg host-compile
 make[3] -C package/system/ubox compile
 make[3] -C package/libs/lzo compile
 make[3] -C package/libs/zlib compile
 make[3] -C package/libs/ncurses compile
 make[3] -C package/utils/util-linux compile
 make[3] -C package/utils/ubi-utils compile
 make[3] -C package/system/procd compile
 make[3] -C package/utils/jsonfilter compile
 make[3] -C package/base-files compile
 make[3] -C package/system/fstools compile
 make[3] -C package/boot/uboot-envtools compile
 make[3] -C feeds/oldpackages/libs/jansson compile
 make[3] -C feeds/oldpackages/lang/python host-compile
 make[3] -C feeds/packages/utils/bzip2 compile
 make[3] -C feeds/packages/libs/expat compile
 make[3] -C feeds/packages/libs/gdbm compile
 make[3] -C feeds/packages/libs/libffi compile
 make[3] -C package/libs/libreadline compile
 make[3] -C feeds/packages/libs/sqlite3 compile
 make[3] -C package/libs/ocf-crypto-headers compile
 make[3] -C package/libs/openssl compile
 make[3] -C feeds/oldpackages/lang/python compile
 make[3] -C feeds/packages/utils/attr compile
 make[3] -C feeds/packages/libs/libffi host-compile
 make[3] -C package/libs/gettext host-compile
 make[3] -C package/libs/libiconv host-compile
 make[3] -C feeds/packages/libs/glib2 host-compile
 make[3] -C package/libs/gettext compile
 make[3] -C package/libs/libiconv compile
 make[3] -C feeds/packages/libs/glib2 compile
 make[3] -C /home/nb/openwrt_build/seafile/libs/libsearpc compile
 make[3] -C package/kernel/gpio-button-hotplug compile
 make[3] -C package/firmware/linux-firmware compile
 make[3] -C package/kernel/linux compile
 make[3] -C package/network/services/hostapd compile
 make[3] -C package/network/utils/iw compile
 make[3] -C package/kernel/mac80211 compile
 make[3] -C package/libs/libevent2 compile
 make[3] -C package/network/utils/iptables compile
 make[3] -C package/network/config/firewall compile
 make[3] -C package/network/config/swconfig compile
 make[3] -C package/network/ipv6/odhcp6c compile
 make[3] -C package/libs/gmp compile
 make[3] -C package/libs/nettle compile
 make[3] -C package/network/services/dnsmasq compile
 make[3] -C package/network/services/dropbear compile
 make[3] -C package/network/services/odhcpd compile
 make[3] -C package/libs/libpcap compile
 make[3] -C package/network/utils/linux-atm compile
 make[3] -C package/network/utils/resolveip compile
 make[3] -C package/network/services/ppp compile
 make[3] -C package/network/utils/iwinfo compile
 make[3] -C package/system/mtd compile
 make[3] -C package/system/opkg compile
 make[3] -C package/utils/busybox compile
 make[2] package/install
 make[3] package/preconfig
 make[2] target/install
 make[3] -C target/linux install
 make[2] package/index

No errors and yet my package is still not compiled nor installed.

hnyman wrote:

EDIT:
I also wonder about the need to export build environment variables, but if your other modules compile ok, then they are probably ok.

You might do this to get a better error log:
make package/libsearpc/{clean,compile} V=s

This seems to clean up some stuffs from the build directory then runs the make process with some verbose output but still no luck, the package won't compile.

EDIT2:
Are, the rarely used PKG_INSTALL section may cover that, but what does the original installer actually do?

The default "make install" target seems to copy the shared libraries, the header files, the pkg-config file and a python package to the install directory. Both make and make install are working fine while executing directly from the source's root directory.

I wonder if I should swtich to the HEAD revision instead, maybe this behaviour is normal for version tags?

A comment in feeds/packages/CONTRIBUTING.md made me think about it:

Release Branches:
[...]
* Do NOT add new packages and do NOT do major upgrades of packages here.

What do you think?

No, it is not that. We can quite normally add stuff to private BB build systems, but no new packages should be added to the BB branch (for-14.07) in Github.

I wonder if there's a debug mode for make like the "-x" switch for bash. That would help a lot to see where exactly the makefile processing stops.

I actually added your makefile to my BB build system. With normal make, nothing happens. But if I write manually "make package/libsearpc/prepare" , it downloads the sources and unpacks them. But then make package/libsearpc/configure failed due to misdirected jansson.

Great news, the prepare and configure commands are working fine for me, too, although I still don't see why they don't run automatically as for other packages.

The reason why configure fails is that the jansson package does not install its .pc file and therefore pkg-config is unable to detect the presence of the library. Can you please help how to fix this?

I noticed that the .pc file is created during compilation of the jansson package but make install does not install it. What's the correct way to fix this? Shall I create a patch for jansson which modifies the makefile template (I'm not very familiar with things like that) or is it adequate to simply add a $(CP) line within the Build/Install (or Build/InstallDev?) section for jansson to copy the .pc file to the staging dir?

Btw, thanks for your assistance, it's much appreciated!

(Last edited by geryhun on 18 Nov 2014, 10:16)

I've modified the Build/InstallDev part of jansson's Makefile which helped fixing the problem of the missing .pc file:

define Build/InstallDev
            $(INSTALL_DIR) $(1)/usr/{lib,include}
            $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
            $(CP) $(PKG_INSTALL_DIR)/usr/lib/libjansson* $(1)/usr/lib
            $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
            $(CP) $(PKG_BUILD_DIR)/jansson.pc $(1)/usr/lib/pkgconfig/
endef

Now configure finishes successfully for my package but when I run "make package/libsearpc/compile", nothing happens. The sources are present in the build directory and I can see a file named ".configured_" confirming that the configure part has finished successfully.

Is this a bug of the build system maybe or I overlook something really trivial here?

(Last edited by geryhun on 18 Nov 2014, 11:48)

geryhun wrote:

Sure, in fact I've created a build script to automate the process:

#!/bin/sh

if [ -f .config ]
then
   make dirclean
   rm -f .config
fi

./scripts/feeds update -a
./scripts/feeds install -a

export PATH=/home/nb/openwrt_build/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2/bin:$PATH
export STAGING_DIR=/home/nb/openwrt_build/openwrt/staging_dir/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2
export CFLAGS=-I/home/nb/openwrt_build/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/include
export LDFLAGS=-L/home/nb/openwrt_build/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/lib
echo "CONFIG_TARGET_ar71xx=y" > .config
echo "CONFIG_TARGET_ar71xx_nand=y" >> .config
echo "CONFIG_TARGET_ar71xx_nand_WNDR4300=y" >> .config
make defconfig
make -j 9

As I mentioned, all the originally provided packages build and install just fine, it's juts my package that won't build.

Just a thought and perhaps I am missing something here.

When you execute the above script, it removes your .config file and the make defconfig doesn't select your libsearpc package to compile, AFAICT.

BTW, I gathered your host computer is an 8 core CPU, right? If not, it would be a good choice to use make -jX where X is CPU # + 1.

Your package Makefile has no install section, therfore it is ignored by the Buildroot. You *must* have an install section, even if it is empty or just contains a "true" statement.

geryhun wrote:

Great news, the prepare and configure commands are working fine for me, too, although I still don't see why they don't run automatically as for other packages.

The reason why configure fails is that the jansson package does not install its .pc file and therefore pkg-config is unable to detect the presence of the library. Can you please help how to fix this?

I noticed that the .pc file is created during compilation of the jansson package but make install does not install it. What's the correct way to fix this? Shall I create a patch for jansson which modifies the makefile template (I'm not very familiar with things like that) or is it adequate to simply add a $(CP) line within the Build/Install (or Build/InstallDev?) section for jansson to copy the .pc file to the staging dir?

I have encountered problem like this with most of OpenWRT library packages where all files considered as development are discarded in order to cut down the firmware size. I used quilt to create patches for each needed library package to resolve this issue. When I want to update my local git trunk, I run a script to remove/repatch the patches using quilt. Sometimes, I need to manually making some adjustment to the patches using quilt after an update. So far, so good.

mazilo wrote:

When you execute the above script, it removes your .config file and the make defconfig doesn't select your libsearpc package to compile, AFAICT.

BTW, I gathered your host computer is an 8 core CPU, right? If not, it would be a good choice to use make -jX where X is CPU # + 1.

Sure, I know that. I execute that script only once after checking out the source tree. Once I have all the base packages built, I issue a simple "make" command or "make package/libsearpc/compile" to start compiling my package (after selecting it in the "make menuconfig" interface, of course).

I have a Core i7 processor in my PC with 4 cores and Hyper-Threading. Thus, the kernel "sees" 8 cores. Shall I use "make -j 5" instead for such a configuration?

mazilo wrote:

I have encountered problem like this with most of OpenWRT library packages where all files considered as development are discarded in order to cut down the firmware size. I used quilt to create patches for each needed library package to resolve this issue. When I want to update my local git trunk, I run a script to remove/repatch the patches using quilt. Sometimes, I need to manually making some adjustment to the patches using quilt after an update. So far, so good.

Thanks for the tip, that tool looks to be really useful.

jow wrote:

Your package Makefile has no install section, therfore it is ignored by the Buildroot. You *must* have an install section, even if it is empty or just contains a "true" statement.

I see. I've modified the Makefile, now it looks like this:

include $(TOPDIR)/rules.mk

PKG_NAME:=libsearpc
PKG_VERSION:=3.0
PKG_RELEASE:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/libsearpc-$(PKG_VERSION)-latest
PKG_SOURCE:=v$(PKG_VERSION)-latest.tar.gz
PKG_SOURCE_URL:=https://github.com/haiwen/libsearpc/archive/
PKG_MD5SUM:=32a6eaafe16d8c0c0e320b4a08a4d8f6
PKG_CAT:=zcat
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/libsearpc
    SECTION:=libs
    CATEGORY:=Libraries
    TITLE:=Seafile RPC library
    MAINTAINER:=Gergely Kiss <mail.gery@...>
    URL:=http://seafile.com/
    DEPENDS:=+glib2 +jansson +python
endef

define Package/libsearpc/description
    Searpc is a simple C language RPC framework based on GObject system. Searpc
    handles the serialization/deserialization part of RPC, the transport
    part is left to users.
endef

CONFIGURE_ARGS += --enable-compile-demo=no

define Build/Configure
    $(call Build/Configure/Default,)
endef

define Build/Compile
    $(call Build/Compile/Default,)
endef

define Package/libsearpc/install
endef

$(eval $(call BuildPackage,libsearpc))

Still no luck, even if I define the "Package/libsearpc/install" section only, the package is not built. sad

EDIT: you were right indeed, once I put something (eg. "echo asdasd") in the "install" section, the build process starts working as expected.

But why is it like that? I think the "PKG_INSTALL" switch does not work then as it should run "make install" as per the "Creating packages" wiki page:

PKG_INSTALL - Setting it to "1" will call the package's original "make install" with prefix set to PKG_INSTALL_DIR

If I leave the "install" section empty, nothing happens. If I specify some commands that prevents the default "make install" to run. And the most interesting part: if I add "make install" here, I get an infinite loop! smile

EDIT2: I was wrong, make install does run and puts the files to a subdirectory named "ipkg-install" within the build directory. No more issues then!

Nonetheless, I am *very* happy that I have my issue resolved - now I can go on with creating the packages.

Thanks for all the help, guys, I couldn't figure this out myself.

(Last edited by geryhun on 18 Nov 2014, 23:41)

The discussion might have continued from here.