c - RabbitMQ-C 构建错误(使用 openSSL)

标签 c macos ssl compilation rabbitmq-c

我正在尝试构建支持 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

现在我不明白这是怎么回事。

附注操作系统 10.11,

最佳答案

已解决。问题出在“Cmake”(用于构建 rabbitmq 包装器)中 - 他在 OS X 上无法正常工作。

关于c - RabbitMQ-C 构建错误(使用 openSSL),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35294538/

相关文章:

ruby - 链接到 OS X 上特定的 Oracle 即时客户端动态库

ssl - 如何验证正在进行的 ssl session 的证书

java - 信任自签名证书时的 Android 应用程序 SSL 问题

c - 为什么它总是说 "undefined reference"?

ruby-on-rails - 运行 '__rvm_make install' 时出错,

macos - 不再需要删除 Cocoa 中的通知观察者?

asp.net - "This page contains both secure and nonsecure items"主题和 SSL

c++ - 使用 C 跳转到代码中的特定行

c - 将参数从 C 传递给程序集?

c - 使用 memcpy 从数组转换为 int