[SOLVED] Compiling - error: 'MYSQL' has no member named 'reconnect'
-
@fbartels That’s correct. I’m still unable to compile after syncing the 8.4.x branch with the most recent commit, being 6b6876a971e (17.10.17)
OS:
centos-release-7-4.1708.el7.centos.x86_64DB:
MariaDB-client.x86_64 10.2.9-1.el7.centos @mariadb
MariaDB-common.x86_64 10.2.9-1.el7.centos @mariadb
MariaDB-compat.x86_64 10.2.9-1.el7.centos @mariadb
MariaDB-connect-engine.x86_64 10.2.9-1.el7.centos @mariadb
MariaDB-devel.x86_64 10.2.9-1.el7.centos @mariadb
MariaDB-server.x86_64 10.2.9-1.el7.centos @mariadbI am suspecting either reconnect isn’t properly being declared globally or its declaration is missing in KDatabase::Query
-
@wiz interesting. I just triggered a rebuild in our CentOS 7.4 build target for 8.4 and this completed without problems. I’ll check with our developers and will come back to you.
-
@fbartels said in Compiling - error: 'MYSQL' has no member named 'reconnect':
@wiz interesting. I just triggered a rebuild in our CentOS 7.4 build target for 8.4 and this completed without problems. I’ll check with our developers and will come back to you.
That’s most likely because your environment has MariaDB 10.1.28 devel installed… Let’s see.
Thanks Felix
-
Commit c79fc5ac3c14c5312a9973b73d2cd0276adc25b4 had already fixed it (since Fedora Rawhide uses MariaDB 10.2):
#ifdef HAVE_MYSQL_GET_OPTION my_bool reconn = false; if (mysql_get_option(&m_lpMySQL, MYSQL_OPT_RECONNECT, &reconn) == 0 && reconn) #else if (m_lpMySQL.reconnect) #endif
-
@jengelh Thanks but it appears Fedora Rawhide is using an updated version of mariadb-connector-c devel package with changes not released to other distributions yet.
If you try compiling on Redhat/Centos 7 with 10.2.9 devel it is guaranteed to fail with similar results on other distributions (excluding Fedora)
-
@jengelh Any update?
Thanks
-
Because MariaDB 10.2 has the mysql_get_option function, your compiler is supposed to compile the first piece of the #if…#endif block, not the second one. You may have to rerun configure.
-
@jengelh What you are seeing under Fedora and what’s actually occurring with Redhat/Centos and other distributions when trying to compile modules with MariaDB 10.2 support are 2 different outcomes/results.
All it takes is a quick google search - to see that ‘reconnect’ was somehow removed from MariaDB 10.2.6 and upwards which is why kopano is failing to compile with MariaDB 10.2.x devel. I was able to confirm this by replacing MariaDB with Mysql Community 5.7.20 devel where I had no issues compiling the same branch of kopano that was failing with MariaDB.
So please try to compile kopano yourself on the impacted platforms as most maintainers of modules that were failing to compile opted to release patches to address the ‘reconnect’ bug in MariaDB 10.2.6 and above.
-
Looking at the configure output with MariaDB 10.1/MySQL community 5.7.20
MySQL flags: -I/usr/include/mysql MySQL libs: -L/usr/lib64 -lmysqlclient -lpthread -lz -lm -ldl -lssl -lcrypto
vs MariaDB 10.2
MySQL flags: -I/usr/include/mysql MySQL libs: -L/usr/lib64 -lmariadb -lpthread -lz -ldl -lm -lssl -lcrypto
The difference is that with MariaDB 10.2, a new LGPL client library is included/used. Looking at https://jira.mariadb.org/browse/MDEV-13370, one can deduce that the reason behind ‘if (m_lpMySQL.reconnect)’ being compiled (second block) instead of ‘if (mysql_get_option(&m_lpMySQL, MYSQL_OPT_RECONNECT, &reconn) == 0 && reconn)’ (first block) which is the correct block to compile would be a fallback mechanism of not correctly identifying the database version being used…
Please share your thoughts.
Thanks
-
Quick update…
10.2.10 was just released and kopano final/stable 8.4.0 branch is still failing to compile with the same ‘reconnect’ error which points to the bug being in your source code (database.cpp) and/or configure scripts.
With mysql community 5.7/mariadb 10.1, the mysql client and mysql_config option are used and the compiling successfully completes while with mariadb 10.2, the mariadb connector 3.0.2 and mariadb_config are used but the compiling fails. I also tried compiling with mysql_config chosen/set manually - same results. I even went further and tried provisioning a clean Centos-based vm and starting afresh with only mariadb 10.2.10-devel including other soft requirements installed - no go!
I don’t understand how the final/supported 8.4.0.1540 release of kopano is running in my production env with 10.2.10 without problems :confused: … I should clearly be having db connectivity issues but I am not unless the supported releases are compiled against mysql community 5.7.x/mariadb 10.1.x … sooooo please @jengelh @fbartels, bestow upon us your knowledge (secret or voodoo - whichever helps).
MariaDB 10.2.10 --------------- [root@xn1-dev kopanocore]# mariadb_config Copyright 2011-2015 MariaDB Corporation AB Get compiler flags for using the MariaDB Connector/C. Usage: mariadb_config [OPTIONS] --cflags [-I/usr/include/mysql -I/usr/include/mysql/mysql] --include [-I/usr/include/mysql -I/usr/include/mysql/mysql] --libs [-L/usr/lib64/ -lmariadb -lnsl -lz -ldl -lm -lpthread -lssl -lcrypto] --libs_r [-L/usr/lib64/ -lmariadb -lnsl -lz -ldl -lm -lpthread -lssl -lcrypto] --libs_sys [-lnsl -lz -ldl -lm -lpthread -lssl -lcrypto] --version [10.2.10] --cc_version [3.0.2] --socket [/var/lib/mysql/mysql.sock] --port [3306] --plugindir [/usr/lib64/mysql/plugin] --tlsinfo [OpenSSL 1.0.1e] [root@xn1-dev kopanocore]# mysql_config Usage: /usr/bin/mysql_config [OPTIONS] Options: --cflags [-I/usr/include/mysql -I/usr/include/mysql/mysql] --include [-I/usr/include/mysql -I/usr/include/mysql/mysql] --libs [-L/usr/lib64/ -lmariadb -lnsl -lz -ldl -lm -lpthread -lssl -lcrypto] --libs_r [-L/usr/lib64/ -lmariadb -lnsl -lz -ldl -lm -lpthread -lssl -lcrypto] --plugindir [/usr/lib64/mysql/plugin] --socket [/var/lib/mysql/mysql.sock] --port [3306] --version [10.2.10] --libmysqld-libs [-L/usr/lib64 -lmysqld -lpthread -lz -lm -ldl -lssl -lcrypto -lcrypt -llzma -laio -lsystemd] --variable=VAR VAR is one of: pkgincludedir [/usr/include/mysql] pkglibdir [/usr/lib64] plugindir [/usr/lib64/mysql/plugin] MariaDB 10.1.28 --------------- [root@xn1-dev kopanocore]# mysql_config Usage: /usr/bin/mysql_config [OPTIONS] Options: --cflags [-I/usr/include/mysql ] --include [-I/usr/include/mysql] --libs [-L/usr/lib64 -lmysqlclient -lpthread -lz -lm -ldl -lssl -lcrypto] --libs_r [-L/usr/lib64 -lmysqlclient -lpthread -lz -lm -ldl -lssl -lcrypto] --plugindir [/usr/lib64/mysql/plugin] --socket [/var/lib/mysql/mysql.sock] --port [0] --version [10.1.28] --libmysqld-libs [-L/usr/lib64 -lmysqld -lpthread -lz -lm -ldl -lssl -lcrypto -lcrypt -llzma -laio] --variable=VAR VAR is one of: pkgincludedir [/usr/include/mysql] pkglibdir [/usr/lib64] plugindir [/usr/lib64/mysql/plugin]
-
@wiz said in Compiling - error: 'MYSQL' has no member named 'reconnect':
would be a fallback mechanism of not correctly identifying the database version being used…
We do not test for the database version, we test for whether there is a
mysql_get_option
function available (cf.configure.ac
), and if so, use it (and if not, manually access the struct).As of today, Fedora Rawhide:
[abuild@zap ~]$ rpm -qa "*maria*" mariadb-connector-c-3.0.2-11.fc28.x86_64 mariadb-connector-c-devel-3.0.2-11.fc28.x86_64 mariadb-devel-10.2.9-3.fc28.x86_64 [abuild@zap ~]$ mysql_config Copyright 2011-2015 MariaDB Corporation AB Get compiler flags for using the MariaDB Connector/C. Usage: mysql_config [OPTIONS] --cflags [-I/usr/include -I/usr/include/mysql] --include [-I/usr/include -I/usr/include/mysql] --libs [-L/usr/lib64/mariadb/ -lmariadb -lpthread -ldl -lm -lssl -lcrypto] --libs_r [-L/usr/lib64/mariadb/ -lmariadb -lpthread -ldl -lm -lssl -lcrypto] --libs_sys [-lpthread -ldl -lm -lssl -lcrypto] --version [10.2.6] --socket [/tmp/mysql.sock] --port [3306] --plugindir [/usr/lib64/mariadb/plugin] --tlsinfo [OpenSSL 1.1.0f] [abuild@zap ~]$ grep -r mysql_get_option /usr/include/mysql/ /usr/include/mysql/mysql.h: MYSQL_OPT_CONNECT_ATTRS, /* for mysql_get_optionv */ /usr/include/mysql/mysql.h:int STDCALL mysql_get_optionv(MYSQL *mysql, enum mysql_option option, void *arg, ...); /usr/include/mysql/mysql.h:int STDCALL mysql_get_option(MYSQL *mysql, enum mysql_option option, void *arg); …
-
@jengelh Eureka!! It is confirmed… Not a kopano issue at all and thank you for posting your mysql_config output.
The issue lies with Redhat/Centos MariaDB devel rpm packages, sourced from MariaDB repo, as they royally mangled up the installation/configuration of mariadb’s connector c files/paths ex-
-
Centos - /usr/lib64/mariadb is nowhere to be found so /usr/lib64/mysql is used instead seeing that mariadb_config/mysql_config reference /usr/lib64 and not /usr/lib64/mariadb which should be the correct path if the connector was installed correctly. This causes libmysqlclient to be used instead of libmariadbclient which is a no no seeing that mariadb 10.2 exclusively uses libmariadb/client.
-
Fedora appears to be using the correct paths in install.cmake and installs mariadb connector/libmariadbclient to /usr/lib64/mariadb and include files in /usr/include/mysql which is why you are not seeing this issue.
So when kopano calls mariadb_config or mysql_config in (cf.
configure.ac
) on Centos with mariadb 10.2.x-devel installed, it fumbles up and spits out the ‘reconnect’ error because the mariadb connector c isn’t properly installed by the official MariaDB rpm devel packages which is why it falls back to using the ‘reconnect’ method.Solution [Centos/Redhat]: clone master branch of mariadb-connector-c and compile/install manually then build kopano
Correct connector cmake config to use on Centos:
-- MariaDB Connector/c configuration: -- CPack generation: TGZ -- SSL support: OPENSSL Libs: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so -- Zlib support: yes (using bundled zlib) -- Installation layout: DEFAULT -- Include files will be installed in include -- Libraries will be installed in lib64/mariadb -- Binaries will be installed in bin -- Documentation included from -- Required: -- Configuring done -- Generating done which produces: [root@xn1-dev connector_c]# mariadb_config Copyright 2011-2017 MariaDB Corporation AB Get compiler flags for using the MariaDB Connector/C. Usage: mariadb_config [OPTIONS] --cflags [-I/usr/include -I/usr/include/mysql] --include [-I/usr/include -I/usr/include/mysql] --libs [-L/usr/lib64/mariadb/ -lmariadb -lnsl -ldl -lm -lpthread -lssl -lcrypto] --libs_r [-L/usr/lib64/mariadb/ -lmariadb -lnsl -ldl -lm -lpthread -lssl -lcrypto] --libs_sys [-lnsl -ldl -lm -lpthread -lssl -lcrypto] --version [10.2.9] --cc_version [3.0.3] --socket [/tmp/mysql.sock] --port [3306] --plugindir [/usr/lib64/mariadb/plugin] --tlsinfo [OpenSSL 1.0.2k]
With the bug squashed, I can now enjoy my weekend.
Thanks again
W
-