Thanks to visit codestin.com
Credit goes to github.com

Skip to content

"C++20 or later required." when building with Electron 32 #2006

Closed
@serggl

Description

@serggl

System information

  • node version: v20.17.0
  • yarn version: 1.22.22
  • OS/version/architecture: MacOS 15.0.1
  • Applicable nodegit version: x64

Looks like Electron 32+ will only build with C++20 and higher due to a change in v8: electron/electron#43555

At the moment nodegit just does not compile with Electron 32.2.0 or 33.0.0-beta8. The error is:

In file included from ../src/async_baton.cc:1:
In file included from ../src/../include/async_baton.h:7:
In file included from ../../@axosoft/nan/nan.h:62:
In file included from /Users/sergeyglukhov/Library/Caches/node-gyp/32.2.0/include/node/node.h:79:
In file included from
/Users/sergeyglukhov/Library/Caches/node-gyp/32.2.0/include/node/v8.h:23:
In file included from /Users/sergeyglukhov/Library/Caches/node-gyp/32.2.0/include/node/cppgc/common.h:8:
/Users/sergeyglukhov/Library/Caches/node-gyp/32.2.0/include/node/v8config.h:13:2: error: "C++20 or later required."
   13 | #error "C++20 or later required."
      |  ^
In file included from ../src/async_baton.cc:1:
In file included from ../src/../include/async_baton.h:7:
../../@axosoft/nan/nan.h:700:39: error: no member named 'IdleNotificationDeadline' in 'v8::Isolate'
  700 |     return v8::
Isolate::GetCurrent()->IdleNotificationDeadline(
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~  ^
../../@axosoft/nan/nan.h:2560:8: error: no member named 'SetAccessor' in 'v8::ObjectTemplate'
2560 |   tpl->SetAccessor(
      |   ~~~~~^
../../@axosoft/nan/nan.h:2608:8: error: no member named 'SetAccessor' in 'v8::ObjectTemplate'
 2608 |   tpl->SetAccessor(
      |   ~~~~~^
../../@axosoft/nan/nan.h:2654:15: error: no member named 'SetAccessor' in 'v8::Object'
 2654 |   return obj->SetAccessor

From what I could found, the error comes from 2 sources:

  1. nan dependency, or actually it's fork @axosoft/nan. The 'no member named' problem was fixed in the original nan repo, so it just needs to merged into the fork: support for electron 32 nodejs/nan#973
  2. nodegit scripts? Looks like it uses C++17 to build for Electron 20 and above: https://github.com/nodegit/nodegit/blob/master/utils/defaultCxxStandard.js#L15 I guess this needs to be also adjusted for Electron 32 and above due to the mentioned change in Electron

I tried to patch for p1 by making a fork of @axosoft/nan and then replacing the dependency via "resolutions"entry in my package.json, but the error message is the same, though the surrounding differs and has much less details:

../vendor/libssh2/src/session.c:862:9: warning: variable 'packets_left' set but not used [-Wunused-but-set-variable]
  862 |     int packets_left = 0
;
      |         ^
1 warning generated.
CC(target) Release/obj.target/libssh2/vendor/libssh2/src/userauth.o
CC(target) Release/obj.target/libssh2/vendor/libssh2/src/agent_win.o
LIBTOOL-STATIC Release/ssh2.a
CC(target) Release/obj.target/ntlmclient/vendor/libgit2/deps/ntlmclient/ntlm.o
CC(target) Release/obj.target/ntlmclient/vendor/libgit2/deps/ntlmclient/unicode_builtin.o
CC(target) Release/obj.target/ntlmclient/vendor/libgit2/deps/ntlmclient/util.o
CC(target) Release/obj.target/ntlmclient/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.o
../vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c:82:11: warning: 'CC_MD4' is deprecated: first deprecated in macOS 10.15 - This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger). [-Wdeprecated-declarations]
   82 |         return !!CC_MD4(in,
in_len, out);
      |                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonDigest.h:115:23: note: 'CC_MD4' has been explicitly marked deprecated here
  115 | extern unsigned char
*CC_MD4(const void *data, CC_LONG len, unsigned char *md)
      |                       ^
1 warning generated.
LIBTOOL-STATIC Release/ntlmclient.a
CXX(target) Release/obj.target/nodegit/src/async_baton.o
In file included from ../src/async_baton.cc:1:
In file included from ../src/../include/async_baton.h:7:
In file included from ../../@axosoft/nan/nan.h:62
:
In file included from /Users/sergeyglukhov/Library/Caches/node-gyp/32.2.0/include/node/node.h:79:
In file included from /Users/sergeyglukhov/Library/Caches/node-gyp/32.2.0/include/node/v8.h:23:
In file included from /Users/sergeyglukhov/Library/Caches/node-gyp/32.2.0/include/node/cppgc/common.h:8:
/Users/sergeyglukhov/Library/Caches/node-gyp/32.2.0/include/node/v8config.h:13:2: error: "C++20 or later required."
   13 | #error "C++20 or later required."
      |  ^
1
error generated.
make: *** [Release/obj.target/nodegit/src/async_baton.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions