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

mysql_config mariadb_config lists non existant -lmariadb

Details

    Description

        --libs          [-L/usr/lib64/ -lmariadb]
        --libs_r        [-L/usr/lib64/ -lmariadb]
      

      There is no mariadb library!!

      The code I'm trying to build should be using -lmysqlclient but it's getting messed up flags from your build.

      # rpm -qi MariaDB-devel
      Name        : MariaDB-devel
      Version     : 10.5.13
      Release     : 1.el7.centos
      Architecture: x86_64
      Install Date: Mon 22 Nov 2021 11:24:01 AM PST
      Group       : Applications/Databases
      Size        : 57493407
      License     : GPLv2
      Signature   : DSA/SHA1, Sat 06 Nov 2021 02:36:23 PM PDT, Key ID cbcb082a1bb943db
      Source RPM  : MariaDB-devel-10.5.13-1.el7.centos.src.rpm
      Build Date  : Fri 05 Nov 2021 02:11:59 PM PDT
      Build Host  : centos74-amd64
      Relocations : (not relocatable)
      Vendor      : MariaDB Foundation
      URL         : http://mariadb.org
      

      # mariadb_config 
      Copyright 2011-2020 MariaDB Corporation AB
      Get compiler flags for using the MariaDB Connector/C.
      Usage: mariadb_config [OPTIONS]
      Compiler: GNU 4.8.5
        --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]
        --libs_r        [-L/usr/lib64/ -lmariadb]
        --libs_sys      [-ldl -lm -lpthread -lssl -lcrypto]
        --version       [10.5.13]
        --cc_version    [3.1.15]
        --socket        [/var/lib/mysql/mysql.sock]
        --port          [3306]
        --plugindir     [/usr/lib64/mysql/plugin]
        --tlsinfo       [OpenSSL 1.0.2k]
        --variable=VAR  VAR is one of:
            pkgincludedir  [/usr/include/mysql]
            pkglibdir      [/usr/lib64]
            pkgplugindir   [/usr/lib64/mysql/plugin]
      

      same thing on centos 8

      [root@c8test ~]# rpm -qi MariaDB-devel
      Name        : MariaDB-devel
      Version     : 10.5.13
      Release     : 1.el8
      Architecture: x86_64
      Install Date: Mon 22 Nov 2021 12:34:36 PM PST
      Group       : Applications/Databases
      Size        : 50887117
      License     : GPLv2
      Signature   : DSA/SHA1, Sat 06 Nov 2021 02:29:29 PM PDT, Key ID cbcb082a1bb943db
      Source RPM  : MariaDB-devel-10.5.13-1.el8.src.rpm
      Build Date  : Fri 05 Nov 2021 01:50:56 PM PDT
      Build Host  : rhel8-amd64
      Relocations : (not relocatable)
      Vendor      : MariaDB Foundation
      URL         : http://mariadb.org
      

      and yes, if I use the command "correctly" I still get the wrong answers

      [root@sup /home/virtuals/html]#  /usr/bin/mysql_config  --libs
      -L/usr/lib64/ -lmariadb
      [root@sup /home/virtuals/html]#  /usr/bin/mariadb_config  --libs
      -L/usr/lib64/ -lmariadb
       
       
      [root@sup /home/virtuals/html]# rpm -ql MariaDB-devel | grep \.a$
      /usr/include/mysql/server/private/data
      /usr/lib64/libmariadbclient.a
      /usr/lib64/libmariadbd.a
      /usr/lib64/libmysqlclient.a
      /usr/lib64/libmysqlclient_r.a
      /usr/lib64/libmysqld.a
      /usr/lib64/libmysqlservices.a
      [root@sup /home/virtuals/html]# rpm -ql MariaDB-devel | grep \.so$
      /usr/lib64/libmysqlclient.so
      /usr/lib64/libmysqlclient_r.so
      

      there's a libmariadbd.a ... with a trailing d suffix, but no mariadb and definitely no libmariadb.so

      I'm no developer. Maybe I'm doing something stupid. I'm just a sysadmin who has to maintain a pile of packages for a number of versions of centos. Mock is usually a good help for this, but it's going to make working around this bug quite ugly as you don't usually have root perms in a mock environment, and it's someone else's 60,000 line configure script that's getting tripped up.

      Anyhow, submitting this in the hope it's legit and it saves someone else the 60 or 90 minutes it took me to figure out what the heck was going on.

      p.s. 10.5.11 and 10.5.12 are still up on the repo, they show the same behaviour.

      Attachments

        Issue Links

          Activity

            You're right. What we have now is

            MariaDB-shared

            /usr/lib64/libmariadb.so.3
            /usr/lib64/libmariadb.so -> libmariadb.so.3
            

            and

            MariaDB-devel

            /usr/lib64/libmariadbclient.a
            /usr/lib64/libmysqlclient.so -> libmariadb.so.3
            ... more compatibility libmysqlclient* symlinks
            

            This means that mariadb_config --libs can not be always correct, because the library name is different for dynamic and static builds. This is rather inconvenient.

            Also libmariadb.so should be in -devel, not in -shared. And -devel has symlinks to files in -shared but does not require it.


            But as far as you are concerned, as a sysadmin, I suspect it should mostly work fine for you. You likely prefer to link with libraries dynamically, not statically, so -lmariadb means you need libmariadb.so which is installed by MariaDB-shared.

            serg Sergei Golubchik added a comment - You're right. What we have now is MariaDB-shared /usr/lib64/libmariadb.so.3 /usr/lib64/libmariadb.so -> libmariadb.so.3 and MariaDB-devel /usr/lib64/libmariadbclient.a /usr/lib64/libmysqlclient.so -> libmariadb.so.3 ... more compatibility libmysqlclient* symlinks This means that mariadb_config --libs can not be always correct, because the library name is different for dynamic and static builds. This is rather inconvenient. Also libmariadb.so should be in -devel , not in -shared . And -devel has symlinks to files in -shared but does not require it. But as far as you are concerned, as a sysadmin, I suspect it should mostly work fine for you. You likely prefer to link with libraries dynamically, not statically, so -lmariadb means you need libmariadb.so which is installed by MariaDB-shared.
            abychko Alexey Bychko (Inactive) added a comment - - edited

            looking at 10.2.

            if I understand everything correctly, we can fix it in following way:
            1 - add dependency devel->shared
            2 - move libmariadb.so to devel package

            not sure about static/dynamic libraries. we have /usr/lib64/libmariadbclient.a and /usr/lib64/libmariadb.so symlink.
            shall we create one more compatibility symlink (libmariadb.a -> libmariadbclient.a)?

            the output from mariadb_config looks OK, I think we have nothing to change there

            abychko Alexey Bychko (Inactive) added a comment - - edited looking at 10.2. if I understand everything correctly, we can fix it in following way: 1 - add dependency devel -> shared 2 - move libmariadb.so to devel package not sure about static/dynamic libraries. we have /usr/lib64/libmariadbclient.a and /usr/lib64/libmariadb.so symlink. shall we create one more compatibility symlink (libmariadb.a -> libmariadbclient.a)? the output from mariadb_config looks OK, I think we have nothing to change there
            serg Sergei Golubchik added a comment - - edited

            1. yes, 2. yes.

            and yes, I thought about libmariadb.a -> libmariadbclient.a symlink too, we cannot just rename the library.

            Don't forget to set CONFLICTS properly, this always needs to be done when a file to moved between packages

            serg Sergei Golubchik added a comment - - edited 1. yes, 2. yes. and yes, I thought about libmariadb.a -> libmariadbclient.a symlink too, we cannot just rename the library. Don't forget to set CONFLICTS properly, this always needs to be done when a file to moved between packages
            abychko Alexey Bychko (Inactive) added a comment - created PR to add compatibility symlink https://github.com/mariadb-corporation/mariadb-connector-c/pull/190

            OK, so we have now a compatibility symlink, we have moved libmariadb.so to -devel.
            but I'm not sure about CONFLICTS. is it to conflict with Oracle MySQL or we have another purpose?

            abychko Alexey Bychko (Inactive) added a comment - OK, so we have now a compatibility symlink, we have moved libmariadb.so to -devel. but I'm not sure about CONFLICTS. is it to conflict with Oracle MySQL or we have another purpose?

            No. They're always needed when a file is moved between packages. libmariadb.so was in MariaDB-shared-10.3..32, and will be in MariaDB-devel-10.3.33. Meaning one cannot install MariaDB-devel-10.3.33 and MariaDB-shared-10.3..32 at the same time, it'll be filesystem-level conflict error. To prevent it we have to tell rpm explicitly that these two packages conflict.

            That is MariaDB-devel should have Require: MariaDB-shared >= 10.3.33
            And MariaDB-shared should Conflict: Maria-devel < 10.3.33

            (this was for 10.3, for 10.2, 10.4, 10.5, etc — adjust accordingly)

            See cpack_rpm.cmake changes in 395a03323768, where my_print_defaults was moved from -server to -client.

            serg Sergei Golubchik added a comment - No. They're always needed when a file is moved between packages. libmariadb.so was in MariaDB-shared-10.3..32, and will be in MariaDB-devel-10.3.33. Meaning one cannot install MariaDB-devel-10.3.33 and MariaDB-shared-10.3..32 at the same time, it'll be filesystem-level conflict error. To prevent it we have to tell rpm explicitly that these two packages conflict. That is MariaDB-devel should have Require: MariaDB-shared >= 10.3.33 And MariaDB-shared should Conflict: Maria-devel < 10.3.33 (this was for 10.3, for 10.2, 10.4, 10.5, etc — adjust accordingly) See cpack_rpm.cmake changes in 395a03323768, where my_print_defaults was moved from -server to -client.

            pushed to bb-10.2-MDEV-27109 as 69126ffc958543cb9a49984ec716103b943a8f53
            I stuck a bit during submodule update, it shows detached HEAD probably due to lightweight checkout, not sure how to pin the revision I need properly.
            maybe I need to wait until my PR will be merged to connector-c?

            abychko Alexey Bychko (Inactive) added a comment - pushed to bb-10.2- MDEV-27109 as 69126ffc958543cb9a49984ec716103b943a8f53 I stuck a bit during submodule update, it shows detached HEAD probably due to lightweight checkout, not sure how to pin the revision I need properly. maybe I need to wait until my PR will be merged to connector-c?
            serg Sergei Golubchik added a comment - https://github.com/mariadb-corporation/mariadb-connector-c/pull/190

            People

              serg Sergei Golubchik
              bmetal tom brown
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.