Undefined symbols `_mosquitto_callback_register`, `_mosquitto_callback_unregister`
I am trying to build a custom v5 auth plugin, so i have started by looking at the code of message-timestamp plugin (available in plugins directory). But on building the plugin i am getting the following errors:
Undefined symbols for architecture x86_64: "_mosquitto_callback_register", referenced from: _mosquitto_plugin_init in mosquitto_auth_acl_plugin-512511.o "_mosquitto_callback_unregister", referenced from: _mosquitto_plugin_cleanup in mosquitto_auth_acl_plugin-512511.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am trying this with the mosquitto v2.0.18
Build command i am using gcc -shared -fPIC -o mosquitto_auth_acl_plugin.so mosquitto_auth_acl_plugin.c -L/usr/local/Cellar/mosquitto/2.0.18/lib -lmosquitto
I did a little investigation and found that i am able to use the functions declared in mosquitto.h file but not able to use functions declared in mosquitto_broker.h (like mosquitto_callback_register , mosquitto_callback_unregister )
I have checked there is a similar issue reported here -> #2514 (i haven't checked this in develop branch yet as i wanted to use my plugin in production with the current version of mosquitto)
~~This is breaking builds on macOS again.~~
Our issue.
I don't think you should be linking with libmosquitto though.
This is about the change in 32c32678b63498af1ec74b87e79400f5d31f2eb7 breaking things. So I've got two conflicting reports, one that before the change the build breaks in some situations, and this one that the build breaks afterwards.