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

Mismatch in MARIADB_UNIX_ADDR default value for MariaDB Server and Connector C

Details

    Description

      While working on MariaDB 10.6.4 compilation I noticed this warning:

      $ eatmydata ninja package
      [27/50] Building C object client/CMakeFiles/mariadb-upgrade.dir/mysql_upgrade.c.o
      ...
      In file included from ../client/mysql_upgrade.c:19:
      In file included from ../client/client_priv.h:27:
      include/mysql_version.h:23:9: warning: 'MARIADB_UNIX_ADDR' macro redefined [-Wmacro-redefined]
      #define MARIADB_UNIX_ADDR               "/var/lib/mysql/mysql.sock"
              ^
      ../libmariadb/include/mariadb_version.h:17:9: note: previous definition is here
      #define MARIADB_UNIX_ADDR               "/tmp/mysql.sock"
      ...
      

      It is understanable that the variable is defined twice, but it is not good that we have two different default values of MARIADB_UNIX_ADDR.

      The client sets it to /tmp/mysql.sock in https://github.com/mariadb-corporation/mariadb-connector-c/blob/1f320a663cf08191e3be03be11bd61c7560b0cb7/CMakeLists.txt#L181

      The server sets MARIADB_UNIX_ADDR to MYSQL_UNIX_ADDR which in turn is set to INSTALL_UNIX_ADDRDIR which ends up being /var/lib/mysql in the build.

      I suggest the default path would be the same in both projects.

      Attachments

        Activity

          danblack Daniel Black added a comment -

          please edit the example log url. I'm getting "ExpiredToken". Found - https://gitlab.com/ottok/mariadb/-/jobs/1528209679 for cento7 showing Installation layout: DEFAULT but not for centos8.

          Same with https://gitlab.com/ottok/mariadb/-/jobs/1543385136

          Could this be tied to the cmake version?

          $ cmake --trace-source=cmake/install_layout.cmake --trace-expand
          

          danblack Daniel Black added a comment - please edit the example log url. I'm getting "ExpiredToken". Found - https://gitlab.com/ottok/mariadb/-/jobs/1528209679 for cento7 showing Installation layout: DEFAULT but not for centos8. Same with https://gitlab.com/ottok/mariadb/-/jobs/1543385136 Could this be tied to the cmake version? $ cmake --trace-source=cmake/install_layout.cmake --trace-expand

          Indeed, the INSTALL_LAYOUT is DEFAULT if RPM=centos7.

          On all other values for RPM (centos8, fedora, generic) seem to work and INSTALL_LAYOUT is RPM.

          New debug code:

          --- a/cmake/cpack_rpm.cmake
          +++ b/cmake/cpack_rpm.cmake
          @@ -1,5 +1,7 @@
           IF(RPM)
           +MESSAGE("CPackRPM building with RPM configuration: ${RPM}")
          

          RPM=centos7 https://gitlab.com/ottok/mariadb/-/jobs/1544023335

          -- MariaDB Connector/c configuration:
          -- Static PLUGINS pvio_socket;mysql_native_password;mysql_old_password
          -- Dynamic PLUGINS dialog;client_ed25519;caching_sha2_password;sha256_password;auth_gssapi_client;mysql_clear_password
          -- CPack generation: TGZ
          -- SSL support: OPENSSL Libs: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so
          -- Zlib support: ON
          -- Installation layout: DEFAULT
          -- Include files will be installed in include/mysql
          -- Libraries will be installed in lib64
          -- Binaries will be installed in bin
          -- Documentation included from 
          -- Required: dl;m;pthread
          -- MariaDB Connector/C 3.2.4
          CPackRPM building with RPM configuration: centos7
          

          RPM=centos8 https://gitlab.com/ottok/mariadb/-/jobs/1544023333

          -- MariaDB Connector/c configuration:
          -- Static PLUGINS mysql_native_password;mysql_old_password;pvio_socket
          -- Dynamic PLUGINS dialog;client_ed25519;caching_sha2_password;sha256_password;auth_gssapi_client;mysql_clear_password
          -- CPack generation: TGZ
          -- SSL support: OPENSSL Libs: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so
          -- Zlib support: ON
          -- Installation layout: RPM
          -- Include files will be installed in include/mysql
          -- Libraries will be installed in lib64
          -- Binaries will be installed in bin
          -- Documentation included from 
          -- Required: dl;m;pthread
          -- MariaDB Connector/C 3.2.4
          CPackRPM building with RPM configuration: centos8
          

          otto Otto Kekäläinen added a comment - Indeed, the INSTALL_LAYOUT is DEFAULT if RPM=centos7. On all other values for RPM (centos8, fedora, generic) seem to work and INSTALL_LAYOUT is RPM. New debug code: --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -1,5 +1,7 @@ IF(RPM) +MESSAGE("CPackRPM building with RPM configuration: ${RPM}") RPM=centos7 https://gitlab.com/ottok/mariadb/-/jobs/1544023335 -- MariaDB Connector/c configuration: -- Static PLUGINS pvio_socket;mysql_native_password;mysql_old_password -- Dynamic PLUGINS dialog;client_ed25519;caching_sha2_password;sha256_password;auth_gssapi_client;mysql_clear_password -- CPack generation: TGZ -- SSL support: OPENSSL Libs: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so -- Zlib support: ON -- Installation layout: DEFAULT -- Include files will be installed in include/mysql -- Libraries will be installed in lib64 -- Binaries will be installed in bin -- Documentation included from -- Required: dl;m;pthread -- MariaDB Connector/C 3.2.4 CPackRPM building with RPM configuration: centos7 RPM=centos8 https://gitlab.com/ottok/mariadb/-/jobs/1544023333 -- MariaDB Connector/c configuration: -- Static PLUGINS mysql_native_password;mysql_old_password;pvio_socket -- Dynamic PLUGINS dialog;client_ed25519;caching_sha2_password;sha256_password;auth_gssapi_client;mysql_clear_password -- CPack generation: TGZ -- SSL support: OPENSSL Libs: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so -- Zlib support: ON -- Installation layout: RPM -- Include files will be installed in include/mysql -- Libraries will be installed in lib64 -- Binaries will be installed in bin -- Documentation included from -- Required: dl;m;pthread -- MariaDB Connector/C 3.2.4 CPackRPM building with RPM configuration: centos8

          I confirm this was a CMake version issue.

          Centos 7 has cmake version 2.8.12.2. After installing cmake3 version 3.17.5 from EPEL the exact same build evaluated INSTALL_LAYOUT correctly:

          -- MariaDB Connector/c configuration:
          -- Static PLUGINS mysql_native_password;mysql_old_password;pvio_socket
          -- Dynamic PLUGINS dialog;client_ed25519;caching_sha2_password;sha256_password;auth_gssapi_client;mysql_clear_password
          -- CPack generation: TGZ
          -- SSL support: OPENSSL Libs: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so
          -- Zlib support: ON
          -- Installation layout: RPM
          -- Include files will be installed in include/mysql
          -- Libraries will be installed in lib64
          -- Binaries will be installed in bin
          -- Documentation included from 
          -- Required: dl;m;pthread
          -- MariaDB Connector/C 3.2.4
          -- CPackRPM building with RPM configuration: centos7
          

          I ran the trace cmake -DRPM=centos7 --trace-source=cmake/install_layout.cmake --trace-expand on both CMake 2 and CMake 3 and compared, but in traces both evaluated INSTALL_LAYOUT "DEFAULT".

          IF(NOT INSTALL_LAYOUT)
            SET(INSTALL_LAYOUT "DEFAULT")
          ENDIF()
          

          After adding a bunch of MESSAGE here and there to debug I arrived that the root cause is the STRQUAL comparison, and the fix is:

          diff --git a/cmake/mariadb_connector_c.cmake b/cmake/mariadb_connector_c.cmake
          index a9b103345cd..ebe07f8c5a0 100644
          --- a/cmake/mariadb_connector_c.cmake
          +++ b/cmake/mariadb_connector_c.cmake
          @@ -22,9 +22,9 @@ ENDIF()
           SET(CONC_WITH_CURL OFF)
           SET(CONC_WITH_MYSQLCOMPAT ON)
           
          -IF (INSTALL_LAYOUT STREQUAL "RPM")
          +IF (${INSTALL_LAYOUT} STREQUAL "RPM")
             SET(CONC_INSTALL_LAYOUT "RPM")
          -ELSEIF (INSTALL_LAYOUT STREQUAL "DEB")
          +ELSEIF (${INSTALL_LAYOUT} STREQUAL "DEB")
             SET(CONC_INSTALL_LAYOUT "DEB")
           ELSE()
             SET(CONC_INSTALL_LAYOUT "DEFAULT")
          

          Should I make a PR of this?

          otto Otto Kekäläinen added a comment - I confirm this was a CMake version issue. Centos 7 has cmake version 2.8.12.2. After installing cmake3 version 3.17.5 from EPEL the exact same build evaluated INSTALL_LAYOUT correctly: -- MariaDB Connector/c configuration: -- Static PLUGINS mysql_native_password;mysql_old_password;pvio_socket -- Dynamic PLUGINS dialog;client_ed25519;caching_sha2_password;sha256_password;auth_gssapi_client;mysql_clear_password -- CPack generation: TGZ -- SSL support: OPENSSL Libs: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so -- Zlib support: ON -- Installation layout: RPM -- Include files will be installed in include/mysql -- Libraries will be installed in lib64 -- Binaries will be installed in bin -- Documentation included from -- Required: dl;m;pthread -- MariaDB Connector/C 3.2.4 -- CPackRPM building with RPM configuration: centos7 I ran the trace cmake -DRPM=centos7 --trace-source=cmake/install_layout.cmake --trace-expand on both CMake 2 and CMake 3 and compared, but in traces both evaluated INSTALL_LAYOUT "DEFAULT". IF(NOT INSTALL_LAYOUT) SET(INSTALL_LAYOUT "DEFAULT") ENDIF() After adding a bunch of MESSAGE here and there to debug I arrived that the root cause is the STRQUAL comparison, and the fix is: diff --git a/cmake/mariadb_connector_c.cmake b/cmake/mariadb_connector_c.cmake index a9b103345cd..ebe07f8c5a0 100644 --- a/cmake/mariadb_connector_c.cmake +++ b/cmake/mariadb_connector_c.cmake @@ -22,9 +22,9 @@ ENDIF() SET(CONC_WITH_CURL OFF) SET(CONC_WITH_MYSQLCOMPAT ON) -IF (INSTALL_LAYOUT STREQUAL "RPM") +IF (${INSTALL_LAYOUT} STREQUAL "RPM") SET(CONC_INSTALL_LAYOUT "RPM") -ELSEIF (INSTALL_LAYOUT STREQUAL "DEB") +ELSEIF (${INSTALL_LAYOUT} STREQUAL "DEB") SET(CONC_INSTALL_LAYOUT "DEB") ELSE() SET(CONC_INSTALL_LAYOUT "DEFAULT") Should I make a PR of this?

          Did now https://github.com/MariaDB/server/pull/1897 as CentOS 7 will be around for a while more..

          otto Otto Kekäläinen added a comment - Did now https://github.com/MariaDB/server/pull/1897 as CentOS 7 will be around for a while more..

          Since CMake 2.x use is getting very rare I will just close https://github.com/MariaDB/server/pull/1897, in particular since nobody else reported running into this issue in https://jira.mariadb.org/browse/MDEV-26319.

          otto Otto Kekäläinen added a comment - Since CMake 2.x use is getting very rare I will just close https://github.com/MariaDB/server/pull/1897 , in particular since nobody else reported running into this issue in https://jira.mariadb.org/browse/MDEV-26319 .

          People

            danblack Daniel Black
            otto Otto Kekäläinen
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.