Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-13836

mariadb_config & mysql_config output differ

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.2.8
    • 10.2.10
    • Server
    • None
    • Fedora - all
    • 10.2.10

    Description

      Hello,
      I'd like to get some sense out of mariadb_config & mysql_config.

      My goal is to build mariadb-server without C-library part and build CONC/C, which has all the same files.

      Because, mariadb_config is in both - server and CONC/C - I left it only in CONC/C package.
      Because most packages out there search specificaly for "mysql_config" I provide symlink "mysql_config --> mariadb_config", so other packages can be built.

      However, the "mysql_config" present in mariadb-server has different output than "mariadb_config".

      $ /usr/bin/mysql_config
      Usage: /usr/bin/mysql_config [OPTIONS]
      Options:
              --cflags         [-I/usr/include/mysql ]
              --include        [-I/usr/include/mysql]
              --libs           [-L/usr/lib64/mysql  -lmysqlclient -lpthread -lz -lm -ldl -lssl -lcrypto]
              --libs_r         [-L/usr/lib64/mysql  -lmysqlclient -lpthread -lz -lm -ldl -lssl -lcrypto]
              --plugindir      [/usr/lib64/mysql/plugin]
              --socket         [/var/lib/mysql/mysql.sock]
              --port           [0]
              --version        [10.1.26]
              --libmysqld-libs [-L/usr/lib64/mysql  -lmysqld -lpthread -lz -lm -ldl -lssl -lcrypto -lpcre -lcrypt -laio]
              --variable=VAR   VAR is one of:
                      pkgincludedir [/usr/include/mysql]
                      pkglibdir     [/usr/lib64/mysql]
                      plugindir     [/usr/lib64/mysql/plugin]
      

      $ /usr/bin/mysql_config 
      Copyright 2011-2015 MariaDB Corporation AB
      Get compiler flags for using the MariaDB Connector/C.
      Usage: /usr/bin/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]
      

      —

      Now:

      • Even though I provide CONC/C at the build "-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock", the socket points to "/tmp/mysql.sock".
      • On the other hand, the server does't get the Port number.
      • how do you point user to the server header files (newly moved to include/mysql/server) ?
      • how to point user to "--libmysqld-libs" from mariadb-config?

      I guess, you meant to use mariadb_config for client stuff and mysql_config for server stuff. But that doesn't work at all, because all project out there look directly for "mysql_config" and the patches are often non-trivial.
      I wonder, if some other distro encountered this issue.

      Attachments

        Activity

          serg Sergei Golubchik added a comment - georg could you please review this commit: https://github.com/MariaDB/mariadb-connector-c/commit/7cfe708e282ca1ef4f7e26f240422f7c3761a26f wlad could you please review these two commits: https://github.com/MariaDB/server/commit/5cbbed6e859477a27d4da3cfd8fcb5c335d6b854 and https://github.com/MariaDB/server/commit/c2a3613162d9ce4af74b15507c212f63e1d05fa6
          mschorm Michal Schorm added a comment -

          I need to use some Fedora RPM build macros.

          In latest version with the cmake options you wrote, it looks like this:

          %build
          %cmake . \
                 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
                 -DCMAKE_SYSTEM_PROCESSOR="%{_arch}" \
                 -DINSTALL_LAYOUT=RPM \
          \
                 -DMARIADB_UNIX_ADDR=/var/lib/mysql/mysql.sock \
                 -DMARIADB_PORT=3306 \
          \
                 -DWITH_EXTERNAL_ZLIB=YES \
                 -DWITH_SSL=OPENSSL \
                 -DWITH_MYSQLCOMPAT=ON \
          \
                 -DPLUGIN_INSTALL_DIR="%{_libdir}/mariadb/plugin" \
                 -DINSTALL_INCLUDEDIR=%{_includedir}/mysql
          

          That moves everything to correct destination.
          At also fixes 'mariadb_config' socket output.

          However it returns those 2 options obviously wrong:

            --cflags        [-I/usr//usr/include/mysql -I/usr//usr/include/mysql/mysql]
            --include       [-I/usr//usr/include/mysql -I/usr//usr/include/mysql/mysql]
          

          The include directory tree:

          usr
          └── include
              └── mysql
                  ├── errmsg.h
                  ├── ma_list.h
                  ├── ma_pvio.h
                  ├── mariadb
                  │   └── ma_io.h
                  ├── mariadb_com.h
                  ├── mariadb_ctype.h
                  ├── mariadb_dyncol.h
                  ├── mariadb_stmt.h
                  ├── mariadb_version.h
                  ├── ma_tls.h
                  ├── mysql
                  │   ├── client_plugin.h
                  │   ├── plugin_auth_common.h
                  │   └── plugin_auth.h
                  ├── mysqld_error.h
                  └── mysql.h
          

          —

          In this comment I talk only about CONC/C and its last release on https://downloads.mariadb.org/.
          (Should I try your GitHub content instead?)

          mschorm Michal Schorm added a comment - I need to use some Fedora RPM build macros. In latest version with the cmake options you wrote, it looks like this: %build %cmake . \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_SYSTEM_PROCESSOR= "%{_arch}" \ -DINSTALL_LAYOUT=RPM \ \ -DMARIADB_UNIX_ADDR= /var/lib/mysql/mysql .sock \ -DMARIADB_PORT=3306 \ \ -DWITH_EXTERNAL_ZLIB=YES \ -DWITH_SSL=OPENSSL \ -DWITH_MYSQLCOMPAT=ON \ \ -DPLUGIN_INSTALL_DIR= "%{_libdir}/mariadb/plugin" \ -DINSTALL_INCLUDEDIR=%{_includedir} /mysql That moves everything to correct destination. At also fixes 'mariadb_config' socket output. However it returns those 2 options obviously wrong: --cflags [-I /usr//usr/include/mysql -I /usr//usr/include/mysql/mysql ] --include [-I /usr//usr/include/mysql -I /usr//usr/include/mysql/mysql ] The include directory tree: usr └── include └── mysql ├── errmsg.h ├── ma_list.h ├── ma_pvio.h ├── mariadb │ └── ma_io.h ├── mariadb_com.h ├── mariadb_ctype.h ├── mariadb_dyncol.h ├── mariadb_stmt.h ├── mariadb_version.h ├── ma_tls.h ├── mysql │ ├── client_plugin.h │ ├── plugin_auth_common.h │ └── plugin_auth.h ├── mysqld_error.h └── mysql.h — In this comment I talk only about CONC/C and its last release on https://downloads.mariadb.org/ . (Should I try your GitHub content instead?)

          mariadb_config treats INSTALL_INCLUDEDIR as relative to basedir (/usr).

          I'd agree that it should support absolute paths too, but we probably won't be able to fix it in time for 10.2.10.

          Could you specify -DINSTALL_INCLUDEDIR=include/mysql ?

          serg Sergei Golubchik added a comment - mariadb_config treats INSTALL_INCLUDEDIR as relative to basedir ( /usr ). I'd agree that it should support absolute paths too, but we probably won't be able to fix it in time for 10.2.10. Could you specify -DINSTALL_INCLUDEDIR=include/mysql ?
          mschorm Michal Schorm added a comment -

          The option to specify absolute path would be highly welcomed.
          In Fedora RPM build process it is ideal to use, since nearly every path contains one or more macros, that has different paths for different architectures etc.

          I'm currently investigating another issue (this time only on Fedora side) where I hit this "-I/usr//usr/include/mysql/mysql" hard, so I actually patched it for my purposes (but most likely it cannot be used for everyone):

          --- mariadb-connector-c-3.0.2-src/mariadb_config/mariadb_config.c.in    2017-07-19 11:31:02.000000000 +0200
          +++ mariadb-connector-c-3.0.2-src/mariadb_config/mariadb_config.c.in_patched    2017-10-25 12:32:42.075324299 +0200
          @@ -5,8 +5,8 @@
           
           static char *mariadb_progname;
           
          -#define INCLUDE "-I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@ -I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@/mysql"
          -#define LIBS    "-L@CMAKE_INSTALL_PREFIX@/@INSTALL_LIBDIR@/ -lmariadb "\
          +#define INCLUDE "-I@INSTALL_INCLUDEDIR@ -I@INSTALL_INCLUDEDIR@"
          +#define LIBS    "-L@INSTALL_LIBDIR@/ -lmariadb "\
                           "@extra_dynamic_LDFLAGS@"
           #define LIBS_SYS "@extra_dynamic_LDFLAGS@"
           #define CFLAGS  INCLUDE
          

          While having following CMAKE options:

                 -DINSTALL_LAYOUT=RPM \
                 -DINSTALL_BINDIR="%{_bindir}" \
                 -DINSTALL_LIBDIR="%{_libdir}" \
                 -DINSTALL_INCLUDEDIR=%{_includedir}/mysql \
                 -DPLUGIN_INSTALL_DIR="%{_libdir}/mariadb/plugin"
          

          The " -DCMAKE_INSTALL_PREFIX", if used, breaks other stuff for me (moving files to wrong locations), so I'm ommiting it.

          mschorm Michal Schorm added a comment - The option to specify absolute path would be highly welcomed. In Fedora RPM build process it is ideal to use, since nearly every path contains one or more macros, that has different paths for different architectures etc. I'm currently investigating another issue (this time only on Fedora side) where I hit this "-I/usr//usr/include/mysql/mysql" hard, so I actually patched it for my purposes (but most likely it cannot be used for everyone): --- mariadb-connector-c-3.0.2-src/mariadb_config/mariadb_config.c.in 2017-07-19 11:31:02.000000000 +0200 +++ mariadb-connector-c-3.0.2-src/mariadb_config/mariadb_config.c.in_patched 2017-10-25 12:32:42.075324299 +0200 @@ -5,8 +5,8 @@ static char *mariadb_progname; -#define INCLUDE "-I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@ -I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@/mysql" -#define LIBS "-L@CMAKE_INSTALL_PREFIX@/@INSTALL_LIBDIR@/ -lmariadb "\ +#define INCLUDE "-I@INSTALL_INCLUDEDIR@ -I@INSTALL_INCLUDEDIR@" +#define LIBS "-L@INSTALL_LIBDIR@/ -lmariadb "\ "@extra_dynamic_LDFLAGS@" #define LIBS_SYS "@extra_dynamic_LDFLAGS@" #define CFLAGS INCLUDE While having following CMAKE options: -DINSTALL_LAYOUT=RPM \ -DINSTALL_BINDIR= "%{_bindir}" \ -DINSTALL_LIBDIR= "%{_libdir}" \ -DINSTALL_INCLUDEDIR=%{_includedir} /mysql \ -DPLUGIN_INSTALL_DIR= "%{_libdir}/mariadb/plugin" The " -DCMAKE_INSTALL_PREFIX", if used, breaks other stuff for me (moving files to wrong locations), so I'm ommiting it.

          INCLUDE_DIR issue is reported as CONC-291

          serg Sergei Golubchik added a comment - INCLUDE_DIR issue is reported as CONC-291

          People

            serg Sergei Golubchik
            mschorm Michal Schorm
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.