Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node.Js does not build successfully using --shared-openssl configure flag #35213

Closed
ghost opened this issue Sep 15, 2020 · 10 comments
Closed

Node.Js does not build successfully using --shared-openssl configure flag #35213

ghost opened this issue Sep 15, 2020 · 10 comments
Labels
build Issues and PRs related to build files or the CI. invalid Issues and PRs that are invalid. openssl Issues and PRs related to the OpenSSL dependency.

Comments

@ghost
Copy link

ghost commented Sep 15, 2020

  • Version: v14.5.0, v14.10.1, git master branch
  • Platform: Linux
  • Subsystem: Build

What steps will reproduce the bug?

python2.7 ./configure.py --debug --debug-node --shared-openssl --shared
make

How often does it reproduce? Is there a required condition?

100%

What is the expected behavior?

Building with --shared-openssl should succeed, yield a node.exe or node.dll (when building with --shared, as in my case) which links against an external openssl dll.

What do you see instead?

The build fails.

Additional information

I have tried this with all of the tags mentioned above, as well as the master branch from github without success.

@ghost
Copy link
Author

ghost commented Sep 15, 2020

Here's a snippet of the compiler output:

  g++ -o /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/gen/node_javascript.o /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/node_javascript.cc '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D__STDC_FORMAT_MACROS' '-DNODE_ARCH="x64"' '-DNODE_PLATFORM="linux"' '-DNODE_WANT_INTERNALS=1' '-DV8_DEPRECATION_WARNINGS=1' '-DNODE_OPENSSL_SYSTEM_CERT_PATH=""' '-DHAVE_INSPECTOR=1' '-DNODE_SHARED_MODE' '-D__POSIX__' '-DNODE_USE_V8_PLATFORM=1' '-DNODE_HAVE_I18N_SUPPORT=1' '-DDEBUG' '-DHAVE_OPENSSL=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_POSIX_C_SOURCE=200112' '-DNGHTTP2_STATICLIB' -I../src -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/include -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/src -I../deps/histogram/src -I../deps/uvwasi/include -I../deps/v8/include -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -I../deps/zlib -I../deps/llhttp/include -I../deps/cares/include -I../deps/uv/include -I../deps/nghttp2/lib/includes -I../deps/brotli/c/include  -Wall -Wextra -Wno-unused-parameter -pthread -Wall -Wextra -Wno-unused-parameter -m64 -fPIC -g -O0 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/.deps//mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/gen/node_javascript.o.d.raw   -c
  g++ -o /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/gen/src/node/inspector/protocol/Protocol.o /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/src/node/inspector/protocol/Protocol.cpp '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D__STDC_FORMAT_MACROS' '-DNODE_ARCH="x64"' '-DNODE_PLATFORM="linux"' '-DNODE_WANT_INTERNALS=1' '-DV8_DEPRECATION_WARNINGS=1' '-DNODE_OPENSSL_SYSTEM_CERT_PATH=""' '-DHAVE_INSPECTOR=1' '-DNODE_SHARED_MODE' '-D__POSIX__' '-DNODE_USE_V8_PLATFORM=1' '-DNODE_HAVE_I18N_SUPPORT=1' '-DDEBUG' '-DHAVE_OPENSSL=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_POSIX_C_SOURCE=200112' '-DNGHTTP2_STATICLIB' -I../src -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/include -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/src -I../deps/histogram/src -I../deps/uvwasi/include -I../deps/v8/include -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -I../deps/zlib -I../deps/llhttp/include -I../deps/cares/include -I../deps/uv/include -I../deps/nghttp2/lib/includes -I../deps/brotli/c/include  -Wall -Wextra -Wno-unused-parameter -pthread -Wall -Wextra -Wno-unused-parameter -m64 -fPIC -g -O0 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/.deps//mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/gen/src/node/inspector/protocol/Protocol.o.d.raw   -c
  g++ -o /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/gen/src/node/inspector/protocol/NodeWorker.o /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/src/node/inspector/protocol/NodeWorker.cpp '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D__STDC_FORMAT_MACROS' '-DNODE_ARCH="x64"' '-DNODE_PLATFORM="linux"' '-DNODE_WANT_INTERNALS=1' '-DV8_DEPRECATION_WARNINGS=1' '-DNODE_OPENSSL_SYSTEM_CERT_PATH=""' '-DHAVE_INSPECTOR=1' '-DNODE_SHARED_MODE' '-D__POSIX__' '-DNODE_USE_V8_PLATFORM=1' '-DNODE_HAVE_I18N_SUPPORT=1' '-DDEBUG' '-DHAVE_OPENSSL=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_POSIX_C_SOURCE=200112' '-DNGHTTP2_STATICLIB' -I../src -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/include -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/src -I../deps/histogram/src -I../deps/uvwasi/include -I../deps/v8/include -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -I../deps/zlib -I../deps/llhttp/include -I../deps/cares/include -I../deps/uv/include -I../deps/nghttp2/lib/includes -I../deps/brotli/c/include  -Wall -Wextra -Wno-unused-parameter -pthread -Wall -Wextra -Wno-unused-parameter -m64 -fPIC -g -O0 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/.deps//mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/gen/src/node/inspector/protocol/NodeWorker.o.d.raw   -c
In file included from /usr/include/openssl/x509.h:25:0,
                 from /usr/include/openssl/ssl.h:20,
                 from ../src/node_crypto.h:39,
                 from ../src/node_crypto.cc:22:
../src/node_crypto.cc: In member function ‘virtual bool node::crypto::RSAPSSKeyPairGenerationConfig::Configure(const EVPKeyCtxPointer&)’:
../src/node_crypto.cc:6098:11: error: ‘EVP_PKEY_OP_TYPE_KEYGEN’ was not declared in this scope
       if (EVP_PKEY_CTX_set_rsa_pss_keygen_md(ctx.get(), md_) <= 0)
           ^
../src/node_crypto.cc:6098:11: note: suggested alternative: ‘EVP_PKEY_OP_TYPE_NOGEN’
../src/node_crypto.cc: In function ‘void node::crypto::InitCryptoOnce()’:
../src/node_crypto.cc:6854:5: error: ‘OPENSSL_INIT_set_config_filename’ was not declared in this scope
     OPENSSL_INIT_set_config_filename(settings, conf);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/node_crypto.cc:6854:5: note: suggested alternative: ‘OPENSSL_INIT_set_config_appname’
     OPENSSL_INIT_set_config_filename(settings, conf);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     OPENSSL_INIT_set_config_appname
  g++ -o /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/gen/src/node/inspector/protocol/NodeTracing.o /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/src/node/inspector/protocol/NodeTracing.cpp '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D__STDC_FORMAT_MACROS' '-DNODE_ARCH="x64"' '-DNODE_PLATFORM="linux"' '-DNODE_WANT_INTERNALS=1' '-DV8_DEPRECATION_WARNINGS=1' '-DNODE_OPENSSL_SYSTEM_CERT_PATH=""' '-DHAVE_INSPECTOR=1' '-DNODE_SHARED_MODE' '-D__POSIX__' '-DNODE_USE_V8_PLATFORM=1' '-DNODE_HAVE_I18N_SUPPORT=1' '-DDEBUG' '-DHAVE_OPENSSL=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_POSIX_C_SOURCE=200112' '-DNGHTTP2_STATICLIB' -I../src -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/include -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/src -I../deps/histogram/src -I../deps/uvwasi/include -I../deps/v8/include -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -I../deps/zlib -I../deps/llhttp/include -I../deps/cares/include -I../deps/uv/include -I../deps/nghttp2/lib/includes -I../deps/brotli/c/include  -Wall -Wextra -Wno-unused-parameter -pthread -Wall -Wextra -Wno-unused-parameter -m64 -fPIC -g -O0 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/.deps//mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/gen/src/node/inspector/protocol/NodeTracing.o.d.raw   -c
  g++ -o /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/gen/src/node/inspector/protocol/NodeRuntime.o /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/src/node/inspector/protocol/NodeRuntime.cpp '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D__STDC_FORMAT_MACROS' '-DNODE_ARCH="x64"' '-DNODE_PLATFORM="linux"' '-DNODE_WANT_INTERNALS=1' '-DV8_DEPRECATION_WARNINGS=1' '-DNODE_OPENSSL_SYSTEM_CERT_PATH=""' '-DHAVE_INSPECTOR=1' '-DNODE_SHARED_MODE' '-D__POSIX__' '-DNODE_USE_V8_PLATFORM=1' '-DNODE_HAVE_I18N_SUPPORT=1' '-DDEBUG' '-DHAVE_OPENSSL=1' '-DUCONFIG_NO_SERVICE=1' '-DU_ENABLE_DYLOAD=0' '-DU_STATIC_IMPLEMENTATION=1' '-DU_HAVE_STD_STRING=1' '-DUCONFIG_NO_BREAK_ITERATION=0' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D_POSIX_C_SOURCE=200112' '-DNGHTTP2_STATICLIB' -I../src -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/include -I/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj/gen/src -I../deps/histogram/src -I../deps/uvwasi/include -I../deps/v8/include -I../deps/icu-small/source/i18n -I../deps/icu-small/source/common -I../deps/zlib -I../deps/llhttp/include -I../deps/cares/include -I../deps/uv/include -I../deps/nghttp2/lib/includes -I../deps/brotli/c/include  -Wall -Wextra -Wno-unused-parameter -pthread -Wall -Wextra -Wno-unused-parameter -m64 -fPIC -g -O0 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/.deps//mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/gen/src/node/inspector/protocol/NodeRuntime.o.d.raw   -c
libnode.target.mk:346: recipe for target '/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/src/node_crypto.o' failed
make[1]: *** [/mnt/c/Users/BrianCrowder/3rdparty/node/out/Release/obj.target/libnode/src/node_crypto.o] Error 1
make[1]: *** Waiting for unfinished jobs....
rm 646a0e319de5bf142b9470be576e5827f0073f18.intermediate ef0c757ee966401ff4518fff1e8ccddf6ce7b10b.intermediate
Makefile:104: recipe for target 'node' failed
make: *** [node] Error 2

@bnoordhuis
Copy link
Member

Your copy of openssl is incompatible - probably too old.

Seeing it's missing EVP_PKEY_CTX_set_rsa_pss_keygen_md(), that probably means it's version 1.0.2 or 1.1.0 but you need 1.1.1.

Closing, not a bug.

@bnoordhuis bnoordhuis added build Issues and PRs related to build files or the CI. invalid Issues and PRs that are invalid. openssl Issues and PRs related to the OpenSSL dependency. labels Sep 16, 2020
@ghost
Copy link
Author

ghost commented Sep 16, 2020

I'm pretty sure I am using OpenSSL 1.1.1 -- here's the output from apt search:

libssl-dev/bionic-updates,bionic-security,now 1.1.1-1ubuntu2.1~18.04.6 amd64 [installed]
  Secure Sockets Layer toolkit - development files
openssl/bionic-updates,bionic-security,now 1.1.1-1ubuntu2.1~18.04.6 amd64 [installed]
  Secure Sockets Layer toolkit - cryptographic utility

... is there some more precise way to identify?

@ghost
Copy link
Author

ghost commented Sep 16, 2020

Also:

/usr/include/openssl$ grep EVP_PKEY_CTX_set_rsa_pss_keygen_md *.h
rsa.h:# define  EVP_PKEY_CTX_set_rsa_pss_keygen_md(ctx, md) \

@mscdex
Copy link
Contributor

mscdex commented Sep 16, 2020

You need a newer (or more complete) version of OpenSSL 1.1.1. In general it's best to match the version of OpenSSL bundled with whichever version/branch of node you're compiling for. Node v14.x currently ships with OpenSSL 1.1.1g for example.

A quick search reveals that a bugfix for EVP_PKEY_OP_TYPE_KEYGEN being undefined was introduced in 1.1.1a and OPENSSL_INIT_set_config_filename was introduced in 1.1.1b (check the crypto.h diff).

@ghost
Copy link
Author

ghost commented Sep 19, 2020

Is it possible/reasonable to consider this a bug in nodejs' configure logic (not reporting the version dependency)?

@bnoordhuis
Copy link
Member

No. Building against shared libraries is effectively not a supported configuration. We allow it because it's something distro vendors want/need but with the understanding that they're on the hook when it breaks, not us.

@ghost
Copy link
Author

ghost commented Sep 21, 2020

That's reasonable, thanks! FWIW, I am not a distro-vendor, and being able to dynamically link OpenSSL is useful to me because I was running into a bug linking node w/ another binary that also has OpenSSL linked. (Only adding this color in case it influences future decisions to abandoned the shared-lib configuration support.

@D4V3M0NK
Copy link

D4V3M0NK commented Feb 17, 2021

@mscdex could I ask: how does one know what version of OpenSSL node is bundled with? I'm running into the same issue with Ubuntu 18.04 using the certified OpenSSL libraries (1.1.1) and I'm trying to build node against this library already on my system.

$ dpkg-query --list | grep openssl
ii  libxmlsec1-openssl:amd64               1.2.25-1build1                                  amd64        Openssl engine for the XML security library
ii  openssl                                1.1.1-1ubuntu2.fips.2.1~18.04.7.1               amd64        Secure Sockets Layer toolkit - cryptographic utility
ii  python3-openssl                        17.5.0-1ubuntu1                                 all          Python 3 wrapper around the OpenSSL library

@mscdex
Copy link
Contributor

mscdex commented Feb 18, 2021

@D4V3M0NK You should be able to consult https://nodejs.org/dist/index.json or https://nodejs.org/dist/index.tab to get technical information about each release, including the OpenSSL version that is ordinarily bundled with node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. invalid Issues and PRs that are invalid. openssl Issues and PRs related to the OpenSSL dependency.
Projects
None yet
Development

No branches or pull requests

4 participants
@mscdex @bnoordhuis @D4V3M0NK and others