[MDEV-15820] Backward compatibility break of mysql_config Created: 2018-04-09  Updated: 2021-05-02  Resolved: 2020-11-25

Status: Closed
Project: MariaDB Server
Component/s: Configuration
Affects Version/s: 10.2.10, 10.2.11, 10.2.12, 10.3.3, 10.3.4, 10.2.13, 10.2.14, 10.3.5
Fix Version/s: 10.2.36, 10.3.27, 10.4.17, 10.5.8

Type: Bug Priority: Major
Reporter: Pierre Cart-Grandjean Assignee: Georg Richter
Resolution: Fixed Votes: 2
Labels: Compatibility, regression

Issue Links:
Duplicate
is duplicated by MDEV-16384 Paths reported by both mariadb_config... Closed
Relates
relates to MDEV-14439 Missing library path in mariadb_config Closed

 Description   

The shell script bin/mysql_config should provide information on how MySQL/MariaDB has been deployed.
For example if you have copied the Linux binaries directly on /opt/mariadb of your system, a call to /opt/mariadb/bin/mysql_config --include will tell you that you should add -I/opt/mariadb/include/mysql -I/opt/mariadb/include/mysql/.. to any compilation that uses the MySQL/MariaDb headers.
This is now broken by MDEV-13836 and commit a75884e.
In this development it was chosen to match the outputs of mariadb_config and mysql_confg. But mariadb_config doesn't care about where the files are located. It only uses the compilation options of MariaDB. So today if you download the binary packages you will get
-I/usr/local/mysql/include/mysql -I/usr/local/mysql/include/mysql/mysql no matter where you choose to deploy MariaDB on your system.
For me, this is a major backward compatibility issue. We should revert to give the choice between mysql_config and mariadb_config with their different behavior.



 Comments   
Comment by Pali [ 2020-02-02 ]

Hello! Is there any timeline for fixing this issue? Because this issue basically prevents usage of pre-compiled MariaDB binary releases distributed via tar.gz packages. See linked issue MDEV-16384.

Comment by Daniel Black [ 2020-09-13 ]

mariadb-10.5.5 tarball

$ $HOME/Downloads/mariadb-10.5.5-linux-x86_64/bin/mysql_config 
Usage: /home/dan/Downloads/mariadb-10.5.5-linux-x86_64/bin/mysql_config [OPTIONS]
Options:
        --cflags         [-I/usr/local/mysql/include/mysql -I/usr/local/mysql/include/mysql/mysql]
        --include        [-I/usr/local/mysql/include/mysql -I/usr/local/mysql/include/mysql/mysql]
        --libs           [-L/usr/local/mysql/lib/ -lmariadb]
        --libs_r         [-L/usr/local/mysql/lib/ -lmariadb]
        --plugindir      [/usr/local/mysql/lib/plugin]
        --socket         [/tmp/mysql.sock]
        --port           [3306]
        --version        [10.5.5]
        --libmysqld-libs [-L/home/dan/Downloads/mariadb-10.5.5-linux-x86_64/lib  -lmysqld]
        --variable=VAR   VAR is one of:
                pkgincludedir [/home/dan/Downloads/mariadb-10.5.5-linux-x86_64/include/mysql]
                pkglibdir     [/home/dan/Downloads/mariadb-10.5.5-linux-x86_64/lib]
                plugindir     [/usr/local/mysql/lib/plugin]

Comparison of correct output:

mysql-8.0

$ /usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/bin/mysql_config
Usage: /usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/bin/mysql_config [OPTIONS]
Compiler: GNU 8.2.1
Options:
        --cflags         [-I/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/include ]
        --cxxflags       [-I/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/include ]
        --include        [-I/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/include]
        --libs           [-L/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/lib -Wl,-R,/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/lib -L/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/lib/private -Wl,-R,/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/lib/private -lmysqlclient -lpthread -lm -lrt -lcrypto -lssl -ldl]
        --libs_r         [-L/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/lib -Wl,-R,/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/lib -L/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/lib/private -Wl,-R,/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/lib/private -lmysqlclient -lpthread -lm -lrt -lcrypto -lssl -ldl]
        --plugindir      [/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/lib/plugin]
        --socket         [/tmp/mysql.sock]
        --port           [0]
        --version        [8.0.21]
        --variable=VAR   VAR is one of:
                pkgincludedir [/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/include]
                pkglibdir     [/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/lib]
                plugindir     [/usr/local/mysql-8.0.21-linux-glibc2.12-x86_64/lib/plugin]

mysql-5.7

$ /usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/bin/mysql_config
Usage: /usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/bin/mysql_config [OPTIONS]
Compiler: GNU 4.4.7
Options:
        --cflags         [-I/usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/include ]
        --cxxflags       [-I/usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/include ]
        --include        [-I/usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/include]
        --libs           [-L/usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/lib -lmysqlclient -lpthread -lm -lrt -ldl]
        --libs_r         [-L/usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/lib -lmysqlclient -lpthread -lm -lrt -ldl]
        --plugindir      [/usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/lib/plugin]
        --socket         [/tmp/mysql.sock]
        --port           [0]
        --version        [5.7.31]
        --libmysqld-libs [-L/usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/lib -lmysqld -lpthread -lm -lrt -ldl -lcrypt -laio -lnuma]
        --variable=VAR   VAR is one of:
                pkgincludedir [/usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/include]
                pkglibdir     [/usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/lib]
                plugindir     [/usr/local/mysql-5.7.31-linux-glibc2.12-x86_64/lib/plugin]

mysql-8.0 relocated

$ cp -a  /usr/local/mysql-8.0.21-linux-glibc2.12-x86_64 /tmp/rr8xx
 
~/repos/PHP-7.4 travis-libmysqlclient-test
$ /tmp/rr8xx/bin/mysql_config
Usage: /tmp/rr8xx/bin/mysql_config [OPTIONS]
Compiler: GNU 8.2.1
Options:
        --cflags         [-I/tmp/rr8xx/include ]
        --cxxflags       [-I/tmp/rr8xx/include ]
        --include        [-I/tmp/rr8xx/include]
        --libs           [-L/tmp/rr8xx/lib -Wl,-R,/tmp/rr8xx/lib -L/tmp/rr8xx/lib/private -Wl,-R,/tmp/rr8xx/lib/private -lmysqlclient -lpthread -lm -lrt -lcrypto -lssl -ldl]
        --libs_r         [-L/tmp/rr8xx/lib -Wl,-R,/tmp/rr8xx/lib -L/tmp/rr8xx/lib/private -Wl,-R,/tmp/rr8xx/lib/private -lmysqlclient -lpthread -lm -lrt -lcrypto -lssl -ldl]
        --plugindir      [/tmp/rr8xx/lib/plugin]
        --socket         [/tmp/mysql.sock]
        --port           [0]
        --version        [8.0.21]
        --variable=VAR   VAR is one of:
                pkgincludedir [/tmp/rr8xx/include]
                pkglibdir     [/tmp/rr8xx/lib]
                plugindir     [/tmp/rr8xx/lib/plugin]

As such use of maria mysql_config results in compile errors: https://travis-ci.org/github/grooverdan/php-src/jobs/726696489#L16040

Comment by Pierre Cart-Grandjean [ 2020-09-13 ]

I just tried again with MariaDB 10.5.5:

ubuntu@tab-pcg-ubuntu:~/downloads/mariadb-10.5.5-linux-x86_64/bin$ ./mysql_config --include
-I/usr/local/mysql/include/mysql -I/usr/local/mysql/include/mysql/mysql

This doesn't give the actual locations of the files to be included. By comparison, here is the same test with MySQL Community edition 8.0.20:

ubuntu@tab-pcg-ubuntu:~/downloads/mysql-8.0.20-linux-glibc2.12-i686/bin$ ./mysql_config --include
-I/home/ubuntu/downloads/mysql-8.0.20-linux-glibc2.12-i686/include

This ticket was created more than 2 years ago and this is still a show stopper for me to use MariaDB.

Comment by Georg Richter [ 2020-11-25 ]

This was already fixed in C/C 3.1.10 (rev. 448514a1ad79b7baac29c9d8ed158cbe8ce78ef9) and is now available in latest 10.2, 10.3, 10.4, 10.5 server versions.

Comment by Pierre Cart-Grandjean [ 2020-11-25 ]

Verified on MariaDB 10.5.8, released 11/11/2020.
Thanks!

Generated at Thu Feb 08 08:24:16 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.