在OSX上构建mariadb-connector-c

时间:2018-10-27 13:34:06

标签: macos mariadb ninja mariadb-connector-c

我正在尝试在最新的OSX上构建C connector for MariaDB,但是它似乎失败了,并出现了与SSL相关的错误。我使用Macports(/ opt / local / lib / openssl)安装了SSL,并添加了一个指向它的包含项:

find_package(OpenSSL REQUIRED)
target_include_directories(tests PRIVATE ${OPENSSL_INCLUDE_DIR})

但是构建它会返回相同的错误:

~/chi/databaseclient/cpp/ninja/mariadb-connector-c-src
⟩ ninja
[81/115] Building C object libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/inflate.c.o
zlib/inflate.c:1475:61: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
    if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
                                                        ~~~ ^
1 warning generated.
[89/115] Linking C shared library libmariadb/libmariadb.3.dylib
FAILED: libmariadb/libmariadb.3.dylib 
: && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -O2 -g -DNDEBUG -DDBUG_OFF -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -dynamiclib -Wl,-headerpad_max_install_names -compatibility_version 3.0.0 -current_version 3.0.0 -o libmariadb/libmariadb.3.dylib -install_name /Users/ruihpacheco/chi/databaseclient/cpp/ninja/mariadb-connector-c-src/libmariadb/libmariadb.3.dylib libmariadb/CMakeFiles/mariadb_obj.dir/__/plugins/auth/my_auth.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/plugins/auth/old_password.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/plugins/pvio/pvio_socket.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_array.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_charset.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_hash.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_net.c.o libmariadb/CMakeFiles/mariadb_obj.dir/mariadb_charset.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_time.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_default.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_errmsg.c.o libmariadb/CMakeFiles/mariadb_obj.dir/mariadb_lib.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_list.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_pvio.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_tls.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_alloc.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_compress.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_init.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_password.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_ll2str.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_sha1.c.o libmariadb/CMakeFiles/mariadb_obj.dir/mariadb_stmt.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_loaddata.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_stmt_codec.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_string.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_dtoa.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_client_plugin.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_io.c.o libmariadb/CMakeFiles/mariadb_obj.dir/secure/openssl.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/adler32.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/compress.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/crc32.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/deflate.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/gzclose.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/gzlib.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/gzread.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/gzwrite.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/infback.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/inffast.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/inflate.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/inftrees.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/trees.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/uncompr.c.o libmariadb/CMakeFiles/mariadb_obj.dir/__/zlib/zutil.c.o libmariadb/CMakeFiles/mariadb_obj.dir/mariadb_dyncol.c.o libmariadb/CMakeFiles/mariadb_obj.dir/mariadb_async.c.o libmariadb/CMakeFiles/mariadb_obj.dir/ma_context.c.o  /usr/lib/libiconv.dylib /usr/lib/libssl.dylib /usr/lib/libcrypto.dylib && :
Undefined symbols for architecture x86_64:
  "_X509_check_host", referenced from:
      _ma_tls_verify_server_cert in openssl.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[91/115] Building C object unittest/libmariadb/CMakeFiles/ps_bugs.dir/ps_bugs.c.o
ninja: build stopped: subcommand failed.

2 个答案:

答案 0 :(得分:0)

MariaDB Connector / C可以在所有受支持的OpenSSL版本中正常使用。

错误“体系结构x86_64的未定义符号“ _X509_check_host”“表示您使用的OpenSSL版本不再受支持。 X509_check_host是OpenSSL 1.0.2中引入的。

请将您的OpenSSL版本更新为1.0.2或更高版本。另请参见https://www.openssl.org/policies/releasestrat.html

答案 1 :(得分:0)

出于某种原因,基本上CMake使用Macports头文件,但使用系统库。