From 4d635321de2d9a9b72112978ccde21e05c62ca32 Mon Sep 17 00:00:00 2001 From: Ivan Bohdan Date: Tue, 17 Nov 2026 10:43:00 +0200 Subject: [PATCH] fix(build): hide symbols from static deps on Linux The Linux static build re-exported every symbol of the bundled libcurl, OpenSSL, etc. from node_libcurl.node. When the host process already has a different libcrypto loaded (Electron links libcups/libgssapi_krb5, which pull in the system OpenSSL), the addon's internal OpenSSL calls bind to the system copy. On Fedora 45 (OpenSSL 4.0) this makes the bundled OpenSSL 3.5 call OpenSSL 4's conf_ssl_name_find() and segfault on the first TLS connection, crashing Insomnia at startup. Link with -Wl,--exclude-libs,ALL so symbols from static archives are not exported and all internal references bind to the bundled copy. Co-Authored-By: Claude Opus 5.5 --- binding.gyp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/binding.gyp b/binding.gyp index 004b577d..de69e8df 100644 --- a/binding.gyp +++ b/binding.gyp @@ -156,6 +156,19 @@ 'defines': [ 'CURL_STATICLIB', ], + # Do not re-export symbols coming from the statically linked + # archives (libcurl, OpenSSL, nghttp2, ...). Without this the + # addon exports its bundled OpenSSL symbols, and the dynamic + # linker resolves its *internal* calls to whatever libcrypto + # is already loaded in the process (e.g. pulled in by Electron + # via libcups / libgssapi_krb5). On distros shipping a + # different OpenSSL major version (Fedora 45: OpenSSL 4) the + # bundled OpenSSL 3.x ends up calling into OpenSSL 4 and + # segfaults in conf_ssl_name_find(). Hiding the symbols makes + # every reference bind to the bundled copy at link time. + 'ldflags': [ + '-Wl,--exclude-libs,ALL', + ], 'conditions': [ ['curl_libraries==""', { 'libraries': [