jpmens / mosquitto-auth-plug

Authentication plugin for Mosquitto with multiple back-ends (MySQL, Redis, CDB, SQLite3)
Other
824 stars 496 forks source link

Build failed with `/usr/bin/ld: cannot find -lmosquitto` #359

Closed akarasev closed 6 years ago

akarasev commented 6 years ago

JP Mens, awesome job! Could you please help me with the issue.

Following build instructions I try to build code from master branch, but I have the following:

$ 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

Somewhat -lmosquitto not found. I have assumed that is a library, but all librares present:

$ 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

What is the -lmosquitto and how can I fix my build?

akarasev commented 6 years ago

Resolved here: https://stackoverflow.com/questions/51530651/building-mosquitto-mqtt-auth-plugin-issue