Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-492

Can't compile a client plugin with libmariadb-dev-compat on ubuntu 20.04

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Trivial
    • Resolution: Fixed
    • 3.1.9
    • 3.1.10
    • None
    • None
    • Ubuntu 20.04

    Description

      I can't seem to compile a very simple c++ file with the `mysql/client_plugin.h` file included.

      Here is a sample file to reproduce

      #include <mysql.h>
      extern "C" {
      #include <mysql/client_plugin.h>
      }
       
      int main()
      {
              st_mysql_client_plugin_AUTHENTICATION example{
                      .type = MYSQL_CLIENT_AUTHENTICATION_PLUGIN,
                      .interface_version = MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION,
                      .name = "example",
                      .author = "tete17",
                      .desc = "Bugy",
                      .version = {0, 0, 1},
                      .mysql_api = nullptr,
                      .init = nullptr,
                      .deinit = nullptr,
                      .options = nullptr,
                      .authenticate_user = nullptr
              };
              return 0;
      }
      

      My command line is `g++ main.cpp -I /usr/include/mysql -lmysql`. I am getting this error.

      In file included from /usr/include/mysql/mysql/client_plugin.h:113,
                       from main.cpp:3:
      /usr/include/mysql/ma_pvio.h:63:34: error: 'uchar' has not been declared
         63 |   void (*callback)(MYSQL *mysql, uchar *buffer, size_t size);
            |                                  ^~~~~
      /usr/include/mysql/ma_pvio.h:70:3: error: 'uchar' does not name a type; did you mean 'u_char'?
         70 |   uchar *cache;
            |   ^~~~~
            |   u_char
      /usr/include/mysql/ma_pvio.h:71:3: error: 'uchar' does not name a type; did you mean 'u_char'?
         71 |   uchar *cache_pos;
            |   ^~~~~
            |   u_char
      /usr/include/mysql/ma_pvio.h:80:63: error: 'uchar' does not name a type; did you mean 'u_char'?
         80 |   void (*callback)(MARIADB_PVIO *pvio, my_bool is_read, const uchar *buffer, size_t length);
            |                                                               ^~~~~
            |                                                               u_char
      /usr/include/mysql/ma_pvio.h:96:39: error: 'uchar' has not been declared
         96 |   ssize_t (*read)(MARIADB_PVIO *pvio, uchar *buffer, size_t length);
            |                                       ^~~~~
      /usr/include/mysql/ma_pvio.h:97:45: error: 'uchar' has not been declared
         97 |   ssize_t (*async_read)(MARIADB_PVIO *pvio, uchar *buffer, size_t length);
            |                                             ^~~~~
      /usr/include/mysql/ma_pvio.h:98:46: error: 'uchar' does not name a type; did you mean 'u_char'?
         98 |   ssize_t (*write)(MARIADB_PVIO *pvio, const uchar *buffer, size_t length);
            |                                              ^~~~~
            |                                              u_char
      /usr/include/mysql/ma_pvio.h:99:52: error: 'uchar' does not name a type; did you mean 'u_char'?
         99 |   ssize_t (*async_write)(MARIADB_PVIO *pvio, const uchar *buffer, size_t length);
            |                                                    ^~~~~
            |                                                    u_char
      /usr/include/mysql/ma_pvio.h:116:48: error: 'uchar' has not been declared
        116 | ssize_t ma_pvio_cache_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length);
            |                                                ^~~~~
      /usr/include/mysql/ma_pvio.h:117:42: error: 'uchar' has not been declared
        117 | ssize_t ma_pvio_read(MARIADB_PVIO *pvio, uchar *buffer, size_t length);
            |                                          ^~~~~
      /usr/include/mysql/ma_pvio.h:118:49: error: 'uchar' does not name a type; did you mean 'u_char'?
        118 | ssize_t ma_pvio_write(MARIADB_PVIO *pvio, const uchar *buffer, size_t length);
            |                                                 ^~~~~
            |                                                 u_char
      main.cpp: In function 'int main()':
      main.cpp:20:2: error: 'st_mysql_client_plugin_AUTHENTICATION' has no non-static data member named 'mysql_api'
         20 |  };
            |  ^
      

      I think the last error is due to a bug in gcc where it doesn't properly expand the macro `MYSQL_CLIENT_PLUGIN_HEADER`, but `uchar` is not defined anywhere except `server/my_global.h` which I think I am not supposed to include but I am not sure. I have a feeling this is related to the fact that now all my `my_*.h` files are empty except for a compiler warning. I have notice this only after upgrading from ubuntu 18.04 to ubuntu 20.04.

      I would appreciate any help please. If I have made a mistake along the way please let me know as well if more info is needed.

      Thanks in advance

      Attachments

        Activity

          People

            georg Georg Richter
            tete17 Miguel Sacristan Izcue
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.