jpmens / mosquitto-auth-plug

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

Mariadb Make failure #377

Closed ditocruz closed 6 years ago

ditocruz commented 6 years ago

hi, Im using centos 7 and have Mariadb, when do the "make" command I get this failure: adding different logs: LOG1: [root@flyvemdm mosquitto-auth-plug]# make Selected backends: MySQL Using mosquitto source dir: OpenSSL install dir: /usr

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

CFLAGS: -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL -I/usr/include/mysql -I/usr/include/mysql/mysql -I/src -DDEBUG=1 -I/usr/include LDFLAGS: -L/lib/ LDADD: -L/usr/lib64/ -lmariadb -lz -ldl -lm -lpthread -lssl -lcrypto -L/usr/lib -lcrypto -lmosquitto

cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -c -o auth-plug.o auth-plug.c cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -c -o base64.o base64.c cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -c -o pbkdf2-check.o pbkdf2-check.c cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -c -o log.o log.c cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -c -o envs.o envs.c cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -c -o hash.o hash.c cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -c -o be-psk.o be-psk.c cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -c -o backends.o backends.c cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -c -o cache.o cache.c cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -c -o be-mysql.o be-mysql.c cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -L/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-mysql.o mysql_config --libs -L/usr/lib -lcrypto -lmosquitto /usr/bin/ld: no se puede encontrar -lmariadb collect2: error: ld devolvió el estado de salida 1 make: *** [auth-plug.so] Error 1

LOG2: Se terminaron las dependencias del archivo objetivo auth-plug.so'. Se debe reconstruir el objetivoauth-plug.so'. Invoking recipe from Makefile:160 to update target auth-plug.so'. cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQLmysql_config --cflags-I/src -DDEBUG=1 -I/usr/include -L/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-mysql.omysql_config --libs` -L/usr/lib -lcrypto -lmosquitto Putting child 0x71c730 (auth-plug.so) PID 2288 on the chain. Live child 0x71c730 (auth-plug.so) PID 2288 /usr/bin/ld: no se puede encontrar -lmariadb collect2: error: ld devolvió el estado de salida 1 Reaping losing child 0x71c730 PID 2288 make: *** [auth-plug.so] Error 1 Removing child 0x71c730 PID 2288 from chain.

LOG3: This is my mysql_conf libs: [root@flyvemdm mosquitto-auth-plug]# mysql_config --libs -L/usr/lib64/ -lmariadb -lz -ldl -lm -lpthread -lssl -lcrypto

LOGS4: I also try adding -lmariadb to the libs in "cc": [root@flyvemdm mosquitto-auth-plug]# cc -I/src/ -I/lib/ -fPIC -Wall -Werror -DBE_MYSQL mysql_config --cflags -I/src -DDEBUG=1 -I/usr/include -L/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-mysql.o mysql_config --libs -L/usr/lib -lcrypto -lmosquitto -lmariadb /usr/bin/ld: no se puede encontrar -lmariadb collect2: error: ld devolvió el estado de salida 1

LOGS5: And without it:

[root@flyvemdm mosquitto-auth-plug]# cc  -I/src/ -I/lib/ -fPIC -Wall -Werror  -DBE_MYSQL  `mysql_config --cflags` -I/src -DDEBUG=1 -I/usr/include   -L/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-mysql.o   `mysql_config --libs` -L/usr/lib -lcrypto -lmosquitto 
/usr/bin/ld: no se puede encontrar -lmariadb
collect2: error: ld devolvió el estado de salida 1
jpmens commented 6 years ago

I'm sure you know that "no se puede encontrar" means "cannot find" :-)

The linker cannot find the required library for linking with -lmariadb; this typically means either the path you've specified is incorrect or the libraries are not installed. Verify you've got the -devel package installed for MariaDB.

also kindly format code and terminal output between code fences in Github issues; compare with my editing of your last LOG5.

ditocruz commented 6 years ago

Hi, i have the Mariadb-devel, but the issue is the same:

[root@flyvemdm mosquitto-auth-plug]# yum install mariadb-devel
Complementos cargados:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.gadix.com
 * epel: mirror.airenetworks.es
 * extras: mirror.gadix.com
 * remi-php56: mir01.syntis.net
 * remi-php72: mir01.syntis.net
 * remi-safe: mir01.syntis.net
 * updates: mirror.gadix.com
El paquete 1:mariadb-devel-5.5.60-1.el7_5.x86_64 se hace obsoleto con MariaDB-devel-10.3.10-1.el7.centos.x86_64, que ya se encuentra instalado
Nada para hacer
[root@flyvemdm mosquitto-auth-plug]# make
Selected backends:          MySQL
Using mosquitto source dir: 
OpenSSL install dir:        /usr

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

CFLAGS:   -I/src/ -I/lib/ -fPIC -Wall -Werror  -DBE_MYSQL  -I/usr/include/mysql -I/usr/include/mysql/mysql -I/src -DDEBUG=1 -I/usr/include
LDFLAGS:   -L/lib/
LDADD:    -L/usr/lib64/ -lmariadb -lz -ldl -lm -lpthread -lssl -lcrypto -L/usr/lib -lcrypto -lmosquitto

cc  -I/src/ -I/lib/ -fPIC -Wall -Werror  -DBE_MYSQL  `mysql_config --cflags` -I/src -DDEBUG=1 -I/usr/include   -L/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-mysql.o   `mysql_config --libs` -L/usr/lib -lcrypto -lmosquitto
/usr/bin/ld: no se puede encontrar -lmariadb
collect2: error: ld devolvió el estado de salida 1
make: *** [auth-plug.so] Error 1
jpmens commented 6 years ago

Please study this message:

no se puede encontrar -lmariadb

and try to:

  1. find the file called libmariadb.a
  2. locate the path to it
  3. amend your Makefile accordingly.
ditocruz commented 6 years ago

I solved it by myself , the solution was installing: MariaDB-shared

thanks

pheonics commented 5 years ago

thank you very very much @jpmens i got stuck with this for a week with all the cheating i can imagine.