【发布时间】:2021-12-31 11:11:25
【问题描述】:
我正在为使用 OpenSSL 3 的 Nodejs 编写 C++ 插件,但在尝试使用命令 node-gyp build 编译代码时,我不断收到此错误:
/Users/myuser/Library/Caches/node-gyp/17.0.1/include/node/openssl/macros.h:155:4: error: "OPENSSL_API_COMPAT expresses an impossible API compatibility level"
我可以看到这里使用的 OpenSSL 包含在 NodeJS 文件夹中,有什么方法可以将我安装的 OpenSSL 库与我的 mac M1 上的 homebrew 链接起来?
我的 binding.gyp 文件如下所示:
{
"targets": [
{
"target_name": "module",
"include_dirs": [ "/opt/homebrew/opt/openssl@3/include" ],
"sources": [ "./module.cpp" ],
"libraries": [
"/opt/homebrew/opt/openssl@3/lib/libcrypto.3.dylib",
"/opt/homebrew/opt/openssl@3/lib/libcrypto.a",
"/opt/homebrew/opt/openssl@3/lib/libcrypto.dylib"
]
}
]
}
【问题讨论】: