[ZBX-12232] "configure" fails with MariaDB Connector/C Created: 2017 May 29 Updated: 2024 Apr 10 Resolved: 2017 Nov 24 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Installation (I) |
Affects Version/s: | 3.0.10rc1 |
Fix Version/s: | 3.0.14rc1, 3.4.5rc1, 4.0.0alpha1, 4.0 (plan) |
Type: | Problem report | Priority: | Trivial |
Reporter: | Andris Mednis | Assignee: | Andrea Biscuola (Inactive) |
Resolution: | Fixed | Votes: | 2 |
Labels: | compilation, configure, mariadb | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Debian GNU/Linux 9 (testing) |
Attachments: |
![]() ![]() ![]() |
Team: | |
Sprint: | Sprint 19, Sprint 20, Sprint 21 |
Story Points: | 0.25 |
Description |
Zabbix v3.0.10rc1 - with MariaDB and MariaDB Connector/C "configure" fails as follows: checking for mysql_config... /usr/bin/mysql_config checking for main in -l... no configure: error: Not found mysqlclient library Debian/testing has Installed libraries: $ find /usr/lib -name '*mysql*' ... /usr/lib/x86_64-linux-gnu/libmysqlclient_r.so /usr/lib/x86_64-linux-gnu/libmysqlclient.so ... /usr/lib/x86_64-linux-gnu/libmysqlclient_r.a ... /usr/lib/x86_64-linux-gnu/libmysqlclient.a ... $ find /usr/lib -name '*mariadb*' /usr/lib/x86_64-linux-gnu/libmariadb.a /usr/lib/x86_64-linux-gnu/libmariadbclient.so.18 <---- Symlink to libmariadbclient.so.18.0.0 /usr/lib/x86_64-linux-gnu/libmariadb.so.2 /usr/lib/x86_64-linux-gnu/mariadb18 /usr/lib/x86_64-linux-gnu/mariadb /usr/lib/x86_64-linux-gnu/libmariadbclient.so.18.0.0 /usr/lib/x86_64-linux-gnu/libmariadb.so <---- Symlink to libmariadb.so.2 This fix helps: Index: m4/ax_lib_mysql.m4 =================================================================== --- m4/ax_lib_mysql.m4 (revision 68585) +++ m4/ax_lib_mysql.m4 (working copy) @@ -93,11 +93,13 @@ ;; -lperconaserverclient) _client_lib_name="perconaserverclient" - ;; -lmariadbclient) _client_lib_name="mariadbclient" ;; + -lmariadb) + _client_lib_name="mariadb" + ;; -L*) MYSQL_LDFLAGS="${MYSQL_LDFLAGS} $i" ;; @@ -107,7 +109,7 @@ if test "x$enable_static" = "xyes"; then for i in $_full_libmysql_libs; do case $i in - -lmysqlclient|-lperconaserverclient|-lmariadbclient) + -lmysqlclient|-lperconaserverclient|-lmariadbclient|-lmariadb) ;; -l*) _lib_name="`echo "$i" | cut -b3-`" |
Comments |
Comment by Andris Mednis [ 2017 May 29 ] |
Similar error was fixed in |
Comment by Andrey Melnikov [ 2017 May 29 ] |
I think - better get rid of this guessing library name at all. |
Comment by Andris Mednis [ 2017 May 29 ] |
Thanks, Andrey, for contribution |
Comment by Andrey Melnikov [ 2017 Jun 19 ] |
Updated patch - new mariadb package carry mariadb_config instead of mysql_config so check it too. |
Comment by Adam Williamson [ 2017 Jul 13 ] |
This doesn't really work right. It assumes the last item in the output of mysql_config is the mysql/mariadb library, but this is not always the case, viz on Fedora Rawhide: <mock-chroot> sh-4.4# mysql_config --libs so it winds up with `MYSQL_LIBS` as `-lcrypto`, and of course compilation fails. Why are you doing all this splitting up and parsing and checking of the `mysql_config` output at all? Why not just trust the values it provides and use them unaltered? Even when this 'works', it will throw away `-lz -lpthread -ldl -lm -lssl -lcrypto` and only take `-lmariadb`, which doesn't seem right. |
Comment by Adam Williamson [ 2017 Jul 13 ] |
Oh, I see. This is trying to avoid overlinking. But yes, it doesn't really work right... |
Comment by Andrey Melnikov [ 2017 Jul 14 ] |
v3 patch. |
Comment by Adam Williamson [ 2017 Jul 14 ] |
Here's an alternative patch; this works at least for me, with the recent MariaDB 10.2 with `-lmariadb`. |
Comment by Andrey Melnikov [ 2017 Jul 14 ] |
Attached right patch for now |
Comment by Adam Williamson [ 2017 Jul 14 ] |
Isn't the static branch in your v3 patch wrong? I think you meant to use a different variable than _client_lib_name there, presumably _full_libmysql_libs ? |
Comment by Adam Williamson [ 2017 Jul 14 ] |
Well, the patch has other problems, too. The new AC_CHECK_LIB test won't work properly in all cases, because it doesn't use the correct LDFLAGS (so on Fedora, where libmariadb is in /usr/lib/mariadb , the test fails even for `-lmariadb`, because it can't find it). And there's at least one other reason why your version can't possibly wind up setting the correct libs for a static compile... |
Comment by Andrey Melnikov [ 2017 Jul 14 ] |
Provide full output of `mysql_config`. Static link with mysql is a pain. It's possible to write correct m4 for all variants but it take some time. |
Comment by Adam Williamson [ 2017 Jul 14 ] |
Here's my latest effort at a patch, which I think should handle things better. I certainly can't test all cases here, though, all I can say for sure is this builds successfully non-statically with MariaDB 10.2 on Fedora Rawhide. Haven't tried building against older MariaDB or MySQL or building statically. |
Comment by Adam Williamson [ 2017 Jul 14 ] |
The `mysql_config` output on Fedora Rawhide looks like this: <mock-chroot> sh-4.4# mysql_config Usage: /usr/bin/mysql_config-64 [OPTIONS] Options: --cflags [-I/usr/include/mysql ] --include [-I/usr/include/mysql] --libs [-L/usr/lib64/mysql -lmariadb -lpthread -lz -ldl -lm -lssl -lcrypto] --libs_r [-L/usr/lib64/mysql -lmariadb -lpthread -lz -ldl -lm -lssl -lcrypto] --plugindir [/usr/lib64/mysql/plugin] --socket [/var/lib/mysql/mysql.sock] --port [0] --version [10.2.7] --libmysqld-libs [-L/usr/lib64/mysql -lmysqld -lpthread -lz -lm -ldl -lssl -lcrypto -lpcre -lcrypt -laio -lsystemd] --variable=VAR VAR is one of: pkgincludedir [/usr/include/mysql] pkglibdir [/usr/lib64/mysql] plugindir [/usr/lib64/mysql/plugin] So, with your patch, think what happens in that first loop through $_full_libmysql_libs . The first thing we see is -L/usr/lib64/mysql , which is duly appended to MYSQL_LDFLAGS , okay. But we're not actually using the contents of MYSQL_LDFLAGS as our LDFLAGS value as we iterate through the loop; we only backup LDFLAGS and do: LDFLAGS="${LDFLAGS} ${MYSQL_LDFLAGS}" AFTER this loop is complete. So next in the loop we see -lmariadb , and the loop tries to do AC_CHECK_LIB(mariadb, mysql_error) - but that will fail, even though it should succeed, because we haven't updated LDFLAGS yet, so that compile check will not use `-L/usr/lib64/mysql` and so will not be able to find the library. |
Comment by Andrey Melnikov [ 2017 Jul 14 ] |
Your variant is much better. I'm slightly update it to reflect our mariadb packages configuration. Also, I'm use debian packages from mariadb.org and with it is impossible to compile zabbix in static variant with mariadb. |
Comment by Adam Williamson [ 2017 Jul 14 ] |
Thanks. BTW, it'd sure be nice if you folks could decide on spaces or tabs for that file. |
Comment by Danilo G. Baio [ 2017 Aug 30 ] |
I've tried this patch in FreeBSD, but still not finding mysqlclient library. [...] checking size of void *... 8 checking for mysql_config... /usr/local/bin/mysql_config checking for main in -l... no configure: error: Not found mysqlclient library $ mysql_config --libs -L/usr/local/lib/mysql -lmariadb -pthread -lz -lpthread -lm -liconv -lssl -lcrypto -L/usr/local/lib $ mysql_config Usage: /usr/local/bin/mysql_config [OPTIONS] Options: --cflags [-I/usr/local/include/mysql -I/usr/local/include/mysql/.. ] --include [-I/usr/local/include/mysql -I/usr/local/include/mysql/..] --libs [-L/usr/local/lib/mysql -lmariadb -pthread -lz -lpthread -lm -liconv -lssl -lcrypto -L/usr/local/lib ] --libs_r [-L/usr/local/lib/mysql -lmariadb -pthread -lz -lpthread -lm -liconv -lssl -lcrypto -L/usr/local/lib ] --plugindir [/usr/local/lib/mysql/plugin] --socket [/tmp/mysql.sock] --port [0] --version [10.2.7] --libmysqld-libs [-L/usr/local/lib/mysql -lmysqld -L/usr/local/lib ] --variable=VAR VAR is one of: pkgincludedir [/usr/local/include/mysql] pkglibdir [/usr/local/lib/mysql] plugindir [/usr/local/lib/mysql/plugin] |
Comment by Andrey Melnikov [ 2017 Aug 30 ] |
checking for main in -l... no Patched version search mysql_error() function, your log show searching main() function. You don't run autoreconf after patch ? |
Comment by Danilo G. Baio [ 2017 Sep 02 ] |
I did not. checking for mysql_config... /usr/local/bin/mysql_config checking for mysql_error in -lmariadb... yes checking for mysql_error in -lz... no checking for mysql_error in -lpthread... no checking for mysql_error in -lm... no checking for mysql_error in -liconv... no checking for mysql_error in -lssl... no checking for mysql_error in -lcrypto... no |
Comment by Ari Maniatis [ 2017 Sep 02 ] |
I was unable to get it to work (FreeBSD 11.0, poudriere to build ports). Would you mind sharing the patch file you used to get this to work (preferably in FreeBSD ports patch format)? |
Comment by Danilo G. Baio [ 2017 Sep 02 ] |
Sure, it's here: |
Comment by Ari Maniatis [ 2017 Sep 03 ] |
@bdaio Thanks for that. I see that the autoreconf in the USES flag is the trick I needed. Will you submit this patch to the port maintainer? |
Comment by Ari Maniatis [ 2017 Sep 04 ] |
@bdaio Just a note that your patch didn't apply cleanly to zabbix32-server, but it did work just fine against zabbix34-server with a tweak to PORTREVISION. Perhaps that's enough anyway. We'll need something similar for zabbix34-proxy. However when I try to run the patched zabbix server I get this error: 17858:20170904:121856.342 using configuration file: /usr/local/etc/zabbix34/zabbix_server.conf 17858:20170904:121856.357 current database version (mandatory/optional): 03040000/03040000 17858:20170904:121856.357 required mandatory version: 03040000 17858:20170904:121856.764 Got signal [signal:11(SIGSEGV),reason:1,refaddr:0x0]. Crashing ... 17858:20170904:121856.764 ====== Fatal information: ====== 17858:20170904:121856.764 program counter not available for this architecture 17858:20170904:121856.764 === Registers: === 17858:20170904:121856.764 register dump not available for this architecture 17858:20170904:121856.764 === Backtrace: === 17858:20170904:121856.764 9: 0x494c8b <zbx_set_common_signal_handlers+667> at /usr/local/sbin/zabbix_server 17858:20170904:121856.764 8: 0x803cf779d <pthread_sigmask+1293> at /lib/libthr.so.3 17858:20170904:121856.765 7: 0x803cf6d6f <pthread_getspecific+3743> at /lib/libthr.so.3 17858:20170904:121856.765 6: 0x7ffffffff003 17858:20170904:121856.765 5: 0x488fff <zbx_dbsync_compare_action_ops+191> at /usr/local/sbin/zabbix_server 17858:20170904:121856.765 4: 0x474a8a <DCsync_configuration+14810> at /usr/local/sbin/zabbix_server 17858:20170904:121856.765 3: 0x4237fc <MAIN_ZABBIX_ENTRY+604> at /usr/local/sbin/zabbix_server 17858:20170904:121856.765 2: 0x493dc5 <daemon_start+437> at /usr/local/sbin/zabbix_server 17858:20170904:121856.765 1: 0x4234d7 <main+1255> at /usr/local/sbin/zabbix_server 17858:20170904:121856.765 0: 0x41b03f <_start+383> at /usr/local/sbin/zabbix_server 17858:20170904:121856.765 === Memory map: === 17858:20170904:121856.765 memory map not available for this platform 17858:20170904:121856.765 ================================ |
Comment by Ari Maniatis [ 2017 Sep 04 ] |
Well, strike that previous comment. Zabbix 3.4.1 just hit FreeBSD ports and that one fixes the problem above. So, against 3.4.1, the patch worked perfectly other than the diff having an issue with the PORTREVISION line which is easily fixed. I've not got this running in production against MariaDB 10.2 on FreeBSD 11.0 collecting 36 values per second without any issue. |
Comment by Andrea Biscuola (Inactive) [ 2017 Nov 01 ] |
Fixed in svn://svn.zabbix.com/branches/dev/ZBX-12232 Simplified the checks for the mysql and mariadb libraries. Added |
Comment by Andrey Melnikov [ 2017 Nov 01 ] |
Remove Check if required version of MySQL is available code too - it never used. And check mysql_error() function inside AC_CHECK_LIB($_lib_name, main, [ ..... - library not contain main() function. |
Comment by Andrea Biscuola (Inactive) [ 2017 Nov 01 ] |
To be fair, when I started to work on it, I suspected the majority |
Comment by Andrea Biscuola (Inactive) [ 2017 Nov 01 ] |
A note: If you are installing the mariadb/c connector from source. it |
Comment by Andrey Melnikov [ 2017 Nov 01 ] |
-static ?? really?? Ok, if you want to compile zabbix statically: And after that you hit the wall - openipmi|net-snmp|ssh2|curl libraries bundled with GnuTLS, GnuTLS itself want gmp, nettle, p11-kit. Debian/Ubuntu not ships libp11-kit.a. Successfully build server with mysql. But for what? ping, external scripts and nothing? Forget about static linkning. |
Comment by Andrea Biscuola (Inactive) [ 2017 Nov 01 ] |
Yes, I know what you mean In theory we support building zabbix statically, but I think it's kinda broken. |
Comment by Andrea Biscuola (Inactive) [ 2017 Nov 23 ] |
Released in:
|
Comment by Andrey Melnikov [ 2017 Nov 23 ] |
Err. Still checking main().. Did you read comments for this bug? |
Comment by Andrea Biscuola (Inactive) [ 2017 Nov 23 ] |
Yes I read the comment, actually I kept the "wrong" behaviour on |
Comment by Tao Zhou [ 2018 Feb 27 ] |
Hi @Danilo, svn-patch-zabbix32-server-mariadb.patch I manually merged this patch to zabbix-3.4.7 and it worked. |
Comment by Tao Zhou [ 2018 Feb 27 ] |
This patch worked for me. |
Comment by Stepan [ 2018 Jun 17 ] |
CentOS 7.3 MariaDB 10.1.33-1.el7.centos pre-zabbix-3.4.11rc1-81960 The same symptoms
|