Compile error collectd 24.10

I was compiling for my EA8500 version 24.10 , I know it is still a W.I.P. but does this ring a bell to anyone?:

make[5]: Entering directory '/media/egc/linuxdata/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/collectd-5.12.0'
arm-openwrt-linux-muslgnueabi-gcc -DHAVE_CONFIG_H -I. -I./src  -I./src -I./src/daemon -DPREFIX='"/usr"' -DCONFIGFILE='"/etc/collectd.conf"' -DLOCALSTATEDIR='"/var"' -DPKGLOCALSTATEDIR='"/var/lib/collectd"' -DPLUGINDIR='"/usr/lib/collectd"' -DPKGDATADIR='"/usr/share/collectd"'  -I./src/libcollectdclient -I./src/libcollectdclient -I/media/egc/linuxdata/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/usr/include -I/media/egc/linuxdata/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/include -I/media/egc/linuxdata/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/include/fortify    -Wall -Os -pipe -g3 -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=hard -fmacro-prefix-map=/media/egc/linuxdata/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/collectd-5.12.0=collectd-5.12.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro    -DPIC -fpic -c -o src/collectd_nagios-collectd-nagios.o `test -f 'src/collectd-nagios.c' || echo './'`src/collectd-nagios.c
/bin/bash ./libtool  --tag=CC   --mode=compile arm-openwrt-linux-muslgnueabi-gcc -DHAVE_CONFIG_H -I. -I./src  -I./src -I./src/daemon -DPREFIX='"/usr"' -DCONFIGFILE='"/etc/collectd.conf"' -DLOCALSTATEDIR='"/var"' -DPKGLOCALSTATEDIR='"/var/lib/collectd"' -DPLUGINDIR='"/usr/lib/collectd"' -DPKGDATADIR='"/usr/share/collectd"'  -I./src/libcollectdclient -I./src/libcollectdclient -I./src/daemon  -I/media/egc/linuxdata/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/usr/include -I/media/egc/linuxdata/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/include -I/media/egc/linuxdata/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/include/fortify    -Wall -Os -pipe -g3 -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=hard -fmacro-prefix-map=/media/egc/linuxdata/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/collectd-5.12.0=collectd-5.12.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro    -DPIC -fpic -c -o src/libcollectdclient/libcollectdclient_la-client.lo `test -f 'src/libcollectdclient/client.c' || echo './'`src/libcollectdclient/client.c
OpenWrt-libtool: compile:  arm-openwrt-linux-muslgnueabi-gcc -DHAVE_CONFIG_H -I. -I./src -I./src -I./src/daemon -DPREFIX=\"/usr\" -DCONFIGFILE=\"/etc/collectd.conf\" -DLOCALSTATEDIR=\"/var\" -DPKGLOCALSTATEDIR=\"/var/lib/collectd\" -DPLUGINDIR=\"/usr/lib/collectd\" -DPKGDATADIR=\"/usr/share/collectd\" -I./src/libcollectdclient -I./src/libcollectdclient -I./src/daemon -I/media/egc/linuxdata/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/usr/include -I/media/egc/linuxdata/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/include -I/media/egc/linuxdata/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/include/fortify -Wall -Os -pipe -g3 -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=hard -fmacro-prefix-map=/media/egc/linuxdata/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/collectd-5.12.0=collectd-5.12.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fpic -c src/libcollectdclient/client.c  -fPIC -DPIC -o src/libcollectdclient/.libs/libcollectdclient_la-client.o
In file included from src/libcollectdclient/client.c:38:
src/libcollectdclient/client.c: In function 'lcc_version':
src/libcollectdclient/collectd/lcc_features.h:42:29: error: 'r53' undeclared (first use in this function)
   42 | #define LCC_VERSION_PATCH 0-r53
      |                             ^~~
src/libcollectdclient/collectd/lcc_features.h:49:45: note: in definition of macro 'LCC_VERSION_ENCODE'
   49 |         ((major) * 10000 + (minor) * 100 + (patch))
      |                                             ^~~~~
src/libcollectdclient/collectd/lcc_features.h:52:66: note: in expansion of macro 'LCC_VERSION_PATCH'
   52 |         LCC_VERSION_ENCODE(LCC_VERSION_MAJOR, LCC_VERSION_MINOR, LCC_VERSION_PATCH)
      |                                                                  ^~~~~~~~~~~~~~~~~
src/libcollectdclient/client.c:547:10: note: in expansion of macro 'LCC_VERSION'
  547 |   return LCC_VERSION;
      |          ^~~~~~~~~~~
src/libcollectdclient/collectd/lcc_features.h:42:29: note: each undeclared identifier is reported only once for each function it appears in
   42 | #define LCC_VERSION_PATCH 0-r53
      |                             ^~~
src/libcollectdclient/collectd/lcc_features.h:49:45: note: in definition of macro 'LCC_VERSION_ENCODE'
   49 |         ((major) * 10000 + (minor) * 100 + (patch))
      |                                             ^~~~~
src/libcollectdclient/collectd/lcc_features.h:52:66: note: in expansion of macro 'LCC_VERSION_PATCH'
   52 |         LCC_VERSION_ENCODE(LCC_VERSION_MAJOR, LCC_VERSION_MINOR, LCC_VERSION_PATCH)
      |                                                                  ^~~~~~~~~~~~~~~~~
src/libcollectdclient/client.c:547:10: note: in expansion of macro 'LCC_VERSION'
  547 |   return LCC_VERSION;
      |          ^~~~~~~~~~~
src/libcollectdclient/client.c:548:1: warning: control reaches end of non-void function [-Wreturn-type]
  548 | } /* }}} unsigned int lcc_version */
      | ^
make[5]: *** [Makefile:8118: src/libcollectdclient/libcollectdclient_la-client.lo] Error 1
make[5]: Leaving directory '/media/egc/linuxdata/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/collectd-5.12.0'
make[4]: *** [Makefile:5519: all] Error 2
make[4]: Leaving directory '/media/egc/linuxdata/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/collectd-5.12.0'
make[3]: *** [Makefile:461: /media/egc/linuxdata/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/collectd-5.12.0/.built] Error 2
make[3]: Leaving directory '/media/egc/linuxdata/openwrt/feeds/packages/utils/collectd'
time: package/feeds/packages/collectd/compile#36.50#11.23#47.48
    ERROR: package/feeds/packages/collectd failed to build.
make[2]: *** [package/Makefile:179: package/feeds/packages/collectd/compile] Error 1
make[2]: Leaving directory '/media/egc/linuxdata/openwrt'
make[1]: *** [package/Makefile:173: /media/egc/linuxdata/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/stamp/.package_compile] Error 2
make[1]: Leaving directory '/media/egc/linuxdata/openwrt'
make: *** [/media/egc/linuxdata/openwrt/include/toplevel.mk:248: world] Error 2

Doesn't ring any bell, as I am almost comping collected to main/master, and there should be no difference between 24.10 and main. (24.10 is like main was one month ago)

Is there anything special in your build options?

Nothing special it is actually loosely based on your config :slight_smile:
I did add apk and removed opkg maybe that is related?

It builds fine after removing LuCi app statistics and collectd.
Will research further

I compiled my own R7800 build (arm_cortex-a15+neon-vfpv4) last week, and it was ok.
Will check again in weekend.
MT6000 and RT3200 were ok yesterday.

1 Like

A wild guess the 0-r53 as LCC_VERSION_PATCH seems the culprit.
In the Makefile 53 is the release:
PKG_RELEASE:=53

Is not APK adding the r53 and maybe collectd expects an integer?

I recognized that -r53 there immediately just for PKG_RELEASE, but I wonder why that has not hurt me. (Maybe I am not using that module?)

For you it seems seems to understand that as mathematics " 0 - variable r53" or something like that.

Yes exactly that is what I thought, now building with simply commenting the PKG_RELEASE in the makefile:
#PKG_RELEASE:=53

That works for the moment, I now have:
#define LCC_VERSION_PATCH 0

Problem starts in configure.ac (line 7443), PACKAGE_VERSION is read as 5.12.0-r53:

dnl libcollectdclient
LCC_VERSION_MAJOR=`echo $PACKAGE_VERSION | cut -d'.' -f1`
LCC_VERSION_MINOR=`echo $PACKAGE_VERSION | cut -d'.' -f2`
LCC_VERSION_PATCH=`echo $PACKAGE_VERSION | cut -d'.' -f3`

LCC_VERSION_EXTRA=`echo $PACKAGE_VERSION | cut -d'.' -f4-`

LCC_VERSION_STRING="$LCC_VERSION_MAJOR.$LCC_VERSION_MINOR.$LCC_VERSION_PATCH"

AC_SUBST([LCC_VERSION_MAJOR])
AC_SUBST([LCC_VERSION_MINOR])
AC_SUBST([LCC_VERSION_PATCH])
AC_SUBST([LCC_VERSION_EXTRA])
AC_SUBST([LCC_VERSION_STRING])

then goes on to src/libcollectdclient/collectd/lcc_features.h.in

#define LCC_VERSION_MAJOR @LCC_VERSION_MAJOR@
#define LCC_VERSION_MINOR @LCC_VERSION_MINOR@
#define LCC_VERSION_PATCH @LCC_VERSION_PATCH@

#define LCC_VERSION_EXTRA "@LCC_VERSION_EXTRA@"

#define LCC_VERSION_STRING "@LCC_VERSION_STRING@"

#define LCC_VERSION_ENCODE(major, minor, patch) \
	((major) * 10000 + (minor) * 100 + (patch))

#define LCC_VERSION \
	LCC_VERSION_ENCODE(LCC_VERSION_MAJOR, LCC_VERSION_MINOR, LCC_VERSION_PATCH)

LCC_BEGIN_DECLS

unsigned int lcc_version (void);

const char *lcc_version_string (void);

const char *lcc_version_extra (void);

Could be some thing only on my side, as said I removed opkg and added apk-openssl in my config, can send you my config if needed

apk is default in main/master, so I build with it.

You should not use apk in 24.10 in any case. It is still quite buggy there, as the patches from @robimarko, @aparcar & others are not yet backported there.

Yes I know but I have the same problem when building from Main.
I have been building from Main with the same error, after commenting out the PACKAGE_RELEASE it builds without a problem

Will study some more, for now at least I have a clumsy workaround :slight_smile:

I will do a dir-clean to be sure I did not keep things from 24.10 and report back if I am sure I started with a virgin Main repo

Thanks!

Beating apk into shape is still a work in progress, in main. There have been significant fixes there this week and by now it works pretty well (but individual packages might still expose issues, in packaging expectations or in the apk integration itself).

1 Like

For main/master my R7800 build builds just nicely:

perus@ub2410:/OpenWrt/r7800$ ls  bin/packages/arm_cortex-a15_neon-vfpv4/packages/collectd-5*
bin/packages/arm_cortex-a15_neon-vfpv4/packages/collectd-5.12.0-r53.apk

perus@ub2410:/OpenWrt/r7800$ cat files/etc/Compile_info.txt 
OpenWrt main r28146-52b6c92479 / 2024-11-22 18:36
---
openwrt   2024-11-21 52b6c92 Revert "mediatek: fix pwn fan settings fo
luci      2024-11-21 3f907ab Translations update from Hosted Weblate (
packages  2024-11-22 9fff76a speedtest-go: update to 1.7.9
routing   2024-11-14 8f5ed0f ndppd: update to version 0.2.6

In the prepared & compiled source code, the version looks normally parsed:
In build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/collectd-5.12.0/src/libcollectdclient/collectd/lcc_features.h

#define LCC_API_VERSION 0

#define LCC_VERSION_MAJOR 5
#define LCC_VERSION_MINOR 12
#define LCC_VERSION_PATCH 0

#define LCC_VERSION_EXTRA "git"

#define LCC_VERSION_STRING "5.12.0"

#define LCC_VERSION_ENCODE(major, minor, patch) \
        ((major) * 10000 + (minor) * 100 + (patch))

#define LCC_VERSION \
        LCC_VERSION_ENCODE(LCC_VERSION_MAJOR, LCC_VERSION_MINOR, LCC_VERSION_PATCH)

LCC_BEGIN_DECLS

And in the build log the "r53" only surfaces in the .apk packaging step, not earlier:

perus@ub2410:/OpenWrt/r7800/logs/package/feeds/packages/collectd$ grep r53 compile.txt 
/OpenWrt/r7800/staging_dir/host/bin/fakeroot /OpenWrt/r7800/staging_dir/host/bin/apk mkpkg --info "name:collectd" --info "version:5.12.0-r53" --info "description:collectd is a small daemon which collects system information periodically and provides mechanismns to store the values in a variety of ways." --info "arch:arm_cortex-a15_neon-vfpv4" --info "license:MIT GPL-2.0-or-later" --info "origin:feeds/packages/utils/collectd" --info "url:https://collectd.org/" --info "maintainer:Jo-
...

so, for me, the collectd in OpenWrt main at r28146-52b6c92479 builds just fine. (with apk, as the current default)

EDIT:
I uploaded the build to the dropbox download dir of my community build. I haven't flashed it, but should be ok, as I changed nothing from 14.11.2024 build, except the updated sources that work in other routers.

Thanks for looking into it.
That is exactly like it should be.
My LCC_VERSION_PATCH showed 0-r53

I have now cleaned everything and building again, will keep you informed

My limited collection of collectd applets has also been working fine with apk for me:

CONFIG_PACKAGE_collectd=m
CONFIG_PACKAGE_collectd-mod-conntrack=m
CONFIG_PACKAGE_collectd-mod-cpu=m
CONFIG_PACKAGE_collectd-mod-cpufreq=m
CONFIG_PACKAGE_collectd-mod-entropy=m
CONFIG_PACKAGE_collectd-mod-exec=m
CONFIG_PACKAGE_collectd-mod-interface=m
CONFIG_PACKAGE_collectd-mod-iwinfo=m
CONFIG_PACKAGE_collectd-mod-load=m
CONFIG_PACKAGE_collectd-mod-memory=m
CONFIG_PACKAGE_collectd-mod-network=m
CONFIG_PACKAGE_collectd-mod-ping=m
CONFIG_PACKAGE_collectd-mod-rrdtool=m
CONFIG_PACKAGE_collectd-mod-snmp=m
CONFIG_PACKAGE_collectd-mod-sqm=m
CONFIG_PACKAGE_collectd-mod-thermal=m
CONFIG_PACKAGE_collectd-mod-uptime=m
CONFIG_PACKAGE_collectd-mod-wireless=m

Off topic here, but I think that you could drop entropy. It is useless nowadays, after Linux changed entropy handling a few years ago,

1 Like

Yeah, you're right, that package no longer provides sensible data anymore.

After a dist clean I can now build for Main without a problem, the r53 is now gone:
build-dir/ target-arm_cortex-a15+neon-vfpv4_musl_eabi/collectd-5.12.0/src/libcollectdclient/collectd/lcc_features.h

#define LCC_VERSION_MAJOR 5
#define LCC_VERSION_MINOR 12
#define LCC_VERSION_PATCH 0

#define LCC_VERSION_EXTRA "git"

#define LCC_VERSION_STRING "5.12.0"

No sign of r53 and version_extra now showing git no idea what was happening before.

Anyway sorry for wasting your time :frowning: