我正在尝试构建具有 SSL 支持的 RabbitMQ-C ( https://github.com/alanxz/rabbitmq-c )。我已经下载并构建了最后一个 openSSL 版本(https://github.com/openssl/openssl),并添加了它。(openssl 库位于 openssl 根文件夹中)。我的终端日志:
Macbook:rabbitmq-c user$ mkdir build && cd build
Macbook:build user$ cmake .. -DOPENSSL_ROOT_DIR=~/openssl/openssl -DOPENSSL_LIBRARIES=~/openssl/openssl
Macbook:build user$ cmake --build . --target install
cmake .. :
-- The C compiler identification is AppleClang 7.0.2.7000181
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- CMAKE_BUILD_TYPE not specified. Creating Release build
-- Found C inline keyword: inline
-- Looking for getaddrinfo
-- Looking for getaddrinfo - found
-- Looking for socket
-- Looking for socket - found
-- Looking for htonll
-- Looking for htonll - found
-- Looking for poll
-- Looking for poll - found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - not found
-- Looking for posix_spawnp in rt
-- Looking for posix_spawnp in rt - not found
-- Performing Test HAVE_GNU90
-- Performing Test HAVE_GNU90 - Success
-- Could NOT find POPT (missing: POPT_INCLUDE_DIR POPT_LIBRARY)
-- Could NOT find XMLTO (missing: XMLTO_EXECUTABLE)
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Found OpenSSL: /Users/user/openssl/openssl/libssl.a;/Users/user/openssl/openssl/libcrypto.a (found suitable version "1.1.0", minimum required is "0.9.8")
-- Building rabbitmq as a shared library - yes
-- Building rabbitmq as a static library - yes
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/user/desktop/rabbitMQ/rabbitmq-c/build
cmake --构建:
Scanning dependencies of target rabbitmq
[ 1%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_framing.c.o
[ 2%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_api.c.o
[ 3%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_connection.c.o
[ 4%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_mem.c.o
[ 5%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_socket.c.o
[ 6%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_table.c.o
[ 6%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_url.c.o
[ 7%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_tcp_socket.c.o
[ 8%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_time.c.o
[ 9%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_consumer.c.o
[ 10%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_openssl.c.o
[ 11%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_openssl_hostname_validation.c.o
[ 12%] Building C object librabbitmq/CMakeFiles/rabbitmq.dir/amqp_hostcheck.c.o
[ 12%] Linking C shared library librabbitmq.dylib
Undefined symbols for architecture x86_64:
"_SSL_CTX_clear_options", referenced from:
_amqp_ssl_socket_set_ssl_versions in amqp_openssl.c.o
"_SSL_CTX_set_options", referenced from:
_amqp_ssl_socket_new in amqp_openssl.c.o
_amqp_ssl_socket_set_ssl_versions in amqp_openssl.c.o
"_TLS_client_method", referenced from:
_amqp_ssl_socket_new in amqp_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)
make[2]: *** [librabbitmq/librabbitmq.4.1.4.dylib] Error 1
make[1]: *** [librabbitmq/CMakeFiles/rabbitmq.dir/all] Error 2
make: *** [all] Error 2
现在我不明白出了什么问题。
ps OSX 10.11,