I was able to compile the plugin by adding a dependency on the host variant of protobuf-c
, basing on the provided patch (tested on release 23.05.2
and rpi4b
).
The protoc
binary needs to run on host during the build process, I also changed the flag so it points to the protobuf-c
library now instead of the compiler (automake didn't seem to recognize the --with-protoc_c
anyway.
The only thing I am not happy with is that the dependency on protobuf-c/host
is added for the package "globally", I didn't find an easy way to add it only for the scenarios where "write_prometheus" plugin is built. Simply adding the line in the same condition clause as the CONFIGURE_ARGS seems to have no effect (the dependency is not added at all).
diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile
index 0119c88aa..7c60fead2 100644
--- a/utils/collectd/Makefile
+++ b/utils/collectd/Makefile
@@ -29,6 +29,8 @@ PKG_CONFIG_DEPENDS:= \
PACKAGE_COLLECTD_ENCRYPTED_NETWORK \
PACKAGE_COLLECTD_DEBUG_OUTPUT_ENABLE
+PKG_BUILD_DEPENDS+=protobuf-c/host
+
COLLECTD_PLUGINS_DISABLED:= \
amqp \
amqp1 \
@@ -120,7 +122,6 @@ COLLECTD_PLUGINS_DISABLED:= \
write_kafka \
write_log \
write_mongodb \
- write_prometheus \
write_redis \
write_riemann \
write_sensu \
@@ -207,7 +208,8 @@ COLLECTD_PLUGINS_SELECTED:= \
vmem \
wireless \
write_graphite \
- write_http
+ write_http \
+ write_prometheus
PKG_CONFIG_DEPENDS:= \
$(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
@@ -349,6 +351,12 @@ ifneq ($(CONFIG_PACKAGE_collectd-mod-disk),)
--with-libudev="$(STAGING_DIR)/usr"
endif
+# exception: write-prometheus needs protobuf-c
+ifneq ($(CONFIG_PACKAGE_collectd-mod-write-prometheus),)
+ CONFIGURE_ARGS+= \
+ --with-libprotobuf_c="$(STAGING_DIR)/usr"
+endif
+
define Package/collectd/conffiles
/etc/collectd.conf
/etc/config/collectd
@@ -530,6 +538,7 @@ $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
$(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
$(eval $(call BuildPlugin,write-graphite,Carbon/Graphite output,write_graphite,+PACKAGE_collectd-mod-write-graphite:libpthread))
$(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))
+$(eval $(call BuildPlugin,write-prometheus,Prometheus output,write_prometheus,+PACKAGE_collectd-mod-write-prometheus:libmicrohttpd +PACKAGE_collectd-mod-write-prometheus:libprotobuf-c))
$(eval $(call BuildScriptPlugin,sqm,SQM/qdisc collection,sqm_collectd,+PACKAGE_collectd-mod-sqm:collectd-mod-exec))
$(eval $(call BuildScriptLuaPlugin,ltq-dsl,Lantiq DSL collection,dsl,@ltq-dsl-app +PACKAGE_collectd-mod-ltq-dsl:collectd-mod-lua +libubus-lua))