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

bitwarden-desktop: 2024.6.4 -> 2024.8.0 #330137

Closed
wants to merge 1 commit into from

Conversation

dotlambda
Copy link
Member

@dotlambda dotlambda commented Jul 26, 2024

It currently fails to launch with

Error: /nix/store/k8axbxrhfbwgmbq08p5pjn5x3b24vk9c-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar.unpacked/node_modules/argon2/build/Release/argon2.node: undefined symbol: argon2_ctx
    at process.func [as dlopen] (node:electron/js2c/node_init:2:2559)
    at Module._extensions..node (node:internal/modules/cjs/loader:1470:18)
    at Object.func [as .node] (node:electron/js2c/node_init:2:2786)
    at Module.load (node:internal/modules/cjs/loader:1215:32)
    at Module._load (node:internal/modules/cjs/loader:1031:12)
    at c._load (node:electron/js2c/node_init:2:17025)
    at Module.require (node:internal/modules/cjs/loader:1240:19)
    at require (node:internal/modules/helpers:179:18)
    at load (/nix/store/k8axbxrhfbwgmbq08p5pjn5x3b24vk9c-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar/node_modules/node-gyp-build/node-gyp-build.js:22:10)
    at Object.<anonymous> (/nix/store/k8axbxrhfbwgmbq08p5pjn5x3b24vk9c-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar/node_modules/argon2/argon2.cjs:7:32)

Description of changes

Diff: bitwarden/clients@desktop-v2024.6.4...desktop-v2024.8.0

Changelog:
https://github.com/bitwarden/clients/releases/tag/desktop-v2024.7.1
https://github.com/bitwarden/clients/releases/tag/desktop-v2024.8.0

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

related: #325428


Add a 👍 reaction to pull requests you find important.

@ToasterUwU
Copy link
Member

Any idea how to fix this issue? This draft looks stale from an outsiders perspective

@dotlambda
Copy link
Member Author

Any idea how to fix this issue?

No. I tried rebuilding argon2 from source but to no avail.

@ToasterUwU
Copy link
Member

I found only one mention of the same issue so far, and thats: ranisalt/node-argon2#405

Maybe this gives you some idea

@dotlambda
Copy link
Member Author

We really need to solve this urgently: #335850

@dotlambda
Copy link
Member Author

@SuperSandro2000 Is there a reason you added postPatch back?

@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Aug 20, 2024

I think you did the change in the wrong commit. I just rebased on master.

I can't really test this right now since electron_31 is not cached yet.

@SuperSandro2000 SuperSandro2000 marked this pull request as ready for review August 20, 2024 09:31
@dotlambda dotlambda marked this pull request as draft August 20, 2024 09:32
@dotlambda
Copy link
Member Author

@SuperSandro2000 This is not ready for review. The app still fails to launch.

I can't really test this right now since electron_31 is not cached yet.

You can replace electron_31 with electron_31-bin for testing.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1 and removed 10.rebuild-darwin: 1-10 labels Aug 20, 2024
@dotlambda dotlambda removed the 8.has: package (new) This PR adds a new package label Aug 20, 2024
@SuperSandro2000
Copy link
Member

I found only one mention of the same issue so far, and thats: ranisalt/node-argon2#405

Maybe this gives you some idea

see also the first entry in the faq https://github.com/ranisalt/node-argon2#faq

I am currently trying that locally with semi success.

@dotlambda
Copy link
Member Author

see also the first entry in the faq https://github.com/ranisalt/node-argon2#faq

That's outdated: ranisalt/node-argon2#411

@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Aug 20, 2024

I tried the following diff and it didn't change much about the error:

diff --git a/pkgs/by-name/bi/bitwarden-desktop/package.nix b/pkgs/by-name/bi/bitwarden-desktop/package.nix
index 56021fd0e794..6b70cc1eca6c 100644
--- a/pkgs/by-name/bi/bitwarden-desktop/package.nix
+++ b/pkgs/by-name/bi/bitwarden-desktop/package.nix
@@ -3,7 +3,7 @@
 , cargo
 , copyDesktopItems
 , dbus
-, electron_31
+, electron_31-bin
 , fetchFromGitHub
 , glib
 , gnome-keyring
@@ -15,6 +15,7 @@
 , moreutils
 , napi-rs-cli
 , nodejs_20
+, node-gyp
 , patchutils_0_4_2
 , pkg-config
 , python3
@@ -26,7 +27,7 @@
 let
   description = "Secure and free password manager for all of your devices";
   icon = "bitwarden";
-  electron = electron_31;
+  electron = electron_31-bin;
 in buildNpmPackage rec {
   pname = "bitwarden-desktop";
   version = "2024.7.1";
@@ -76,6 +77,7 @@
     makeWrapper
     moreutils
     napi-rs-cli
+    node-gyp
     pkg-config
     (python3.withPackages (ps: with ps; [ setuptools ]))
     rustc
@@ -95,6 +97,12 @@
       exit 1
     fi

+    pushd node_modules/argon2
+    node-gyp rebuild
+    popd
+
     pushd apps/desktop/desktop_native/napi
     npm run build
     popd
bitwarden-desktop> ++++ pushd node_modules/argon2
bitwarden-desktop> ~/source/node_modules/argon2 ~/source
bitwarden-desktop> ++++ node-gyp rebuild
bitwarden-desktop> gyp info it worked if it ends with ok
bitwarden-desktop> gyp info using [email protected]
bitwarden-desktop> gyp info using [email protected] | linux | x64
bitwarden-desktop> gyp info find Python using Python version 3.12.4 found at "/nix/store/rmrkp5iadkg0dzgps9wb228aq959hnq2-python3-3.12.4-env/bin/python3.12"
bitwarden-desktop> gyp info spawn /nix/store/rmrkp5iadkg0dzgps9wb228aq959hnq2-python3-3.12.4-env/bin/python3.12
bitwarden-desktop> gyp info spawn args [
bitwarden-desktop> gyp info spawn args '/nix/store/pslsr30p3lfi69s4p04sgdqg1cibj2va-node-gyp-10.2.0/lib/node_modules/node-gyp/gyp/gyp_main.py',
bitwarden-desktop> gyp info spawn args 'binding.gyp',
bitwarden-desktop> gyp info spawn args '-f',
bitwarden-desktop> gyp info spawn args 'make',
bitwarden-desktop> gyp info spawn args '-I',
bitwarden-desktop> gyp info spawn args '/build/source/node_modules/argon2/build/config.gypi',
bitwarden-desktop> gyp info spawn args '-I',
bitwarden-desktop> gyp info spawn args '/nix/store/pslsr30p3lfi69s4p04sgdqg1cibj2va-node-gyp-10.2.0/lib/node_modules/node-gyp/addon.gypi',
bitwarden-desktop> gyp info spawn args '-I',
bitwarden-desktop> gyp info spawn args '/nix/store/v14k93caffbf0xz2g7bqr964grxxqlmj-nodejs-20.15.1/include/node/common.gypi',
bitwarden-desktop> gyp info spawn args '-Dlibrary=shared_library',
bitwarden-desktop> gyp info spawn args '-Dvisibility=default',
bitwarden-desktop> gyp info spawn args '-Dnode_root_dir=/nix/store/v14k93caffbf0xz2g7bqr964grxxqlmj-nodejs-20.15.1',
bitwarden-desktop> gyp info spawn args '-Dnode_gyp_dir=/nix/store/pslsr30p3lfi69s4p04sgdqg1cibj2va-node-gyp-10.2.0/lib/node_modules/node-gyp',
bitwarden-desktop> gyp info spawn args '-Dnode_lib_file=/nix/store/v14k93caffbf0xz2g7bqr964grxxqlmj-nodejs-20.15.1/$(Configuration)/node.lib',
bitwarden-desktop> gyp info spawn args '-Dmodule_root_dir=/build/source/node_modules/argon2',
bitwarden-desktop> gyp info spawn args '-Dnode_engine=v8',
bitwarden-desktop> gyp info spawn args '--depth=.',
bitwarden-desktop> gyp info spawn args '--no-parallel',
bitwarden-desktop> gyp info spawn args '--generator-output',
bitwarden-desktop> gyp info spawn args 'build',
bitwarden-desktop> gyp info spawn args '-Goutput_dir=.'
bitwarden-desktop> gyp info spawn args ]
bitwarden-desktop> gyp info spawn make
bitwarden-desktop> gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
bitwarden-desktop> make: Entering directory '/build/source/node_modules/argon2/build'
bitwarden-desktop>   CC(target) Release/obj.target/libargon2/argon2/src/opt.o
bitwarden-desktop>   CC(target) Release/obj.target/libargon2/argon2/src/argon2.o
bitwarden-desktop>   CC(target) Release/obj.target/libargon2/argon2/src/blake2/blake2b.o
bitwarden-desktop>   CC(target) Release/obj.target/libargon2/argon2/src/core.o
bitwarden-desktop>   CC(target) Release/obj.target/libargon2/argon2/src/encoding.o
bitwarden-desktop>   CC(target) Release/obj.target/libargon2/argon2/src/thread.o
bitwarden-desktop> rm -f Release/obj.target/argon2.a Release/obj.target/argon2.a.ar-file-list; mkdir -p `dirname Release/obj.target/argon2.a`
bitwarden-desktop> ar crs Release/obj.target/argon2.a @Release/obj.target/argon2.a.ar-file-list
bitwarden-desktop> BFD: Release/obj.target/libargon2/argon2/src/opt.o: plugin needed to handle lto object
bitwarden-desktop>   COPY Release/argon2.a
bitwarden-desktop>   CXX(target) Release/obj.target/argon2/argon2_node.o
bitwarden-desktop>   SOLINK_MODULE(target) Release/obj.target/argon2.node
bitwarden-desktop>   COPY Release/argon2.node
bitwarden-desktop> make: Leaving directory '/build/source/node_modules/argon2/build'
bitwarden-desktop> gyp info ok
bitwarden-desktop> ++++ popd
bitwarden-desktop> ~/source
 ➜ ./result/bin/bitwarden
App threw an error during load
Error: /nix/store/lw0grjw4jfk7n2lf9vnw0xzxjxa5512v-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar.unpacked/node_modules/argon2/build/Release/argon2.node: undefined symbol: argon2_ctx
    at process.func [as dlopen] (node:electron/js2c/node_init:2:2559)
    at Module._extensions..node (node:internal/modules/cjs/loader:1470:18)
    at Object.func [as .node] (node:electron/js2c/node_init:2:2786)
    at Module.load (node:internal/modules/cjs/loader:1215:32)
    at Module._load (node:internal/modules/cjs/loader:1031:12)
    at c._load (node:electron/js2c/node_init:2:17025)
    at Module.require (node:internal/modules/cjs/loader:1240:19)
    at require (node:internal/modules/helpers:179:18)
    at load (/nix/store/lw0grjw4jfk7n2lf9vnw0xzxjxa5512v-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar/node_modules/node-gyp-build/node-gyp-build.js:22:10)
    at Object.<anonymous> (/nix/store/lw0grjw4jfk7n2lf9vnw0xzxjxa5512v-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar/node_modules/argon2/argon2.cjs:7:32)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: /nix/store/lw0grjw4jfk7n2lf9vnw0xzxjxa5512v-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar.unpacked/node_modules/argon2/build/Release/argon2.node: undefined symbol: argon2_ctx
    at process.func [as dlopen] (node:electron/js2c/node_init:2:2559)
    at Module._extensions..node (node:internal/modules/cjs/loader:1470:18)
    at Object.func [as .node] (node:electron/js2c/node_init:2:2786)
    at Module.load (node:internal/modules/cjs/loader:1215:32)
    at Module._load (node:internal/modules/cjs/loader:1031:12)
    at c._load (node:electron/js2c/node_init:2:17025)
    at Module.require (node:internal/modules/cjs/loader:1240:19)
    at require (node:internal/modules/helpers:179:18)
    at load (/nix/store/lw0grjw4jfk7n2lf9vnw0xzxjxa5512v-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar/node_modules/node-gyp-build/node-gyp-build.js:22:10)
    at Object.<anonymous> (/nix/store/lw0grjw4jfk7n2lf9vnw0xzxjxa5512v-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar/node_modules/argon2/argon2.cjs:7:32)
[1367861:0820/155539.895297:ERROR:ozone_platform_x11.cc(245)] Missing X server or $DISPLAY
[1367861:0820/155539.895343:ERROR:env.cc(258)] The platform failed to initialize.  Exiting.
Segmentation fault (core dumped)

Edit: another attempt with npm run build with prebuildify packaged SuperSandro2000@07a6d89 which also didn't fix the error.....

@amarshall
Copy link
Member

I’ve been away for a bit, I will have some time to look into this a bit more Monday, or possibly sooner.

@dotlambda dotlambda changed the title bitwarden-desktop: 2024.6.4 -> 2024.7.1 bitwarden-desktop: 2024.6.4 -> 2024.8.0 Aug 23, 2024
@amarshall
Copy link
Member

Figured out the issue, see #337164.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants