如果您openssl使用以下方式安装,brew则可能需要设置LDFLAGS和CPPFLAGS, 来自:
brew info openssl\nRun Code Online (Sandbox Code Playgroud)\n\n\n\n\n此公式仅适用于 keg,这意味着它未符号链接到 /usr/local,\n 因为 Apple 已弃用 OpenSSL,转而使用自己的 TLS 和加密库。
\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\nRun 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\nRun Code Online (Sandbox Code Playgroud)\n\n您可以做的是创建一个符号链接,以便编译器可以找到这些库:
\n\n$ ln -s /usr/local/opt/openssl/include/openssl /usr/local/include\nRun Code Online (Sandbox Code Playgroud)\n\n这应该允许你编译node-v0.6.1:
$\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)\nRun Code Online (Sandbox Code Playgroud)\n