Macos Mac OS上架构x86_64的未定义符号

Macos Mac OS上架构x86_64的未定义符号,macos,clang,stunnel,Macos,Clang,Stunnel,我正试图在Mac OS 10.10上安装stunnel软件,但出现以下错误 架构x86_64的未定义符号 从终端执行make命令时 以下是详细的日志: Making all in src /Applications/Xcode.app/Contents/Developer/usr/bin/make all-am /bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -D_THREAD_SAFE -pthread -Wall -Wextra

我正试图在Mac OS 10.10上安装stunnel软件,但出现以下错误

架构x86_64的未定义符号

从终端执行
make
命令时

以下是详细的日志:

Making all in src
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
/bin/sh ../libtool  --tag=CC   --mode=link gcc  -g -O2 -D_THREAD_SAFE -pthread -Wall -Wextra -Wpedantic     -Wformat=2 -Wconversion -Wno-long-long -Wno-deprecated-declarations -fstack-protector -fPIE -   D_FORTIFY_SOURCE=2 -L/usr/local/openssl/lib64 -L/usr/local/openssl/lib -lssl -lcrypto -fPIE -pie -o     stunnel  stunnel-tls.o stunnel-str.o stunnel-file.o stunnel-client.o stunnel-log.o stunnel-options.o    stunnel-protocol.o stunnel-network.o stunnel-resolver.o stunnel-ssl.o stunnel-ctx.o stunnel-verify.o    stunnel-sthreads.o stunnel-fd.o stunnel-dhparam.o stunnel-cron.o stunnel-stunnel.o stunnel-pty.o    stunnel-libwrap.o stunnel-ui_unix.o  -lz  
libtool: link: gcc -g -O2 -D_THREAD_SAFE -pthread -Wall -Wextra -Wpedantic -Wformat=2 -Wconversion -    Wno-long-long -Wno-deprecated-declarations -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -fPIE -pie -o    stunnel stunnel-tls.o stunnel-str.o stunnel-file.o stunnel-client.o stunnel-log.o stunnel-options.o     stunnel-protocol.o stunnel-network.o stunnel-resolver.o stunnel-ssl.o stunnel-ctx.o stunnel-verify.o    stunnel-sthreads.o stunnel-fd.o stunnel-dhparam.o stunnel-cron.o stunnel-stunnel.o stunnel-pty.o    stunnel-libwrap.o stunnel-ui_unix.o  -L/usr/local/openssl/lib64 -L/usr/local/openssl/lib -lssl -lcrypto     -lz -pthread
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pie'
clang: warning: argument unused during compilation: '-pthread'
ld: warning: directory not found for option '-L/usr/local/openssl/lib64'
ld: warning: directory not found for option '-L/usr/local/openssl/lib'
Undefined symbols for architecture x86_64:
"_CRYPTO_THREADID_set_callback", referenced from:
  _sthreads_init in stunnel-sthreads.o
"_CRYPTO_THREADID_set_numeric", referenced from:
  _threadid_func in stunnel-sthreads.o
"_ERR_remove_thread_state", referenced from:
  _client_run in stunnel-client.o
"_SSL_CTX_set_psk_client_callback", referenced from:
  _context_init in stunnel-ctx.o
"_SSL_CTX_set_psk_server_callback", referenced from:
  _context_init in stunnel-ctx.o
"_TLSv1_1_client_method", referenced from:
  _parse_service_option in stunnel-options.o
"_TLSv1_1_server_method", referenced from:
  _parse_service_option in stunnel-options.o
"_TLSv1_2_client_method", referenced from:
  _parse_service_option in stunnel-options.o
"_TLSv1_2_server_method", referenced from:
  _parse_service_option in stunnel-options.o
"_X509_STORE_get1_certs", referenced from:
  _verify_callback in stunnel-verify.o
"_X509_check_email", referenced from:
  _verify_callback in stunnel-verify.o
"_X509_check_host", referenced from:
  _verify_callback in stunnel-verify.o
"_X509_check_ip_asc", referenced from:
  _verify_callback in stunnel-verify.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]: *** [stunnel] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

您需要传递参数以链接pthread和pie 不是
-pthread
而是
-lpthread
不是
-pie
而是
-lpie

另外,
/usr/local/openssl/
中没有lib,请尝试使用brew或macports安装它们,或者下载二进制文件

提示就在眼前:

叮当声:警告:编译期间未使用参数:'-pthread'

ld:警告:找不到选项'-L/usr/local/openssl/lib64'的目录


这个问题是因为installable依赖于OpenSSL,并且它无法找到与OpenSSL相关的库

这个问题可能有两个原因- 1.系统中未安装OpenSSL。在这种情况下,在安装stunnel之前,需要先安装OpenSSL

  • OpenSSL未安装在标准路径中

  • brew安装stunnel
    完成()。Linker表示找不到x86_64体系结构的符号。另外,如果您仔细阅读日志(
    ld:warning:directory not found for option'-L/usr/local/openssl/lib64'
    ),它还表示找不到openssl目录(32位和64位)。同时安装openssl并尝试再次构建它。或者只需安装自制软件和
    brew安装stunnel