代码之家  ›  专栏  ›  技术社区  ›  ruipacheco

在OSX上构建mariadb-connector-c

  •  0
  • ruipacheco  · 技术社区  · 6 年前

    C connector for MariaDB 在最新的OSX上,但它似乎失败了,并出现了与SSL相关的错误。我使用Macports(/opt/local/lib/openssl)安装了SSL,并添加了指向它的include:

    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 回复  |  直到 6 年前
        1
  •  0
  •   Georg Richter    5 年前

    错误“Undefined symbols for architecture x86\u 64”\u X509\u check\u host”表示您使用的是不再受支持的旧OpenSSL版本。OpenSSL 1.0.2中引入了X509\检查\主机。

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

        2
  •  0
  •   ruipacheco    5 年前