Mac安装openssl,环境找不到

Joh*_*ohn 1 macos openssl node.js

我已经安装了openssl。当我输入openssl时,命令行可以识别它。但是我的节点配置找不到它。

看下面的图片

在此输入图像描述

我尝试在 .bash_profile 中添加路径

并尝试了一些技巧 但没有一个有效

nba*_*ari 5

如果您openssl使用以下方式安装,brew则可能需要设置LDFLAGSCPPFLAGS, 来自:

\n\n
brew info openssl\n
Run Code Online (Sandbox Code Playgroud)\n\n
\n

此公式仅适用于 keg,这意味着它未符号链接到 /usr/local,\n 因为 Apple 已弃用 OpenSSL,转而使用自己的 TLS 和加密库。

\n
\n\n
If you need to have this software first in your PATH run:\n  echo \'export PATH="/usr/local/opt/openssl/bin:$PATH"\' >> ~/.zshrc\n\nFor compilers to find this software you may need to set:\n    LDFLAGS:  -L/usr/local/opt/openssl/lib\n    CPPFLAGS: -I/usr/local/opt/openssl/include\nFor pkg-config to find this software you may need to set:\n    PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig\n
Run Code Online (Sandbox Code Playgroud)\n\n

如果您尝试链接,您将收到如下警告:

\n\n
$\xc2\xa0brew link --force openssl\nWarning: Refusing to link: openssl\nLinking keg-only openssl means you may end up linking against the insecure,\ndeprecated system OpenSSL while using the headers from Homebrew\'s openssl.\nInstead, pass the full include/library paths to your compiler e.g.:\n  -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib\n
Run Code Online (Sandbox Code Playgroud)\n\n

您可以做的是创建一个符号链接,以便编译器可以找到这些库:

\n\n
$ ln -s /usr/local/opt/openssl/include/openssl /usr/local/include\n
Run Code Online (Sandbox Code Playgroud)\n\n

这应该允许你编译node-v0.6.1

\n\n
$\xc2\xa0./configure\nChecking for program g++ or c++          : /usr/bin/g++\nChecking for program cpp                 : /usr/bin/cpp\nChecking for program ar                  : /usr/bin/ar\nChecking for program ranlib              : /usr/bin/ranlib\nChecking for g++                         : ok\nChecking for program gcc or cc           : /usr/bin/gcc\nChecking for gcc                         : ok\nChecking for library dl                  : yes\nChecking for openssl                     : yes\nChecking for library util                : yes\nChecking for library rt                  : not found\nChecking for fdatasync(2) with c++       : no\n\'configure\' finished successfully (0.998s)\n
Run Code Online (Sandbox Code Playgroud)\n