Skip to content

Electron 20 compatibility #867

Closed

Description

@kryops

Hi there,

when upgrading to Electron 20, better-sqlite3 does not build any longer.

On macOS, I get the following error:

CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
./src/util/macros.lzz:157:21: error: no member named 'AccessorSignature' in namespace 'v8'
                v8::AccessorSignature::New(isolate, recv)
                ~~~~^
./src/objects/database.lzz:180:21: warning: variable 'status' set but not used [-Wunused-but-set-variable]
                int status = sqlite3_db_config(db_handle, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, 1, NULL);
                    ^
./src/util/binder.lzz:37:51: error: no member named 'CreationContext' in 'v8::Object'
                v8::Local<v8::Context> ctx = obj->CreationContext();
                                             ~~~~~^

On Windows (using Visual Studio 2017), I get the following:

c:\users\...\.electron-gyp\20.0.3\include\node\v8-callbacks.h(221): error C2062: type 'int' unexpected
c:\users\...\.electron-gyp\20.0.3\include\node\v8-callbacks.h(335): error C2062: type 'int' unexpected
c:\users\...\.electron-gyp\20.0.3\include\node\v8-isolate.h(292): error C3646: 'legacy_oom_error_callback': unknown override specifier
c:\users\...\.electron-gyp\20.0.3\include\node\v8-isolate.h(292): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
c:\users\...\.electron-gyp\20.0.3\include\node\v8-isolate.h(1482): error C2061: syntax error: identifier 'LegacyOOMErrorCallback'
c:\users\...\.electron-gyp\20.0.3\include\node\v8-isolate.h(1545): error C2061: syntax error: identifier 'WasmDynamicTieringEnabledCallback'
c:\users\...\.electron-gyp\20.0.3\include\node\v8-initialization.h(290): error C2061: syntax error: identifier 'LegacyOOMErrorCallback'
c:\...\node_modules\better-sqlite3\build\src\objects\database.lzz(453): warning C4309: 'static_cast': truncation of constant value 
c:\...\node_modules\better-sqlite3\build\src\util\macros.lzz(157): error C2039: 'AccessorSignature': is not a member of 'v8'
  c:\users\...\.electron-gyp\20.0.3\include\node\v8.h(71): note: see declaration of 'v8'
c:\...\node_modules\better-sqlite3\build\src\util\macros.lzz(157): error C3083: 'AccessorSignature': the symbol to the left of a '::' must be a type
c:\...\node_modules\better-sqlite3\build\src\util\macros.lzz(157): error C2039: 'New': is not a member of 'v8'
  c:\users\...\.electron-gyp\20.0.3\include\node\v8.h(71): note: see declaration of 'v8'
c:\...\node_modules\better-sqlite3\build\src\util\macros.lzz(157): error C3861: 'New': identifier not found
c:\...\node_modules\better-sqlite3\build\src\util\binder.lzz(37): error C2039: 'CreationContext': is not a member of 'v8::Object'
C:\Users\...\.electron-gyp\20.0.3\include\node\v8-value-serializer.h(21): message : see declaration of 'v8::Object'

On Windows (using the Visual Studio 2022 Build Tools):

C:\Users\...\.electron-gyp\20.0.3\include\node\v8-isolate.h(292,5): warning C4996: 'v8::LegacyOOMErrorCallback': Use OOMErrorCallback (https://crbug.com/1323177)
C:\Users\...\.electron-gyp\20.0.3\include\node\v8-isolate.h(1482,27): warning C4996: 'v8::LegacyOOMErrorCallback': Use OOMErrorCallback (https://crbug.com/1323177)
C:\Users\...\.electron-gyp\20.0.3\include\node\v8-isolate.h(1545,45): warning C4996: 'v8::WasmDynamicTieringEnabledCallback': Dynamic tiering is now enabled by default
C:\Users\...\.electron-gyp\20.0.3\include\node\v8-initialization.h(290,43): warning C4996: 'v8::LegacyOOMErrorCallback': Use OOMErrorCallback (https://crbug.com/1323177)
C:\...\node_modules\better-sqlite3\build\src\util\macros.lzz(157,21): error C2039: 'AccessorSignature': is not a member of 'v8'
C:\Users\...\.electron-gyp\20.0.3\include\node\v8.h(71): message : see declaration of 'v8'
C:\...\node_modules\better-sqlite3\build\src\util\macros.lzz(157,21): error C3083: 'AccessorSignature': the symbol to the left of a '::' must be a type
C:\...\node_modules\better-sqlite3\build\src\util\macros.lzz(157,40): error C2039: 'New': is not a member of 'v8'
C:\Users\...\.electron-gyp\20.0.3\include\node\v8.h(71): message : see declaration of 'v8'
C:\...\node_modules\better-sqlite3\build\src\util\macros.lzz(157,43): error C3861: 'New': identifier not found
C:\...\node_modules\better-sqlite3\build\src\util\binder.lzz(37,51): error C2039: 'CreationContext': is not a member of 'v8::Object'
C:\Users\...\.electron-gyp\20.0.3\include\node\v8-value-serializer.h(21): message : see declaration of 'v8::Object'

Related: #126 (comment)

Thanks for looking into it!

Activity

  1. kryops commented on Aug 25, 2022

    @kryops
    Author

    😳 my bad, somehow I did not find the existing issue. Should we close this one then, or leave it open for better "Electron 20" visibility?

  2. cshotton commented on Sep 26, 2022

    @cshotton

    Is there a prognosis for when the next release might be that will include this pull request? It'd be great to get Electron builds working again.

  3. 122330602 commented on Sep 27, 2022

    @122330602

    two months passed, electron V20 is still not supported

  4. cshotton commented on Sep 28, 2022

    @cshotton

    two months passed, electron V20 is still not supported

    FWIW you can npm install [email protected] and still get npx electron-rebuild -f -w better-sqlite3 to work as expected while we wait.

  5. mckravchyk commented on Oct 13, 2022

    @mckravchyk

    You don't have to wait:

    1. Clone this PR fork to your machine
    2. Apply the C++17 fix if you need it (see PR comments)
    3. Reference the local fork in package.json with the path to the fork instead of the version number, i.e. "better-sqlite3": "file:../npm/better-sqlite3-electron-v21"
    4. Run npm install && npx electron-builder install-app-deps (you have to have electron-builder installed locally)
  6. cwellsx commented on Oct 23, 2022

    @cwellsx

    You don't have to wait:

    1. Clone this PR fork to your machine
    2. Apply the C++17 fix if you need it (see PR comments)
    3. Reference the local fork in package.json with the path to the fork instead of the version number, i.e. "better-sqlite3": "file:../npm/better-sqlite3-electron-v21"
    4. Run npm install && npx electron-builder install-app-deps (you have to have electron-builder installed locally)

    Thanks!

    Though instead of doing a local install, i.e. of file:, I found it better to install the released version of better-sqlite3 and then overwrite that in my project's node_modules i.e. by copying the PR on top of the released version.

    The local install didn't work so well with Webpack and Packaging.

    Or there's now a comment in the pull thread saying,

    For anyone else waiting on the merge, you should be able to install with:

    npm install WiseLibs/better-sqlite3#pull/870/head
    
  7. linonetwo commented on Jun 21, 2023

    @linonetwo

    Solve electron25 build error nodejs/node#2341 (comment)

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

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions