Построение плагина Mosquitto MQTT auth
Мне нужен продвинутый аутентификатор для Mosquitto. Я решил использовать Mosquitto-Auth-Plug
Однако, если я буду следовать инструкциям по сборке, у меня будет ошибка:
$ make
Selected backends: JWT
Using mosquitto source dir: /mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15
OpenSSL install dir:
If you changed the backend selection, you might need to 'make clean' first
CFLAGS: -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include
LDFLAGS: -L/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/
LDADD: -lcurl -L/lib -lcrypto -lmosquitto
cc -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include -c -o auth-plug.o auth-plug.c
cc -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include -c -o base64.o base64.c
cc -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include -c -o pbkdf2-check.o pbkdf2-check.c
cc -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include -c -o log.o log.c
cc -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include -c -o envs.o envs.c
cc -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include -c -o hash.o hash.c
cc -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include -c -o be-psk.o be-psk.c
cc -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include -c -o backends.o backends.c
cc -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include -c -o cache.o cache.c
cc -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include -c -o be-jwt.o be-jwt.c
cc -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/src/ -I/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -Wall -Werror -DBE_JWT -I/src -DDEBUG=1 -I/include -L/mnt/c/Users/avkar/cleversky/mosquitto/mosquitto-1.4.15/lib/ -fPIC -shared -o auth-plug.so auth-plug.o base64.o pbkdf2-check.o log.o envs.o hash.o be-psk.o backends.o cache.o be-jwt.o -lcurl -L/lib -lcrypto -lmosquitto
/usr/bin/ld: cannot find -lmosquitto
collect2: error: ld returned 1 exit status
Makefile:160: recipe for target 'auth-plug.so' failed
make: *** [auth-plug.so] Error 1
В некотором роде -lmosquitto
не найдено. Я предположил, что это библиотека, но присутствуют все библиотеки:
$ ls ../mosquitto-1.4.15/lib/
CMakeLists.txt logging_mosq.c memory_mosq.h mosquitto.h net_mosq.h read_handle_shared.c socks_mosq.c time_mosq.c util_mosq.c
cpp logging_mosq.h messages_mosq.c mosquitto_internal.h read_handle.c send_client_mosq.c socks_mosq.h time_mosq.h util_mosq.h
dummypthread.h Makefile messages_mosq.h mqtt3_protocol.h read_handle_client.c send_mosq.c srv_mosq.c tls_mosq.c will_mosq.c
linker.version memory_mosq.c mosquitto.c net_mosq.c read_handle.h send_mosq.h thread_mosq.c tls_mosq.h will_mosq.h
Что -lmosquitto
и как я могу исправить мою сборку?
1 ответ
Решение
Как выяснилось в комментариях,
Вам нужно собрать и установить mosquitto (или установить предварительно собранную версию и ее пакет разработчика), прежде чем пытаться собрать плагин.
Ошибка в том, что ld не может найти libmosquitto для ссылки