Skip to content
This repository has been archived by the owner on Mar 12, 2019. It is now read-only.

mosquitto_client_id: symbol not found #397

Closed
vibiu opened this issue Jan 28, 2019 · 5 comments
Closed

mosquitto_client_id: symbol not found #397

vibiu opened this issue Jan 28, 2019 · 5 comments

Comments

@vibiu
Copy link

vibiu commented Jan 28, 2019

Here is my mosquitto.conf:

persistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
...
auth_plugin /mosquitto/src/mosquitto-auth-plug/auth-plug.so
auth_opt_backends postgres
...

When I run mosquitto -c /mosquitto/config/mosquitto.conf, I got:

mosquitto version 1.5.5 starting
1548693091: Config loaded from /mosquitto/config/mosquitto.conf.
1548693091: Error: Unable to load auth plugin "/mosquitto/src/mosquitto-auth-plug/auth-plug.so".
1548693091: Load error: Error relocating /mosquitto/src/mosquitto-auth-plug/auth-plug.so: mosquitto_client_id: symbol not found

Mosquitto version is 1.5.5, and mosquitto-auth-plug version is 0.1.3(which is the latest release).
I wonder to know what does mosquitto_client_id: symbol not found mean, and how can I solve this problem.
Thanks a lot.

@vibiu
Copy link
Author

vibiu commented Jan 29, 2019

I can compile and run this plug well when I use mosquitto-auth-plug:0.1.2 and mosquitto:1.5.5.
I think there must be something wrong with mosquitto-auth-plug:0.1.3.
When I built them together in docker, thease error occurs:

cc  -I/src/ -I/lib/ -fPIC -Wall -Werror  -DBE_POSTGRES  -I`pg_config --includedir` -I/src -DDEBUG=1 -I/usr/include   -c -o auth-plug.o auth-plug.c
auth-plug.c:35:30: fatal error: mosquitto_broker.h: No such file or directory
compilation terminated.
<builtin>: recipe for target 'auth-plug.o' failed
make: *** [auth-plug.o] Error 1

I think this issue is familiar with #386.
You can check it out in here.
Thanks a lot.

@tobdub-snce
Copy link

I don't think auth-plug supports Mosquitto 1.5 yet. Try with Mosquitto 1.4.

@bogh
Copy link

bogh commented Feb 19, 2019

I'm having the same issue. Managed to build the plugin with mosquitto 1.5.5 library and I get the following error: mosquitto_client_username: symbol not found.

We really need to use mosquitto 1.5 cause of the websockets. And as it looks the auth plugin needs the mosquitto_broker.h which is available from 1.5 I think.

Any idea why getting this problem?

Thank you.

@vytasmk
Copy link

vytasmk commented Mar 2, 2019

Also playing with Docker and Alpine image (v3.8).
Compiling everything from source: Mosquitto 1.5.8 and mosquitto-auth-plug 0.1.3
Compiling with Redis and HTTP backends (all other are disabled). Got docker image size about 10MB

Everything compiles and Mosquitto runs without auth-plug normally. But when I try to enable auth-plug it thows error and can not start.

1551532223: mosquitto version 1.5.8 starting
1551532223: Config loaded from /etc/mosquitto/mosquitto.conf.
1551532223: Error: Unable to load auth plugin "/usr/local/lib/auth-plug.so".
1551532223: Load error: Error relocating /usr/local/lib/auth-plug.so: mosquitto_client_username: symbol not found

From inside container I run ldd against auth-plug.o

/ # ldd /usr/local/lib/auth-plug.so 
	ldd (0x7fa1d6a90000)
	libhiredis.so.0.14 => /usr/lib/libhiredis.so.0.14 (0x7fa1d6a6f000)
	libcurl.so.4 => /usr/lib/libcurl.so.4 (0x7fa1d69fb000)
	libcrypto.so.1.1 => /lib/libcrypto.so.1.1 (0x7fa1d677e000)
	libc.musl-x86_64.so.1 => ldd (0x7fa1d6a90000)
	libnghttp2.so.14 => /usr/lib/libnghttp2.so.14 (0x7fa1d675a000)
	libssh2.so.1 => /usr/lib/libssh2.so.1 (0x7fa1d6730000)
	libssl.so.1.1 => /lib/libssl.so.1.1 (0x7fa1d66b0000)
	libz.so.1 => /lib/libz.so.1 (0x7fa1d6696000)
Error relocating /usr/local/lib/auth-plug.so: mosquitto_client_id: symbol not found
Error relocating /usr/local/lib/auth-plug.so: mosquitto_client_certificate: symbol not found
Error relocating /usr/local/lib/auth-plug.so: mosquitto_client_username: symbol not found

Stuck here. Have tried digging and I think it could be related to the musl-libc that is used inside Alpine Linux instead of glibc... but this is just a guess. Functional differences musl-libc vs glibc

I tried to compile mosquitto v1.5.5 with auth-plug v0.1.3 - result the same.
When set auth-plug to v0.1.2 it just throws errors and does not compile:

auth-plug.c:102:5: error: conflicting types for 'mosquitto_auth_plugin_init'
 int mosquitto_auth_plugin_init(void **userdata, struct mosquitto_auth_opt *auth_opts, int auth_opt_count)
     ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from auth-plug.c:35:0:
../mosq/src/mosquitto_plugin.h:118:5: note: previous declaration of 'mosquitto_auth_plugin_init' was here
 int mosquitto_auth_plugin_init(void **user_data, struct mosquitto_opt *opts, int opt_count);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~
...

@ghost
Copy link

ghost commented Mar 5, 2019

Also tried to compile against 1.4.10 from Debian stretch and got following error:

CFLAGS:  -g -O2 -fdebug-prefix-map=/build/mosquitto-auth-plugin-0.1.3=. -fstack-protector-strong -Wformat -Werror=format-security  -I/src/ -I/lib/ -fPIC -Wall -Werror  -DBE_HTTP -DBE_JWT -DBE_FILES  -I/src -DDEBUG=1 -I/usr/include
LDFLAGS: -Wl,-z,relro -Wl,-z,now   -L/lib/
LDADD:    -lcurl -lcurl -L/usr/lib -lcrypto -lmosquitto

cc -g -O2 -fdebug-prefix-map=/build/mosquitto-auth-plugin-0.1.3=. -fstack-protector-strong -Wformat -Werror=format-security  -I/src/ -I/lib/ -fPIC -Wall -Werror  -DBE_HTTP -DBE_JWT -DBE_FILES  -I/src -DDEBUG=1 -I/usr/include -Wdate-time -D_FORTIFY_SOURCE=2  -c -o auth-plug.o ../auth-plug.c
../auth-plug.c:35:30: fatal error: mosquitto_broker.h: No such file or directory
 #include <mosquitto_broker.h>
                              ^
compilation terminated.
<builtin>: recipe for target 'auth-plug.o' failed
make[2]: *** [auth-plug.o] Error 1
make[2]: Leaving directory '/build/mosquitto-auth-plugin-0.1.3/build'
debian/rules:24: recipe for target 'override_dh_auto_build' failed
make[1]: *** [override_dh_auto_build] Error 2
make[1]: Leaving directory '/build/mosquitto-auth-plugin-0.1.3'
debian/rules:21: recipe for target 'build' failed
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2
I: copying local configuration
E: Failed autobuilding of package
I: unmounting dev/ptmx filesystem
I: unmounting dev/pts filesystem
I: unmounting dev/shm filesystem
I: unmounting proc filesystem
I: unmounting sys filesystem
I: cleaning the build env

@jpmens jpmens closed this as completed Mar 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants