Cross kompilace collectd 5.x s libgrcypt pro OpenWRT

ET

Cross kompilace collectd 5.x s libgrcypt pro OpenWRT
« kdy: 23. 11. 2016, 15:27:21 »
Zdravim,

nezkousel nekdo cross kompilovat collectd (5.x) pro pro openwrt 15.05 (ar71xx)? Kompilace konci chybou nize i pres zapnuty "--with-nan-emulation"

Kód: [Vybrat]
  CCLD     collectdctl
  CCLD     collectd-tg
  CCLD     collectdmon
collectd_nagios-collectd-nagios.o: In function `match_range':
collectd-nagios.c:(.text+0x824): undefined reference to `__isnan'
collectd-nagios.c:(.text+0x884): undefined reference to `__isnan'
collectd_nagios-collectd-nagios.o: In function `do_check_con_none':
collectd-nagios.c:(.text+0xcf0): undefined reference to `__isnan'
collectd_nagios-collectd-nagios.o: In function `do_check_con_average':
collectd-nagios.c:(.text+0x1058): undefined reference to `__isnan'
collectd_nagios-collectd-nagios.o: In function `do_check_con_sum':
collectd-nagios.c:(.text+0x135c): undefined reference to `__isnan'
collectd_nagios-collectd-nagios.o:collectd-nagios.c:(.text+0x1624): more undefined references to `__isnan' follow
collect2: error: ld returned 1 exit status
  CCLD     df.la
make[3]: *** [collectd-nagios] Error 1
make[3]: *** Waiting for unfinished jobs....
libcollectdclient/.libs/libcollectdclient.so: undefined reference to `__isnan'
collect2: error: ld returned 1 exit status
make[3]: *** [collectdctl] Error 1
libcollectdclient/.libs/libcollectdclient.so: undefined reference to `__isnan'
collect2: error: ld returned 1 exit status
make[3]: *** [collectd-tg] Error 1
make[3]: Leaving directory `/export/shared/src/collectd/collectd-5.5.2/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/export/shared/src/collectd/collectd-5.5.2/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/export/shared/src/collectd/collectd-5.5.2/src'
make: *** [all-recursive] Error 1



« Poslední změna: 23. 11. 2016, 21:11:53 od Petr Krčmář »


ET

Re:cross kompilace collectd 5.x s libgrcypt pro openwrt
« Odpověď #1 kdy: 23. 11. 2016, 19:30:13 »
tak to mam, kompletni postup (pro collectd 5.5.2):

1] install openwrt toolchain (with all feeds) - https://wiki.openwrt.org/doc/howto/buildroot.exigence
Kód: [Vybrat]
git clone https://git.openwrt.org/15.05/openwrt.git
cd openwrt/
./scripts/feeds update -a
./scripts/feeds install -a

2] openwrt default config
Kód: [Vybrat]
make menuconfig # select target system
make defconfig

3] collectd/libgcrypt menuconfig
Kód: [Vybrat]
make menuconfig
* Utilities -> collectd # select your modules (for dependecies)
* Libraries -> libgcrypt

4] compile toolchain
Kód: [Vybrat]
make [-j4]

5] collectd-5.5.2 compilation script
Kód: [Vybrat]
# build opts
export OWRT_DIR=/export/shared/src/openwrt
export COLECTD_SRC=/export/shared/src/collectd/collectd-5.5.2
export COLECTD_PREFIX=/opt/collectd-ok
export COLLECTD_ARCH="--build=mips-openwrt-linux-gnu --host=mips-openwrt-linux-uclibc"
export COLLECTD_PATHS="--prefix=$COLECTD_PREFIX --sysconfdir=/etc --localstatedir=/var"
export COLLECTD_MISC="--with-nan-emulation --with-fp-layout=endianflip --with-libgcrypt-prefix=$TARGET_DIR/usr"
export COLECTD_PULGINS="--enable-all-plugins=no --enable-conntrack --enable-cpu --enable-df --enable-disk --enable-dns --enable-ethstat --enable-interface --enable-iptables --
enable-load --enable-logfile --enable-memory --enable-netlink --enable-network --enable-ntpd --enable-ping --enable-processes --enable-protocols --enable-tcpconns --enable-uni
xsock --enable-uptime --enable-users --enable-write_log --enable-iwinfo --with-libgcrypt --with-libiptc --with-liboping --with-libpcap"

# paths and environment for cross compiling for openwrt
export STAGING_DIR=$OWRT_DIR/staging_dir
export TOOLCHAIN_DIR=$STAGING_DIR/toolchain-mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2
export TARGET_DIR=$STAGING_DIR/target-mips_34kc_uClibc-0.9.33.2
export PATH=$TOOLCHAIN_DIR/bin:$PATH

# compiler opts
export LD_LIBRARY_PATH=$TARGET_DIR/usr/lib
export LIBRARY_PATH=$TARGET_DIR/usr/lib
export INCLUDE_DIR=$TARGET_DIR/usr/include
export CPATH=$TARGET_DIR/usr/include
export CC=mips-openwrt-linux-uclibc-gcc
export LD=mips-openwrt-linux-uclibc-ld
export CFLAGS="-I$TARGET_DIR/usr/include"
export LDFLAGS="-L$TARGET_DIR/usr/lib"
export LIBS="-lgpg-error -lm -lgcrypt -luci -lubox -lnl-tiny"

cd $COLECTD_SRC

# cleaning
make distclean &> /dev/null
# rm -rf $COLECTD_PREFIX

./configure $COLLECTD_ARCH $COLLECTD_PATHS $COLLECTD_MISC $COLECTD_PULGINS
# check config.log for errors!
make [-j4]
#make install


works for me...

PS:
* puvodni chybu "undefined reference to __isnan" jsem odstanil/obesel pridanim parametru "-lm" do $LIBS
* wireless/mad80211 plugin pro collectd mi nefunguje, ale nasel jsem plugin "iwinfo" pouze pro OWRT, ktery funguje, ale bude potreba patchnout configure.ac - kdyztak jeste doplnim...