Hi Roger,
Thanks for the reply. Well, yes, I've noticed that those functions are on different modules, but there are some cases where some of the headers containing the function prototype gets included when compiling the same file (causing the build issue).
In particular, when building the db_dump (under subdir apps/db_dumps):
- Makefile compiles also lib/send_disconnect.c
- lib/send_disconnect.c includes:
- src/mosquitto_broker_internal.h (when WITH_BROKER is defined) that defines log__printf (to be used by the broker)
- lib/logging_mosq.h that defines log__printf again
causing compilation issues.
The worst part is that db_dump is not linked with neither libmosquitto nor the object from the broker that contains log__printf, and it ends up re-defining a dummy stub for all those missing functions.
(on a different note, the Makefile for db_dump should probably use APP_CPPFLAGS, APP_CFLAGS, and APP_LDFLAGS from
config.mk instead of redefining its own)
Anyway, a simple fix to the header issue is to simply put a guard around including "logging_mosq.h" in src/send_disconnect.c if WITH_BROKER is defined:
...
#ifndef WITH_BROKER
#include "logging_mosq.h"
#endif
...
I can submit a PR with this fix. Let me know.
Regards,
Fabrizio