jpmens / mosquitto-auth-plug

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

Unable to make/compile Plugin for Mongo #367

Closed ayushsharma82 closed 6 years ago

ayushsharma82 commented 6 years ago

Hi Guys, First of all this is an Amazing Plugin and solves my authentication problems... I Tried making this plugin for mongo and also installed libmongoc-1.0-0 via package manager

apt-get install libmongoc-1.0-0

This is error which i get when i issue make command in mosquitto-auth-plug folder :

testuser@vultr:~/mqtt/mosquitto-auth-plug$ make
Selected backends:          MongoDB
Using mosquitto source dir: /home/testuser/mqtt/mosquitto
OpenSSL install dir:        /usr/bin

If you changed the backend selection, you might need to 'make clean' first

/bin/sh: 1: pkg-config: not found
CFLAGS:   -I/home/testuser/mqtt/mosquitto/src/ -I/home/testuser/mqtt/mosquitto/lib/ -fPIC -Wall -Werror  -DBE_MONGO  -I/usr/local/include/  -I/src -DDEBUG=1 -I/usr/bin/include
/bin/sh: 1: pkg-config: not found
LDFLAGS:    -L/usr/local/lib -L/home/testuser/mqtt/mosquitto/lib/
LDADD:    -lmongoc-1.0 -lbson-1.0 -L/usr/bin/lib -lcrypto -lmosquitto

cc  -I/home/testuser/mqtt/mosquitto/src/ -I/home/testuser/mqtt/mosquitto/lib/ -fPIC -Wall -Werror  -DBE_MONGO  -I/usr/local/include/ `pkg-config --cflags-only-I libmongoc-1.0 libbson-1.0` -I/src -DDEBUG=1 -I/usr/bin/include   -c -o auth-plug.o auth-plug.c
/bin/sh: 1: pkg-config: not found
cc  -I/home/testuser/mqtt/mosquitto/src/ -I/home/testuser/mqtt/mosquitto/lib/ -fPIC -Wall -Werror  -DBE_MONGO  -I/usr/local/include/ `pkg-config --cflags-only-I libmongoc-1.0 libbson-1.0` -I/src -DDEBUG=1 -I/usr/bin/include   -c -o base64.o base64.c
/bin/sh: 1: pkg-config: not found
cc  -I/home/testuser/mqtt/mosquitto/src/ -I/home/testuser/mqtt/mosquitto/lib/ -fPIC -Wall -Werror  -DBE_MONGO  -I/usr/local/include/ `pkg-config --cflags-only-I libmongoc-1.0 libbson-1.0` -I/src -DDEBUG=1 -I/usr/bin/include   -c -o pbkdf2-check.o pbkdf2-check.c
/bin/sh: 1: pkg-config: not found
cc  -I/home/testuser/mqtt/mosquitto/src/ -I/home/testuser/mqtt/mosquitto/lib/ -fPIC -Wall -Werror  -DBE_MONGO  -I/usr/local/include/ `pkg-config --cflags-only-I libmongoc-1.0 libbson-1.0` -I/src -DDEBUG=1 -I/usr/bin/include   -c -o log.o log.c
/bin/sh: 1: pkg-config: not found
cc  -I/home/testuser/mqtt/mosquitto/src/ -I/home/testuser/mqtt/mosquitto/lib/ -fPIC -Wall -Werror  -DBE_MONGO  -I/usr/local/include/ `pkg-config --cflags-only-I libmongoc-1.0 libbson-1.0` -I/src -DDEBUG=1 -I/usr/bin/include   -c -o envs.o envs.c
/bin/sh: 1: pkg-config: not found
cc  -I/home/testuser/mqtt/mosquitto/src/ -I/home/testuser/mqtt/mosquitto/lib/ -fPIC -Wall -Werror  -DBE_MONGO  -I/usr/local/include/ `pkg-config --cflags-only-I libmongoc-1.0 libbson-1.0` -I/src -DDEBUG=1 -I/usr/bin/include   -c -o hash.o hash.c
/bin/sh: 1: pkg-config: not found
cc  -I/home/testuser/mqtt/mosquitto/src/ -I/home/testuser/mqtt/mosquitto/lib/ -fPIC -Wall -Werror  -DBE_MONGO  -I/usr/local/include/ `pkg-config --cflags-only-I libmongoc-1.0 libbson-1.0` -I/src -DDEBUG=1 -I/usr/bin/include   -c -o be-psk.o be-psk.c
/bin/sh: 1: pkg-config: not found
cc  -I/home/testuser/mqtt/mosquitto/src/ -I/home/testuser/mqtt/mosquitto/lib/ -fPIC -Wall -Werror  -DBE_MONGO  -I/usr/local/include/ `pkg-config --cflags-only-I libmongoc-1.0 libbson-1.0` -I/src -DDEBUG=1 -I/usr/bin/include   -c -o backends.o backends.c
/bin/sh: 1: pkg-config: not found
cc  -I/home/testuser/mqtt/mosquitto/src/ -I/home/testuser/mqtt/mosquitto/lib/ -fPIC -Wall -Werror  -DBE_MONGO  -I/usr/local/include/ `pkg-config --cflags-only-I libmongoc-1.0 libbson-1.0` -I/src -DDEBUG=1 -I/usr/bin/include   -c -o cache.o cache.c
/bin/sh: 1: pkg-config: not found
cc  -I/home/testuser/mqtt/mosquitto/src/ -I/home/testuser/mqtt/mosquitto/lib/ -fPIC -Wall -Werror  -DBE_MONGO  -I/usr/local/include/ `pkg-config --cflags-only-I libmongoc-1.0 libbson-1.0` -I/src -DDEBUG=1 -I/usr/bin/include   -c -o be-mongo.o be-mongo.c
/bin/sh: 1: pkg-config: not found
be-mongo.c:14:10: fatal error: mongoc.h: No such file or directory
 #include <mongoc.h>
          ^~~~~~~~~~
compilation terminated.
<builtin>: recipe for target 'be-mongo.o' failed
make: *** [be-mongo.o] Error 1

I have Tried installing Libmongoc by both ways, from package-manager and via git clone. The Issue remains the same. Please Help.

ayushsharma82 commented 6 years ago

Solution: I was pretty dumb to not figure out fast. The Problem was that pkg-config was not installed in my Ubuntu Server.

Just install it by sudo apt-get install -y pkg-config

Plugin compiled successfully after this. Thanks again for this wonderful Repo.