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

Ambiguous behaviour regarding installation of header files

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.2.7
    • 10.2.8
    • Compiling
    • None

    Description

      So I noticed something a bit funny about the MariaDB 10.2 install process, when it comes to header files. It seems there are kinda two competing install processes.

      The source code includes a libmariadb/ subdirectory, which is actually (in the git repo) the mariadb-connector-c project as a submodule. This project has its own include/ subdirectory, which contains several header files and some install rules for them in a CMakeLists.txt file.

      But the mariadb source also has its own include/ subdirectory, which similarly contains several header files and some install rules for them. In several cases, the install rules for both include/ subdirectories try to install a file with the same name to the same place: this includes at least mysql.h and errmsg.h . You can spot cases like this in the console output by looking for the string 'Up-to-date', which basically seems to be CMake indicating that a file listed for installation already exists and won't be replaced.

      AFAICS, at least during our (Fedora's) builds, the libmariadb/include/ subdirectory gets to go first, and then when the include/ subdirectory runs, it doesn't overwrite any file that the libmariadb/include/ subdirectory already installed. But as there are more headers in the include/ subdirectory, you ultimately wind up with a mish-mash of headers installed, some from the libmariadb/ subproject and some from mariadb itself.

      This is particularly significant in the case of mysql.h; what actually winds up installed is libmariadb/include/mysql.h , not include/mysql.h . There are some significant differences between the two; for instance, the one from libmariadb/include/ includes mariadb_version.h from the same directory , whereas the mysql.h from include/ includes mysql_version.h from the same directory. libmariadb's mariadb_version.h defines rather fewer things than mariadb's mysql_version.h does. So ultimately, for instance, if you install MariaDB 10.2, then write some code that just does #include mysql.h , then you will have no MYSQL_SERVER_VERSION defined.

      This is definitely confusing and ambiguous, and I think it's a straight up bug. I would think that when installing MariaDB itself then we really want to install include/mysql.h , not libmariadb/include/mysql.h .

      Attachments

        Issue Links

          Activity

            Jared: I don't think that's what Sergei means, no. I believe that the full mariadb will contain both the server and the client headers, in different directories. mariadb-connector-c will only contain the client headers, in the same place mariadb puts them. Again, this is just as I understand it.

            AdamW Adam Williamson added a comment - Jared: I don't think that's what Sergei means, no. I believe that the full mariadb will contain both the server and the client headers, in different directories. mariadb-connector-c will only contain the client headers, in the same place mariadb puts them. Again, this is just as I understand it.

            AdamW, yes, that's right. mariadb-connector-c package will contain only client headers and it will be sufficient for compiling client applications.

            jaredbeck, I suspect that now mariadb and mariadb-connector-c will not conflict anymore, so they can (but not should) be safely installed side by side. But please double check that (and do complain if they still conflict).

            serg Sergei Golubchik added a comment - AdamW , yes, that's right. mariadb-connector-c package will contain only client headers and it will be sufficient for compiling client applications. jaredbeck , I suspect that now mariadb and mariadb-connector-c will not conflict anymore, so they can (but not should) be safely installed side by side. But please double check that (and do complain if they still conflict).
            jaredbeck Jared Beck added a comment - - edited

            > I suspect that now mariadb and mariadb-connector-c will not conflict anymore ...

            Thanks Sergei, I have passed along your analysis to the homebrew team: https://github.com/Homebrew/homebrew-core/pull/17202

            jaredbeck Jared Beck added a comment - - edited > I suspect that now mariadb and mariadb-connector-c will not conflict anymore ... Thanks Sergei, I have passed along your analysis to the homebrew team: https://github.com/Homebrew/homebrew-core/pull/17202

            As a result of the patch for this issue [1], mysql_version.h is installed under /usr/include/mysql/server as of MariaDB 10.2.8.

            Given that 'mysql_config --cflags' still reports '-I/usr/include/mysql' in MariaDB 10.2.8, what would be the best way to discover mysql_version.h location for software that wants to be portable across MariaDB versions and MySQL flavors?

            [1] https://github.com/MariaDB/server/commit/3ec96c1824

            kaamos Alexey Kopytov added a comment - As a result of the patch for this issue [1] , mysql_version.h is installed under /usr/include/mysql/server as of MariaDB 10.2.8. Given that 'mysql_config --cflags' still reports '-I/usr/include/mysql' in MariaDB 10.2.8, what would be the best way to discover mysql_version.h location for software that wants to be portable across MariaDB versions and MySQL flavors? [1] https://github.com/MariaDB/server/commit/3ec96c1824

            In MDEV-13773 I'm providing compatibility headers, mysql_version.h is one of them. It's not pushed into 10.2 at the moment of writing of this comment, but will be in 10.2.9. Feel free to look at the patch (linked from MDEV-13773) and comment on it, so that I could fix it to work for you. So far I've only tested it for projects mentioned in MDEV-13773.

            serg Sergei Golubchik added a comment - In MDEV-13773 I'm providing compatibility headers, mysql_version.h is one of them. It's not pushed into 10.2 at the moment of writing of this comment, but will be in 10.2.9. Feel free to look at the patch (linked from MDEV-13773 ) and comment on it, so that I could fix it to work for you. So far I've only tested it for projects mentioned in MDEV-13773 .

            People

              serg Sergei Golubchik
              AdamW Adam Williamson
              Votes:
              0 Vote for this issue
              Watchers:
              9 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.