Pet*_*ell 1 c homebrew openssl pkg-config clion
我正在编写一个使用 OpenSSL 的程序。它工作正常,然后我重置/删除了 CMake 缓存。我现在收到以下错误消息。
我使用 Homebrew 安装了 OpenSSL。我将以下内容添加到我的 .bash_profile 中:
导出 PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
我将其添加到位于 /etc/paths 的全局路径文件中:
/opt/homebrew/opt/openssl@1.1/bin
用于调试此问题的其他修复/建议是什么?
错误:
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/stephenjje/Documents/Je/test/cmake-build-debug --target test -- -j 6
[ 2%] Linking C executable test
ld: warning: ignoring file /usr/local/Cellar/openssl@1.1/1.1.1k/lib/libcrypto.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: warning: ignoring file /usr/local/Cellar/openssl@1.1/1.1.1k/lib/libssl.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"_ERR_print_errors_fp", referenced from:
_http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
_http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
_http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
"_OPENSSL_init_crypto", referenced from:
_http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
"_OPENSSL_init_ssl", referenced from:
_http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
"_SSL_CIPHER_get_name", referenced from:
_http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
"_SSL_CTX_free", referenced from:
_http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
"_SSL_CTX_new", referenced from:
_http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
_http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
"_SSL_CTX_use_PrivateKey_file", referenced from:
_http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
"_SSL_CTX_use_certificate_file", referenced from:
_http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
"_SSL_accept", referenced from:
_http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
"_SSL_connect", referenced from:
_http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
"_SSL_ctrl", referenced from:
_http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
"_SSL_free", referenced from:
_http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
"_SSL_get_current_cipher", referenced from:
_http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
"_SSL_get_peer_certificate", referenced from:
_http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
"_SSL_new", referenced from:
_http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
_http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
"_SSL_read", referenced from:
_http_tcpip_inbound_parse_request in http_tcpip_inbound.c.o
_http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
"_SSL_set_fd", referenced from:
_http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
_http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
"_SSL_shutdown", referenced from:
_http_tcpip_inbound_initialize in http_tcpip_inbound.c.o
"_SSL_write", referenced from:
_http_tcpip_inbound_send_response in http_tcpip_inbound.c.o
_http_tcpip_outbound_request_send_type_tls in http_tcpip_outbound.c.o
"_TLS_client_method", referenced from:
_http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
"_TLS_server_method", referenced from:
_http_tcpip_inbound_tls_initialize in http_tcpip_inbound.c.o
"_X509_free", referenced from:
_http_tcpip_outbound_get_url_using_string_type_tls in http_tcpip_outbound.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[3]: *** [CMakeFiles/test.dir/build.make:680: test] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:83: CMakeFiles/test.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/test.dir/rule] Error 2
Run Code Online (Sandbox Code Playgroud)
您使用的是 M1 Mac 吗?从错误输出来看,您已在 下安装了 Homebrew /usr/local,这表明您使用的是 x86 Mac。而是/opt/homebrewM1 Mac的安装位置。
我猜你只是使用 x86 Mac,但你/opt/homebrew/opt/openssl@1.1从网络上的某个地方复制了这个东西。您的 CLion 尝试针对arm64设备进行构建。当然它会失败,因为你根本不在手臂机器上。更改构建设置并停止为设备构建项目arm(但仅针对x86设备)。
我不知道如何在 CLion 中执行此操作,但 XCode 中有一些示例。Xcode 12,为 iOS 模拟器构建,但链接到为 iOS 构建的目标文件,用于架构 arm64
| 归档时间: |
|
| 查看次数: |
7879 次 |
| 最近记录: |