compiling for openwrt fails

2012-11-13
2013-05-28
  • I'm unable to create a package for openwrt (attitude adjustment). Fortunately it has created the server binaries already, I tried to copy eibd and it seems to run on the host platform.

    The make process fails due to "Package eibd is missing dependencies for the following libraries:
    libeibclient.so.0
    libstdc++.so.6", even though these missing binaries seems to be found at  /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/eibd/client/c/.libs/libeibclient.so.0 and /home/kristian/projects/attitude_adjustment/build_dir/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/gcc-linaro-4.6-2012.02-final/mips-openwrt-linux-uclibc/libstdc++-v3/src/.libs/libstdc++.so.6

    Is there something I could adjust help the openwrt build environment to find the proper files?

    kristian@seagal:~/projects/attitude_adjustment$ grep libeibclient.so.0 staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/*
    staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/eibd.missing:libeibclient.so.0
    kristian@seagal:~/projects/attitude_adjustment$ grep libstdc++.so.6 staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/*
    staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo/eibd.missing:libstdc++.so.6

    (top level openwrt) make V=99 process ends with the following output:

    make: Entering directory `/home/kristian/projects/attitude_adjustment/package/bcusdk'
    mkdir -p /home/kristian/projects/attitude_adjustment/bin/ar71xx/packages /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/CONTROL /home/kristian/projects/attitude_adjustment/staging_dir/target-mips_r2_uClibc-0.9.33.2/pkginfo
    mkdir -p /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin
    cp -fpR /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/eibd/server/eibd /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/
    cp -fpR /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/eibd/bcu/bcuaddrtab /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/
    cp -fpR /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/eibd/bcu/bcuread /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/
    cp -fpR /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/eibd/eibnet/eibnetsearch /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/
    cp -fpR /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/eibd/eibnet/eibnetdescribe /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/
    cp -fpR /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/eibd/usb/findknxusb /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/
    cp -fpR /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/eibd/examples/.libs/knxtool /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-
    0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/
    rm -f /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxread
    rm -f /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxreadtemp
    rm -f /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxwrite
    rm -f /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxlog
    rm -f /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxon
    rm -f /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxoff
    rm -f /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxif
    rm -f /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxswrite
    rm -f /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxbool
    rm -f /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxdimup
    ln -s knxtool /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxread
    ln -s knxtool /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxreadtemp
    ln -s knxtool /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxwrite
    ln -s knxtool /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxlog
    ln -s knxtool /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxon
    ln -s knxtool /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxoff
    ln -s knxtool /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxif
    ln -s knxtool /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxswrite
    ln -s knxtool /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxbool
    ln -s knxtool /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd/usr/bin/knxdimup
    find /home/kristian/projects/attitude_adjustment/build_dir/target-mips_r2_uClibc-0.9.33.2/bcusdk-0.0.5/ipkg-ar71xx/eibd -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf
    Package eibd is missing dependencies for the following libraries:
    libeibclient.so.0
    libstdc++.so.6
    make: ***  Error 1
    make: Leaving directory `/home/kristian/projects/attitude_adjustment/package/bcusdk'
    make: ***  Error 2
    make: Leaving directory `/home/kristian/projects/attitude_adjustment'
    make: ***  Error 2
    make: Leaving directory `/home/kristian/projects/attitude_adjustment'
    make: ***  Error 2

    The makefile I used:

    # Makefile
    ### #include <cstdlib> in eibd/usb/usb.h
    ### python pascal in eibd/clients/makefile.am entfernen

    include $(TOPDIR)/rules.mk

    PKG_NAME:=bcusdk
    PKG_VERSION:=0.0.5
    PKG_RELEASE:=2011-03-06
    PKG_MD5SUM:=5f81bc4e6bb53564573d573e795a9a5f
    PKG_SOURCE_URL:=http://switch.dl.sourceforge.net/project/bcusdk/bcusdk
    PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
    PKG_CAT:=zcat

    PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
    PKG_BUILD_DEPENDS:=pthsem libxml2 argp-standalone

    include $(INCLUDE_DIR)/package.mk

    define Package/eibd
            SECTION:=net
            CATEGORY:=Network
            TITLE:=Eib KNX deamon
            URL:=http://www.auto.tuwien.ac.at/~mkoegler/index.php/eibd
            DEPENDS:=+pthsem
    endef

    define Package/eibd/description
    EIB KNX Daemon
    endef

    define Package/eibd-utils
            SECTION:=net
            CATEGORY:=Network
            TITLE:=Eib KNX Utils
            URL:=http://www.auto.tuwien.ac.at/~mkoegler/index.php/eibd
            DEPENDS:=+pthsem
    endef

    define Package/eibd-utils/description
    EIB KNX Utils
    endef
    define Build/Prepare
            $(call Build/Prepare/Default)
    endef

    define Build/Configure
            $(call Build/Configure/Default,\
                    -enable-onlyeibd \
                    -disable-ft12 \
                    -enable-eibnetip \
                    -enable-eibnetiptunnel \
                    -enable-eibnetipserver \
                    -enable-usb \
                    -disable-tpuart \
                    -disable-tpuarts \
                    -disable-pei16 \
                    -disable-pei16s \
                    -enable-groupcache \
                    -without-pth-test \
                    -without-libstdc )
    endef

    define Build/Compile
            $(MAKE) -C $(PKG_BUILD_DIR) \
                    CC=$(TARGET_CC) \
                    LIBS="-L$(STAGING_DIR)/usr/lib -fno-builtin -nostdinc++ -nodefaultlibs -lstdc++ -lc -lm -lgcc -largp -lpthsem " \
                    CPPFLAGS="-I$(STAGING_DIR)/include -I$(STAGING_DIR)/usr/include"
                    # -I$(LINUX_DIR)/include"

    endef

    define Package/eibd/install
            mkdir -p $(1)/usr/bin
            $(CP) $(PKG_BUILD_DIR)/eibd/server/eibd $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/bcu/bcuaddrtab $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/bcu/bcuread $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/eibnet/eibnetsearch $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/eibnet/eibnetdescribe $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/usb/findknxusb $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/knxtool $(1)/usr/bin/
            -rm -f $(1)/usr/bin/knxread
            -rm -f $(1)/usr/bin/knxreadtemp
            -rm -f $(1)/usr/bin/knxwrite
            -rm -f $(1)/usr/bin/knxlog
            -rm -f $(1)/usr/bin/knxon
            -rm -f $(1)/usr/bin/knxoff
            -rm -f $(1)/usr/bin/knxif
            -rm -f $(1)/usr/bin/knxswrite
            -rm -f $(1)/usr/bin/knxbool
            -rm -f $(1)/usr/bin/knxdimup
            ln -s knxtool $(1)/usr/bin/knxread
            ln -s knxtool $(1)/usr/bin/knxreadtemp
            ln -s knxtool $(1)/usr/bin/knxwrite
            ln -s knxtool $(1)/usr/bin/knxlog
            ln -s knxtool $(1)/usr/bin/knxon
            ln -s knxtool $(1)/usr/bin/knxoff
            ln -s knxtool $(1)/usr/bin/knxif
            ln -s knxtool $(1)/usr/bin/knxswrite
            ln -s knxtool $(1)/usr/bin/knxbool
            ln -s knxtool $(1)/usr/bin/knxdimup
    endef

    define Package/eibd-utils/install
            mkdir -p $(1)/usr/lib
            $(CP) $(PKG_BUILD_DIR)/eibd/client/c/.libs/libeibclient.so.0.0.0 $(1)/usr/lib/
            echo "successfully copied libeibclient.so.0.0.0"
            ln -s libeibclient.so.0.0.0 $(1)/usr/lib/libeibclient.so
            ln -s libeibclient.so.0.0.0 $(1)/usr/lib/libeibclient.so.0
            mkdir -p $(1)/usr/bin
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/busmonitor1 $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/busmonitor2 $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/vbusmonitor1 $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/vbusmonitor2 $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/groupwrite $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/groupswrite $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/grouplisten $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/groupread $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/groupresponse $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/groupreadresponse $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/groupsocketlisten $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/groupsocketread $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/groupsocketwrite $(1)/usr/bin/
            $(CP) $(PKG_BUILD_DIR)/eibd/examples/.libs/groupsocketswrite $(1)/usr/bin/
    endef

    #$(eval $(call RequireHeader,/usr/include/gnu/stubs-32.h,$(PKG_NAME) requires a 32-bits toolchain. ))

    $(eval $(call BuildPackage,eibd))
    $(eval $(call BuildPackage,eibd-utils))

    Best regards,
    Kristian

     
  • Martin Koegler
    Martin Koegler
    2012-11-13

    This is probably a question for suited for a OpenWrt forum. My guess is, that your eibd package must depend on eibd-utils and the c++ library package, as they contain the necessary libaries.

    PS: bcusdk configure support "-without-libstdc".

     
  • Othmar
    Othmar
    2012-11-13

    Hi, I checked your Makefile for OpenWrt with mine and they look pretty much the same, so this should basically work.

    When I prepared the build environment I also selected libstdcpp in Base System as module to be built. Did you miss that?

    Regards, Othmar

     
  • Thanks for the answers.

    e9925248: The makefile above includes -without-libstdc in the configure section.
    eibd-utils is selected.
    You're probably right, I'll try to ask at the Openwrt forum. However, the bcusdk is not included in openwrt by default, so they might refer me to the bcusdk forum.. I'll try my luck.

    otru: I did not have libstdcpp selected, but I tried it now and it did not make any difference. It does not seem to be needed. Which versions have you used (openwrt, bcusdk, build environment).

    I realized that openwrt attitude adjustment does not compile the pthsem source on ubuntu 12.04, but it does on 11.04, but that's another story..

    Best regards,
    Kristian

     
  • Othmar
    Othmar
    2012-11-14

    I see, my environment is probably not of any relevance for you, as I had backfire 10.3.1 on ubuntu 11.10 when I compiled the exact same bcusdk (according to the  PKG_MD5SUM in your makefile) the last time. I would have to redo everything on my current ubuntu 12.04 to have an equivalent situation. Just for the record: ldd shows that my eibd is actually linked with libstdc++.so.6

     
  • pthsem has been marked as broken in openwrt for no reason, I reported that to the devel-ML but no feedback..
    I've zipped my local Packages and put them up here http://repo.wiregate.de/openwrt/pkg/

    It's a little "custom" - i.e. youd want to change some things, use the source from sf etc. but maybe it helps; at least it build here under U12.04..

    Michael

     
  • Martin Koegler
    Martin Koegler
    2012-11-14

    In my option, you are facing not a bug in eibd, but its packaging script - so a forum covering creating packages is the correct place.

    As a wild guess, I would try this _:
    define Package/eibd
    SECTION:=net
    [
    DEPENDS:=+pthsem eibd-utils libstc++
    endef _

     
  • otru: Yes, the eibd is dynamically linked against /usr/lib/libstdc++.so.6. I've got that file installed on my openwrt, it's just seem to be a packaging problem. (The funny thing is, I got the eibd file running on my openwrt, but it's manually copied, not installed through package. I still need the utils and clients, the package would be very handy).

    Michael: I struggled for a while with pthsem on ubuntu 12.04., the build process failed with something like "Unsupported platform and or eglibc version". When I switched to ubuntu 11.04. the pthsem package builds successfully. Perhaps that's why the pthsem is marked broken in openwrt?

    e9925248: I guess you're right, someone at a forum covering creation of openwrt packages might be able to solve this. However, I hope to find someone interested in this specific problem.

    Thanks for your help so far.
    Kristian

     
  • The issue with pthsem is with kernel 3.x - fixed in trunk by mkoegler already long ago and with a patch in the package I posted..
    eibd builds fine here against uClibc++ without libstdc++, the packaging only quickly hacked together..

    Michael

     
  • Thanks Michael.  I tried using your sources, and the build process completed successfully.

    However, I could not find any created packages.. you must keep me stupid, but what might have happened?

     
  • Othmar
    Othmar
    2013-04-27

    Kristian: as OpenWrt Attitude Adjustment is now officially released I tried to rebuild myself and stumbled across the same problems and which I solved for me now:

    pthsem: the root cause for the problem is in the original source, namely in pthsem-2.0.8/acinclude.m4. The kernel for Attitude Adjustment is now 3.3.8 but pthsem lacks support for "linux" archs other than 2.x. That's why the original feed file now contains a dependency for eglibc and target x86, restricting pthsem to clean builds only and omitting broken ones.
    To overcome this the DEPENDS clause in the Makefile has to be removed and a patch "001-linux3x-fix.patch" is needed. I just filed two tickets to get the openwrt trunk updated for this.

    bcusdk: building works fine but packaging breaks because of unresolved dependencies. To overcome this I updated the DEPENDS clause and rearranged the packages in the feed file. eibd now only contains the statically built binaries while eibd-utils contains the libeibclient.so and the rest of the binaries and tools.

    You may download the updated feed files from here

    Regards, Othmar

     
  • Othmar
    Othmar
    2013-04-28

    Michael: regarding eibd - I just reworked my definitions again and now eibd does not need C++ libraries anymore, neither libstdc++ nor uClibc++.

    Regards, Othmar