尝试在 linux mint 上构建 mariadb connector-c 时出错。怎么修?

error trying to build mariadb connector-c on linux mint. How to fix?

我正在尝试在新安装的 linux mint 上构建 mariadb++ (mariadb connector/c)。我的流程如下所示:

$ git clone https://github.com/MariaDB/mariadb-connector-c.git
$ mkdir build && cd build
$ cmake ../mariadb-connector-c/ -DCMAKE_INSTALL_PREFIX=/usr

一切正常,问题出现在我调用 make

$ make

输出:

Scanning dependencies of target client_ed25519
[  0%] Building C object CMakeFiles/client_ed25519.dir/plugins/auth/ed25519.c.o
[  1%] Building C object CMakeFiles/client_ed25519.dir/plugins/auth/ref10/fe_0.c.o
[  2%] Building C object CMakeFiles/client_ed25519.dir/plugins/auth/ref10/fe_isnegative.c.o
[  2%] Building C object CMakeFiles/client_ed25519.dir/plugins/auth/ref10/fe_sub.c.o
[  3%] Building C object CMakeFiles/client_ed25519.dir/plugins/auth/ref10/ge_p1p1_to_p2.c.o
[  4%] Building C object CMakeFiles/client_ed25519.dir/plugins/auth/ref10/ge_p3_to_cached.c.o
[  4%] Building C object CMakeFiles/client_ed25519.dir/plugins/auth/ref10/open.c.o
In file included from /home/riley/mariadb-connector-c/plugins/auth/ref10/crypto_hash_sha512.h:2:0,
                 from /home/riley/mariadb-connector-c/plugins/auth/ref10/open.c:3:
/home/riley/mariadb-connector-c/include/ma_crypt.h:74:1: error: unknown type name ‘MA_HASH_CTX’; did you mean ‘MA_HASH_MD5’?
 MA_HASH_CTX *ma_hash_new(unsigned int algorithm, MA_HASH_CTX *ctx);
 ^~~~~~~~~~~
 MA_HASH_MD5
/home/riley/mariadb-connector-c/include/ma_crypt.h:74:50: error: unknown type name ‘MA_HASH_CTX’; did you mean ‘MA_HASH_MD5’?
 MA_HASH_CTX *ma_hash_new(unsigned int algorithm, MA_HASH_CTX *ctx);
                                                  ^~~~~~~~~~~
                                                  MA_HASH_MD5
/home/riley/mariadb-connector-c/include/ma_crypt.h:83:19: error: unknown type name ‘MA_HASH_CTX’; did you mean ‘MA_HASH_MD5’?
 void ma_hash_free(MA_HASH_CTX *ctx);
                   ^~~~~~~~~~~
                   MA_HASH_MD5
/home/riley/mariadb-connector-c/include/ma_crypt.h:96:20: error: unknown type name ‘MA_HASH_CTX’; did you mean ‘MA_HASH_MD5’?
 void ma_hash_input(MA_HASH_CTX *ctx,
                    ^~~~~~~~~~~
                    MA_HASH_MD5
/home/riley/mariadb-connector-c/include/ma_crypt.h:108:21: error: unknown type name ‘MA_HASH_CTX’; did you mean ‘MA_HASH_MD5’?
 void ma_hash_result(MA_HASH_CTX *ctx, unsigned char *digest);
                     ^~~~~~~~~~~
                     MA_HASH_MD5
/home/riley/mariadb-connector-c/include/ma_crypt.h: In function ‘ma_hash’:
/home/riley/mariadb-connector-c/include/ma_crypt.h:155:3: error: unknown type name ‘MA_HASH_CTX’; did you mean ‘MA_HASH_MD5’?
   MA_HASH_CTX *ctx= NULL;
   ^~~~~~~~~~~
   MA_HASH_MD5
/home/riley/mariadb-connector-c/include/ma_crypt.h:160:8: warning: implicit declaration of function ‘ma_hash_new’; did you mean ‘ma_hash’? [-Wimplicit-function-declaration]
   ctx= ma_hash_new(algorithm, ctx);
        ^~~~~~~~~~~
        ma_hash
/home/riley/mariadb-connector-c/include/ma_crypt.h:160:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
   ctx= ma_hash_new(algorithm, ctx);
      ^
/home/riley/mariadb-connector-c/include/ma_crypt.h:161:3: warning: implicit declaration of function ‘ma_hash_input’; did you mean ‘ma_hash’? [-Wimplicit-function-declaration]
   ma_hash_input(ctx, buffer, buffer_length);
   ^~~~~~~~~~~~~
   ma_hash
/home/riley/mariadb-connector-c/include/ma_crypt.h:162:3: warning: implicit declaration of function ‘ma_hash_result’; did you mean ‘ma_hash’? [-Wimplicit-function-declaration]
   ma_hash_result(ctx, digest);
   ^~~~~~~~~~~~~~
   ma_hash
/home/riley/mariadb-connector-c/include/ma_crypt.h:163:3: warning: implicit declaration of function ‘ma_hash_free’; did you mean ‘ma_hash’? [-Wimplicit-function-declaration]
   ma_hash_free(ctx);
   ^~~~~~~~~~~~
   ma_hash
CMakeFiles/client_ed25519.dir/build.make:206: recipe for target 'CMakeFiles/client_ed25519.dir/plugins/auth/ref10/open.c.o' failed
make[2]: *** [CMakeFiles/client_ed25519.dir/plugins/auth/ref10/open.c.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/client_ed25519.dir/all' failed
make[1]: *** [CMakeFiles/client_ed25519.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

显然构建中缺少某些东西...但是我该如何修复它?或者有没有更简单的安装方式

好的,我刚刚在 playpen VM 上确认安装了 w/o libssl-dev 我得到了同样的错误。

运行 apt install libssl-dev 然后再试一次,从 cmake .. -DCMAKE_INSTALL_PREFIX=/usr

开始