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

Error on compiling of libmariadb/plugins/compress/c_zstd.c

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • None
    • 10.8.3
    • libmariadb
    • None

    Description

      server-10.8/libmariadb/plugins/compress/c_zstd.c:37:28: error: redefinition of typedef 'ZSTD_CCtx' is a C11 feature [-Werror,-Wtypedef-redefinition]
      typedef struct ZSTD_CCtx_s ZSTD_CCtx;
                                 ^
      /usr/local/include/zstd.h:200:28: note: previous definition is here
      typedef struct ZSTD_CCtx_s ZSTD_CCtx;
                                 ^
      server-10.8/libmariadb/plugins/compress/c_zstd.c:38:28: error: redefinition of typedef 'ZSTD_DCtx' is a C11 feature [-Werror,-Wtypedef-redefinition]
      typedef struct ZSTD_DCtx_s ZSTD_DCtx;
                                 ^
      /usr/local/include/zstd.h:223:28: note: previous definition is here
      typedef struct ZSTD_DCtx_s ZSTD_DCtx;
                                 ^
      2 errors generated.
      

      Running make with the option VERBOSE=1 shows that compiler is invoked with the option -std=gnu99 that is the reason of the above compilation failure.

      Attachments

        Activity

          For some reason, I am unable to compile libmariadb with Zstd compression when building MariaDB Server 10.8. I am also unable to repeat this when configuring and building Connector/C directly.

          On a quick look, the following should fix this:

          diff --git a/plugins/compress/c_zstd.c b/plugins/compress/c_zstd.c
          index e50898e..9a725f7 100644
          --- a/plugins/compress/c_zstd.c
          +++ b/plugins/compress/c_zstd.c
          @@ -34,9 +34,6 @@
           #define ZSTD_CLEVEL_DEFAULT 3
           #endif
           
          -typedef struct ZSTD_CCtx_s ZSTD_CCtx;
          -typedef struct ZSTD_DCtx_s ZSTD_DCtx;
          -
           static void ma_free_ctx(ma_compress_ctx *ctx)
           {
             if (ctx)
          

          After those lines, there are no references to any of those data type names. The data members compress_ctx and decompress_ctx of the anonymous struct that the type alias ma_compress_ctx refers to are of type void*. So, I think that the above patch should fix this.

          georg, as the maintainer of the component, please fix this.

          marko Marko Mäkelä added a comment - For some reason, I am unable to compile libmariadb with Zstd compression when building MariaDB Server 10.8. I am also unable to repeat this when configuring and building Connector/C directly. On a quick look, the following should fix this: diff --git a/plugins/compress/c_zstd.c b/plugins/compress/c_zstd.c index e50898e..9a725f7 100644 --- a/plugins/compress/c_zstd.c +++ b/plugins/compress/c_zstd.c @@ -34,9 +34,6 @@ #define ZSTD_CLEVEL_DEFAULT 3 #endif -typedef struct ZSTD_CCtx_s ZSTD_CCtx; -typedef struct ZSTD_DCtx_s ZSTD_DCtx; - static void ma_free_ctx(ma_compress_ctx *ctx) { if (ctx) After those lines, there are no references to any of those data type names. The data members compress_ctx and decompress_ctx of the anonymous struct that the type alias ma_compress_ctx refers to are of type void* . So, I think that the above patch should fix this. georg , as the maintainer of the component, please fix this.

          shulga confirmed that my fix works. I fixed it in Connector/C 3.3 and updated the submodule in MariaDB Server 10.8 and 10.9.

          marko Marko Mäkelä added a comment - shulga confirmed that my fix works. I fixed it in Connector/C 3.3 and updated the submodule in MariaDB Server 10.8 and 10.9.

          People

            marko Marko Mäkelä
            shulga Dmitry Shulga
            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.