Skip to content

Broken Electron header v8-primitive.h due to class/macro order in 42, 43, 44 (41 didn't have the misplaced macro) #53284

Closed

Description

@danielweck

Preflight Checklist

Electron Version

44.0.0

What operating system(s) are you using?

Ubuntu

Operating System Version

22.04

What arch are you using?

x64

Last Known Working Electron version

41

Does the issue also appear in Chromium / Google Chrome?

I don't know how to test

Expected Behavior

When compiling a native C++ addon, it should succeed.

Actual Behavior

The compilation breaks because of incorrect Electron headers?

Testcase Gist URL

No response

Additional Information

NodeJS v24.18.1 v8-primitive.h:
https://github.com/nodejs/node/blob/9623d9ad85d37d2f0610ec4a82b48182cf2c6061/deps/v8/include/v8-primitive.h#L676-L681

  class V8_EXPORT Value {
   public:
    V8_DEPRECATE_SOON(
        "Prefer using String::ValueView if you can, or string->Write to a "
        "buffer if you cannot.")
    Value(Isolate* isolate, Local<v8::Value> obj);

By comparison, when downloaded from https://www.electronjs.org/headers/v44.0.0/node-v44.0.0-headers.tar.gz
(node-gyp --verbose configure --target=44.0.0 --arch=x64 --dist-url=https://electronjs.org/headers)

  class V8_DEPRECATED(
      "Prefer using String::ValueView if you can, or string->Write to a "
      "buffer if you cannot.") V8_EXPORT Value {
   public:
    V8_DEPRECATED(
        "Prefer using String::ValueView if you can, or string->Write to a "
        "buffer if you cannot.")
    Value(Isolate* isolate, Local<v8::Value> obj);

...note the duplicate macro V8_DEPRECATED causing error:

/home/runner/.cache/node-gyp/44.0.0/include/node/v8config.h:865:20: error: expected identifier before ‘__attribute__’
  865 | # define V8_EXPORT __attribute__((visibility("default")))
      |                    ^~~~~~~~~~~~~
/home/runner/.cache/node-gyp/44.0.0/include/node/v8-primitive.h:657:32: note: in expansion of macro ‘V8_EXPORT’
  657 |       "buffer if you cannot.") V8_EXPORT Value {
      |                                ^~~~~~~~~
In file included from /home/runner/.cache/node-gyp/44.0.0/include/node/v8-object.h:14,
                 from /home/runner/.cache/node-gyp/44.0.0/include/node/v8-array-buffer.h:14,
                 from /home/runner/.cache/node-gyp/44.0.0/include/node/v8.h:24,
                 from /home/runner/.cache/node-gyp/44.0.0/include/node/node.h:80,
                 from ../node_modules/nan/nan.h:67,

Activity

  1. added theissue type on Aug 28, 2026
  2. moved this to 👀 Unsorted Items in 44-x-yon Aug 28, 2026
  3. danielweck commented on Aug 28, 2026

    @danielweck
    Author

    I am closing this for now, as the source of the error is likely at my end (I have a hard time believing that the V8_DEPRECATED or V8_DEPRECATE_SOON macro situated before the V8_EXPORT macro would cause C++ compiler issues).

    Here is the diff from 41 to 44:

    41:

      class V8_EXPORT Value {
       public:
        V8_DEPRECATE_SOON(
            "Prefer using String::ValueView if you can, or string->Write to a "
            "buffer if you cannot.")
        Value(Isolate* isolate, Local<v8::Value> obj);
    

    42:

      class V8_DEPRECATE_SOON(
          "Prefer using String::ValueView if you can, or string->Write to a "
          "buffer if you cannot.") V8_EXPORT Value {
       public:
        V8_DEPRECATED(
            "Prefer using String::ValueView if you can, or string->Write to a "
            "buffer if you cannot.")
        Value(Isolate* isolate, Local<v8::Value> obj);
    

    43:

      class V8_DEPRECATED(
          "Prefer using String::ValueView if you can, or string->Write to a "
          "buffer if you cannot.") V8_EXPORT Value {
       public:
        V8_DEPRECATED(
            "Prefer using String::ValueView if you can, or string->Write to a "
            "buffer if you cannot.")
        Value(Isolate* isolate, Local<v8::Value> obj);
    

    44:

      class V8_DEPRECATED(
          "Prefer using String::ValueView if you can, or string->Write to a "
          "buffer if you cannot.") V8_EXPORT Value {
       public:
        V8_DEPRECATED(
            "Prefer using String::ValueView if you can, or string->Write to a "
            "buffer if you cannot.")
        Value(Isolate* isolate, Local<v8::Value> obj);
    
  4. danielweck commented on Aug 28, 2026

    @danielweck
    Author

    Note that in NodeJS 26.8.1, class V8_EXPORT Value is neither V8_DEPRECATE_SOON or V8_DEPRECATED, so I wonder why the Electron headers for Electron 42, 43 and 44 (NodeJS 24) applies the deprecation on the class? (also, isn't the macro located in the wrong slot?)

    https://github.com/nodejs/node/blob/7be6d3af31a65adea57c94c41e50c2b071ed0b3a/deps/v8/include/v8-primitive.h#L622-L627

      class V8_EXPORT Value {
       public:
        V8_DEPRECATE_SOON(
            "Prefer using String::ValueView if you can, or string->Write to a "
            "buffer if you cannot.")
        Value(Isolate* isolate, Local<v8::Value> obj);
    
  5. danielweck commented on Aug 28, 2026

    @danielweck
    Author

    Alright, I worked-around this problem by disabling the V8_DEPRECATED in my binding.gyp:

    'defines!': ['V8_DEPRECATION_WARNINGS=1']

    For reference:

    https://github.com/nodejs/node/blob/9623d9ad85d37d2f0610ec4a82b48182cf2c6061/deps/v8/include/v8config.h#L607-L611

    #if defined(V8_DEPRECATION_WARNINGS)
    # define V8_DEPRECATED(message) [[deprecated(message)]]
    #else
    # define V8_DEPRECATED(message)
    #endif
    

    So, am I right in assuming that the class/macro order is incorrect? See:

    class V8_DEPRECATED("...") V8_EXPORT Value

    vs.

    V8_DEPRECATED("...") class V8_EXPORT Value

    If so, I am amazed nobody reported this problem since it exists in 42, 43, and now 44.
    If not, what could possibly cause the breakage at my end??

  6. changed the title [-]Broken Electron 44.0.0 headers `v8-primitive.h`[/-] [+]Broken Electron header `v8-primitive.h` due to class/macro order in `42`, `43`, `44` (`41` didn't have the misplaced macro)[/+] on Aug 28, 2026
  7. nmggithub commented on Aug 28, 2026

    @nmggithub
    Contributor

    Hello! Taking a look at this, and this appears to maybe be a compiler compatibility issue. Can you try compiling with GCC 13+ or Clang?

  8. danielweck commented on Aug 28, 2026

    @danielweck
    Author

    Thank you for taking the time to reply, much appreciated.
    I need to check the build logs to be sure, but I was testing on the default SBOM for the Ubuntu 22.04 GitHub Actions runner.

  9. nmggithub commented on Aug 28, 2026

    @nmggithub
    Contributor

    I was testing on the default SBOM for the Ubuntu 22.04 GitHub Actions runner.

    From what I can find, Ubuntu 22.04 uses GCC 11 by default.

  10. 8 remaining items

  11. moved this from 👀 Unsorted Items to 👍 Does Not Block Stable in 44-x-yon Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions