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

Fix builds for Electron 29 #966

Merged
merged 1 commit into from
Feb 27, 2024
Merged

Conversation

indutny-signal
Copy link
Contributor

ObjectTemplate::SetAccessor signature has changed in the V8 >= 12, and no longer accepts v8::AccessControl parameter. The v8::AccessControl enum is in fact a single value now so no public users of nan would be broken if we just stop passing it down to V8.

`ObjectTemplate::SetAccessor` signature has changed in the V8 >= 12, and
no longer accepts `v8::AccessControl` parameter. The `v8::AccessControl`
enum is in fact a single value now so no public users of nan would be
broken if we just stop passing it down to V8.
@indutny-signal
Copy link
Contributor Author

cc @kkoopa

@kkoopa
Copy link
Collaborator

kkoopa commented Feb 27, 2024

Thank you. I'll get this out next week when I am home.

@indutny-signal indutny-signal deleted the fix/electron-29 branch February 27, 2024 16:57
@indutny-signal
Copy link
Contributor Author

Yay! Thank you so much!

@chrbongardt
Copy link

Hey @kkoopa could we please get a release with this fix <3

@@ -2550,7 +2550,9 @@ NAN_DEPRECATED inline void SetAccessor(
, getter_
, setter_
, obj
#if !defined(V8_MAJOR_VERSION) || V8_MAJOR_VERSION < 12

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Electron 28 ships with V8 12.0 and it still supports the AccessControl argument. Using nan 2.19.0 will break module compilation for these users. User can workaround by strict versioning to 2.18.0 instead of ^2.18.0. Should the check be based on module version instead, ex: https://github.com/electron/electron/blob/main/patches/nan/api_remove_allcan_read_write.patch ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh gosh, I think that'd be better indeed. Did V8 make a breaking API change within the same major release? How come 12.0 isn't the same as 12.2?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's some confusion here about V8's versioning -- V8 doesn't use semver, so major vs minor versions don't carry different meaning for API changes. Rather, for historical reasons, it's synchronised to the chromium release cycle, where V8 12.2 is the V8 version that ships with Chrome 122. It's a bit unfortunate but we're stuck with it for now. We do have a rolling stability guarantee that functions will get a deprecation warning for one release before being removed (see https://v8.dev/docs/api), and this was unfortunately accidentally not followed in this case, but that doesn't prevent API changes across multiple "minor" version bumps.

@kkoopa
Copy link
Collaborator

kkoopa commented Apr 16, 2024 via email

springmeyer added a commit to springmeyer/maplibre-gl-js that referenced this pull request May 16, 2024
The maplibre-gl-js install currently fails on arm64 macs when running
Node >= 21.

The error is:

```
../../nan/nan.h:2546:8: error: no matching member function for call to 'SetAccessor'
tpl->SetAccessor(
```

The context is that `maplibre-gl-js` depends on `node-canvas@2.x` which has a
dependency on the `nan` package and `nan` 2.17 had a bug that surfaced with
node v21: nodejs/nan#966.

Additionally `node-canvas` does not currently provide pre-compiled
binaries for Arm64, so a source compile is needed.

So, the solution here is to upgrade the `nan` version to the latest
release which fixes support with recent node.
HarelM pushed a commit to maplibre/maplibre-gl-js that referenced this pull request May 17, 2024
The maplibre-gl-js install currently fails on arm64 macs when running
Node >= 21.

The error is:

```
../../nan/nan.h:2546:8: error: no matching member function for call to 'SetAccessor'
tpl->SetAccessor(
```

The context is that `maplibre-gl-js` depends on `node-canvas@2.x` which has a
dependency on the `nan` package and `nan` 2.17 had a bug that surfaced with
node v21: nodejs/nan#966.

Additionally `node-canvas` does not currently provide pre-compiled
binaries for Arm64, so a source compile is needed.

So, the solution here is to upgrade the `nan` version to the latest
release which fixes support with recent node.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants