Linking local Openssl to Nodejs C++ addon

Viewed 586

I am writing a C++ addon for Nodejs which uses OpenSSL 3 and I keep getting this error when trying to compile the code with the command 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"

I can see that the OpenSSL used here is included from the NodeJS folder, is there any way to link the OpenSSL library I installed with homebrew on my mac M1?

My binding.gyp file looks like this:

{
  "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"
        ]
    }
    ]
}
1 Answers
Related