Signal-Desktop icon indicating copy to clipboard operation
Signal-Desktop copied to clipboard

Build failure on aarch64 (M1 Macbook)

Open WhyNotHugo opened this issue 2 years ago • 32 comments

  • [x] I have searched open and closed issues for duplicates
  • [x] I am using Signal-Desktop as provided by the Signal team, not a 3rd-party package.

Bug Description

Trying to build from source on aarch64 fails:

yarn install v1.22.19
[1/5] Resolving packages...
[2/5] Fetching packages...
[3/5] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "prop-types@^15.7.2".
warning " > [email protected]" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.1".
warning " > [email protected]" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0 || ^16.0.1".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.0.0".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.5.7".
warning " > [email protected]" has incorrect peer dependency "react@^15.3.0 || ^16.0.0-alpha".
warning " > [email protected]" has incorrect peer dependency "react-dom@^15.3.0 || ^16.0.0-alpha".
warning " > @storybook/[email protected]" has unmet peer dependency "@storybook/api@^6.4.0".
warning " > @storybook/[email protected]" has unmet peer dependency "@storybook/components@^6.4.0".
warning " > @storybook/[email protected]" has unmet peer dependency "@storybook/core-events@^6.4.0".
warning " > @storybook/[email protected]" has unmet peer dependency "@storybook/theming@^6.4.0".
warning " > @storybook/[email protected]" has unmet peer dependency "require-from-string@^2.0.2".
warning " > [email protected]" has incorrect peer dependency "webpack@^4.0.0".
warning " > [email protected]" has incorrect peer dependency "webpack@^4.0.0".
warning " > [email protected]" has incorrect peer dependency "webpack@^4.0.0".
[4/5] Building fresh packages...
error /build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3: Command failed.
Exit code: 1
Command: npm run build-release
Arguments: 
Directory: /build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3
Output:
> [email protected] build-release
> node-gyp rebuild --release

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | arm64
gyp info find Python using Python version 3.10.5 found at "/usr/bin/python3"
gyp http GET https://nodejs.org/download/release/v16.16.0/node-v16.16.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v16.16.0/node-v16.16.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v16.16.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v16.16.0/SHASUMS256.txt
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/build/.cache/node-gyp/16.16.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/build/.cache/node-gyp/16.16.0',
gyp info spawn args   '-Dnode_gyp_dir=/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/build/.cache/node-gyp/16.16.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3/build'
  TOUCH b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
  ACTION deps_sqlite3_gyp_locate_sqlite3_target_extract_sqlite3 b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
  TOUCH Release/obj.target/deps/locate_sqlite3.stamp
  TOUCH Release/obj.target/deps/copy_dll.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
  AR(target) Release/obj.target/deps/sqlite3.a
  COPY Release/sqlite3.a
  CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
In file included from ./src/better_sqlite3.lzz:11,
                 from ../src/better_sqlite3.cpp:4:
/build/.cache/node-gyp/16.16.0/include/node/node.h:867:7: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>)' to 'node::addon_context_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*)'} [-Wcast-function-type]
  867 |       (node::addon_context_register_func) (regfunc),                  \
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/.cache/node-gyp/16.16.0/include/node/node.h:885:3: note: in expansion of macro 'NODE_MODULE_CONTEXT_AWARE_X'
  885 |   NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/.cache/node-gyp/16.16.0/include/node/node.h:916:3: note: in expansion of macro 'NODE_MODULE_CONTEXT_AWARE'
  916 |   NODE_MODULE_CONTEXT_AWARE(NODE_GYP_MODULE_NAME,                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
./src/better_sqlite3.lzz:67:1: note: in expansion of macro 'NODE_MODULE_INIT'
./src/objects/database.lzz: In static member function 'static void Database::JS_new(const v8::FunctionCallbackInfo<v8::Value>&)':
./src/objects/database.lzz:180:21: warning: variable 'status' set but not used [-Wunused-but-set-variable]
./src/util/binder.lzz: In static member function 'static bool Binder::IsPlainObject(v8::Isolate*, v8::Local<v8::Object>)':
./src/util/binder.lzz:37:66: warning: 'v8::Local<v8::Context> v8::Object::CreationContext()' is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
In file included from /build/.cache/node-gyp/16.16.0/include/node/node.h:63:
/build/.cache/node-gyp/16.16.0/include/node/v8.h:4316:18: note: declared here
 4316 |   Local<Context> CreationContext();
      |                  ^~~~~~~~~~~~~~~
./src/util/data.lzz: In function 'v8::Local<v8::Value> Data::GetValueJS(v8::Isolate*, sqlite3_stmt*, int, bool)':
./src/util/data.lzz:73:92: warning: this statement may fall through [-Wimplicit-fallthrough=]
./src/util/data.lzz:73:197: note: here
./src/util/data.lzz: In function 'v8::Local<v8::Value> Data::GetValueJS(v8::Isolate*, sqlite3_value*, bool)':
./src/util/data.lzz:77:81: warning: this statement may fall through [-Wimplicit-fallthrough=]
./src/util/data.lzz:77:175: note: here
  SOLINK_MODULE(target) Release/obj.target/better_sqlite3.node
/usr/bin/ld: cannot find ./Release/obj/gen/sqlite3/OpenSSL-linux-arm64/libcrypto.a: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [better_sqlite3.target.mk:152: Release/obj.target/better_sqlite3.node] Error 1
rm b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
make: Leaving directory '/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 5.19.0-asahi-1-1-ARCH
gyp ERR! command "/usr/bin/node" "/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/.bin/node-gyp" "rebuild" "--release"
gyp ERR! cwd /build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3
gyp ERR! node -v v16.16.0
gyp ERR! node-gyp -v v9.0.0
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

An identical setup on amd64 works fine.

Steps to Reproduce

Essentially following build steps

Actual Result:

Build fails on aarch64, but work on an equivalent amd64 setup (e.g.: same packages, same versions, but everything built for that architecture).

Expected Result:

Should build fine?

Screenshots

n/a

Platform Info

Signal Version: 5.53.0 Operating System: Linux 5.19.0-asahi-1-1-ARCH aarch64 GNU/Linux Linked Device Version: n/a

Link to Debug Log

n/a

Related issues:

  • https://community.signalusers.org/t/signal-desktop-on-arm64-aarch64/9001 Is a feature requires for binaries for phones/Debian.
  • https://community.signalusers.org/t/apple-silicon-support/19659/25 Seems to be more focused on discussing unofficial builds, and not official sources.
  • https://github.com/signalapp/Signal-Desktop/issues/5841 Is a feature request for binaries, not a bug report for a crash.

There's a few other issues, but more of them discuss unofficial binaries, or requesting shipped binaries. They're not about an actual crash when building.

WhyNotHugo avatar Aug 09 '22 17:08 WhyNotHugo

Sorry about that. Could you try installing node 16.13.2 and giving it another go, please?

indutny-signal avatar Aug 09 '22 22:08 indutny-signal

It would be so awesome if there would be an offical Signal distribution for aarch64 (M1)....

mkurz avatar Aug 10 '22 11:08 mkurz

@mkurz

It would be so awesome if there would be an offical Signal distribution for aarch64 (M1)....

For macOS there is, the version at https://signal.org/download/ is universal. If you're already using Signal Desktop on an Apple silicon device, I think the auto-updater should've updated you to the native version already.

For official support of aarch64 on Windows and Linux, there's a feature request on the community forum.

awaitlink avatar Aug 10 '22 11:08 awaitlink

Sorry about that. Could you try installing node 16.13.2 and giving it another go, please?

I've given that a try, also failed:

yarn install v1.22.19
[1/5] Resolving packages...
[2/5] Fetching packages...
[3/5] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "prop-types@^15.7.2".
warning " > [email protected]" has incorrect peer dependency "react@^0.14.0 || ^15.0.0 || ^16.0.1".
warning " > [email protected]" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0 || ^16.0.1".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.0.0".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.5.7".
warning " > [email protected]" has incorrect peer dependency "react@^15.3.0 || ^16.0.0-alpha".
warning " > [email protected]" has incorrect peer dependency "react-dom@^15.3.0 || ^16.0.0-alpha".
warning " > @storybook/[email protected]" has unmet peer dependency "@storybook/api@^6.4.0".
warning " > @storybook/[email protected]" has unmet peer dependency "@storybook/components@^6.4.0".
warning " > @storybook/[email protected]" has unmet peer dependency "@storybook/core-events@^6.4.0".
warning " > @storybook/[email protected]" has unmet peer dependency "@storybook/theming@^6.4.0".
warning " > @storybook/[email protected]" has unmet peer dependency "require-from-string@^2.0.2".
warning " > [email protected]" has incorrect peer dependency "webpack@^4.0.0".
warning " > [email protected]" has incorrect peer dependency "webpack@^4.0.0".
warning " > [email protected]" has incorrect peer dependency "webpack@^4.0.0".
[4/5] Building fresh packages...
error /build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3: Command failed.
Exit code: 1
Command: npm run build-release
Arguments: 
Directory: /build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3
Output:
> [email protected] build-release
> node-gyp rebuild --release

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | arm64
gyp info find Python using Python version 3.10.5 found at "/usr/bin/python3"
gyp http GET https://nodejs.org/download/release/v16.13.2/node-v16.13.2-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v16.13.2/node-v16.13.2-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v16.13.2/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v16.13.2/SHASUMS256.txt
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/build/.cache/node-gyp/16.13.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/build/.cache/node-gyp/16.13.2',
gyp info spawn args   '-Dnode_gyp_dir=/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/build/.cache/node-gyp/16.13.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3/build'
  TOUCH b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
  ACTION deps_sqlite3_gyp_locate_sqlite3_target_extract_sqlite3 b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
  TOUCH Release/obj.target/deps/locate_sqlite3.stamp
  TOUCH Release/obj.target/deps/copy_dll.stamp
  CC(target) Release/obj.target/sqlite3/gen/sqlite3/sqlite3.o
  AR(target) Release/obj.target/deps/sqlite3.a
  COPY Release/sqlite3.a
  CXX(target) Release/obj.target/better_sqlite3/src/better_sqlite3.o
In file included from ./src/better_sqlite3.lzz:11,
                 from ../src/better_sqlite3.cpp:4:
/build/.cache/node-gyp/16.13.2/include/node/node.h:841:7: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>)' to 'node::addon_context_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Context>, void*)'} [-Wcast-function-type]
  841 |       (node::addon_context_register_func) (regfunc),                  \
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/.cache/node-gyp/16.13.2/include/node/node.h:859:3: note: in expansion of macro 'NODE_MODULE_CONTEXT_AWARE_X'
  859 |   NODE_MODULE_CONTEXT_AWARE_X(modname, regfunc, NULL, 0)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/.cache/node-gyp/16.13.2/include/node/node.h:890:3: note: in expansion of macro 'NODE_MODULE_CONTEXT_AWARE'
  890 |   NODE_MODULE_CONTEXT_AWARE(NODE_GYP_MODULE_NAME,                     \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
./src/better_sqlite3.lzz:67:1: note: in expansion of macro 'NODE_MODULE_INIT'
./src/objects/database.lzz: In static member function 'static void Database::JS_new(const v8::FunctionCallbackInfo<v8::Value>&)':
./src/objects/database.lzz:180:21: warning: variable 'status' set but not used [-Wunused-but-set-variable]
./src/util/binder.lzz: In static member function 'static bool Binder::IsPlainObject(v8::Isolate*, v8::Local<v8::Object>)':
./src/util/binder.lzz:37:66: warning: 'v8::Local<v8::Context> v8::Object::CreationContext()' is deprecated: Use MaybeLocal<Context> GetCreationContext() [-Wdeprecated-declarations]
In file included from /build/.cache/node-gyp/16.13.2/include/node/node.h:63:
/build/.cache/node-gyp/16.13.2/include/node/v8.h:4316:18: note: declared here
 4316 |   Local<Context> CreationContext();
      |                  ^~~~~~~~~~~~~~~
./src/util/data.lzz: In function 'v8::Local<v8::Value> Data::GetValueJS(v8::Isolate*, sqlite3_stmt*, int, bool)':
./src/util/data.lzz:73:92: warning: this statement may fall through [-Wimplicit-fallthrough=]
./src/util/data.lzz:73:197: note: here
./src/util/data.lzz: In function 'v8::Local<v8::Value> Data::GetValueJS(v8::Isolate*, sqlite3_value*, bool)':
./src/util/data.lzz:77:81: warning: this statement may fall through [-Wimplicit-fallthrough=]
./src/util/data.lzz:77:175: note: here
  SOLINK_MODULE(target) Release/obj.target/better_sqlite3.node
/usr/bin/ld: cannot find ./Release/obj/gen/sqlite3/OpenSSL-linux-arm64/libcrypto.a: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [better_sqlite3.target.mk:152: Release/obj.target/better_sqlite3.node] Error 1
rm b857c92884e9598d609f6be182a2595df7a8e00f.intermediate
make: Leaving directory '/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 5.19.0-asahi-1-1-ARCH
gyp ERR! command "/usr/bin/node" "/build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/.bin/node-gyp" "rebuild" "--release"
gyp ERR! cwd /build/signal-desktop/src/Signal-Desktop-5.53.0/node_modules/better-sqlite3
gyp ERR! node -v v16.13.2
gyp ERR! node-gyp -v v9.0.0
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

WhyNotHugo avatar Aug 15 '22 07:08 WhyNotHugo

@WhyNotHugo ah, I see now! Did you install git lfs as per CONTRIBUTING.md ?

indutny-signal avatar Aug 15 '22 21:08 indutny-signal

Yes, git lfs was set up and initialised properly. Previous bit of log output:

Git LFS initialized.
yarn install v1.22.19
[1/5] Resolving packages...
[2/5] Fetching packages...
<...>

WhyNotHugo avatar Aug 16 '22 12:08 WhyNotHugo

@WhyNotHugo If you tried a yarn install before you had Git LFS initialized, you may need to clear your node_modules directory and/or yarn cache (yarn cache clean).

scottnonnenberg-signal avatar Aug 17 '22 00:08 scottnonnenberg-signal

I didn't, but I'm doing each subsequent run from scratch anyway to avoid any issues like that.

WhyNotHugo avatar Aug 17 '22 08:08 WhyNotHugo

I was able to successfully build, install and run Signal on Asahi Linux, using the Arch Linux AUR package signal-desktop-beta (https://aur.archlinux.org/packages/signal-desktop-beta) :partying_face: There is just a small patch that needs to be applied, see this comment: https://aur.archlinux.org/packages/signal-desktop-beta#comment-880073 Hopefully this patch will make it into the AUR package, then we can just install Signal on Asahi by just running yay -S signal-desktop-beta.

If someone is new to Arch Linux / Asahi and needs help to apply the fix and build and install the package, let me know.

mkurz avatar Sep 02 '22 10:09 mkurz

@mkurz Thanks for digging into this!

I see that the main difference with this patch is that you build using the system fpm. Which one is used otherwise? I don't see any reference to fpm on this repo.

I'm asking here mostly because if an old version is pinned somewhere, it would be great to investigate where, so it can be fixed upstream too.

WhyNotHugo avatar Sep 02 '22 11:09 WhyNotHugo

@WhyNotHugo to be honest: I have no idea where yarn gets fpm. Also I am short on time, so I am just happy it's working now. However, please go ahead, would be good to fix that too.

mkurz avatar Sep 02 '22 11:09 mkurz

Hope we can get this patch in nixpkgs as well.

cor avatar Oct 15 '22 13:10 cor

I digged a bit deeper and think I know how this fpm problem can be fixed. Step by step:

  • Signal depends on electron-builder
  • In electron-builder I found this very promising url it points to where binary blobs will be downloaded.
  • So it seems the GitHub repo electron-userland/electron-builder-binaries hosts binaries that are needed by electron-builder: https://github.com/electron-userland/electron-builder-binaries/releases . There I could find two fpm binaries:
    • https://github.com/electron-userland/electron-builder-binaries/releases/tag/fpm-1.9.3-2.3.1-linux-x86_64
    • https://github.com/electron-userland/electron-builder-binaries/releases/tag/fpm-1.9.3-2.3.1-linux-x86
  • Turns out that in this binaries repo it's already known that the fpm binaries are not published for arm/aarch64:
    • https://github.com/electron-userland/electron-builder-binaries/issues/17
    • https://github.com/electron-userland/electron-builder-binaries/issues/49
    • BTW: The latest version published in this repo is 1.9.3, which is outdated. We need at least fpm version 1.13.0, which contains the fix to run Signal on aarch64: https://github.com/jordansissel/fpm/pull/1775
  • But how does electron-builder fetch those binary libraries (so we can change to a new version)? Turns out this was moved to app-builder-bin. which is published from this package.json I guess.
    • The call to download fpm can be found here which calls this method we are looking for.
    • As you can see in this method it only downloads -x86_64 or -x86, depending on runtime.GOARCH. So, I never worked with go, but I would guess to fix that, we would need to make app-builder support arm64/aarch64, which it currently does not, have a look in its MakeFile, where it only sets arch to linux_amd64. UPDATE: arm is used in build.sh already: https://github.com/develar/app-builder/blob/4e2aa6a12e2bc3d31ec0d01d661fb3a4d65248ff/scripts/build.sh#L21-L25

So what needs to be done is:

  • Compile and upload a arm64/aarch64 binary of fpm (at least version 1.13.0 !!!) to https://github.com/electron-userland/electron-builder-binaries/releases
  • Fix https://github.com/develar/app-builder to also pick up that fpm arm64/aarch64 binary.
  • Release a new app-builder-bin (yes, -bin) package.
  • Upgrade app-builder-bin in electron-builder.
  • Upgrade electron-builder in this Signal repo.

I am not going to do that, so if someone wants to take over from here, feel welcome to do so.

BTW: About runtime.GOARCH, you can read more details here: https://pkg.go.dev/runtime

The GOARCH, GOOS, GOPATH, and GOROOT environment variables complete the set of Go environment variables. They influence the building of Go programs (see https://golang.org/cmd/go and https://golang.org/pkg/go/build). GOARCH, GOOS, and GOROOT are recorded at compile time and made available by constants or functions in this package, but they do not influence the execution of the run-time system. ... GOARCH is the running program's architecture target: one of 386, amd64, arm, s390x, and so on.

mkurz avatar Nov 08 '22 10:11 mkurz

Quick note, app-builder-bin dependency can't be upgraded in Electron-builder until this issue is resolved: https://github.com/develar/app-builder/issues/83

mmaietta avatar Nov 08 '22 19:11 mmaietta

@mkurz Thanks for digging through this and figuring out all the lose ends, that's quite some detailed research!

WhyNotHugo avatar Nov 10 '22 19:11 WhyNotHugo

@WhyNotHugo Happy to help. However I don't have more time to fix that. I hope someone picks up from here. I think it's pretty clear and straight forward what needs to be done.

mkurz avatar Nov 10 '22 19:11 mkurz

Perhaps a saner approach would be to rely on system packages or building from source, rather than pull binaries from various online sources and executing them. Pulling binaries from upstream will continuously have new issues on different architectures, and upstream can't be expected to build for all of them.

Plus, pulling binaries from a bunch of different sources definitely can't be a secure thing to do.

WhyNotHugo avatar Nov 17 '22 10:11 WhyNotHugo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Feb 15 '23 16:02 stale[bot]

bump

mkurz avatar Feb 15 '23 16:02 mkurz

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 16 '23 23:05 stale[bot]

asadfads

WhyNotHugo avatar May 19 '23 10:05 WhyNotHugo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 18 '23 15:08 stale[bot]

Ah yes, my periodic email reminder of why automatic stale bots are awful for the world of open source... (Bump, not stale as far as I can tell)

t3chguy avatar Aug 18 '23 15:08 t3chguy

activity occurs

WhyNotHugo avatar Aug 18 '23 15:08 WhyNotHugo

any news on this?

msimic avatar Oct 16 '23 01:10 msimic

Still not working for me..

Raphencoder avatar Nov 02 '23 17:11 Raphencoder

I've never attempted myself, but aarch64 appears to be building fine for the signal-desktop snap and it installs on a M2 for me https://github.com/snapcrafters/signal-desktop/blob/candidate/snap/snapcraft.yaml

eslerm avatar Jan 28 '24 07:01 eslerm

How can we build the Signal beta on Fedora Asahi?

salixh5 avatar Feb 20 '24 18:02 salixh5

It looks like perhaps the instructions on CONTRIBUTING.md have changed since this post was originally opened. I did a fresh clone of the repo, checked out release v7.0.0, made sure I had gcc g++, python3 and make and still was met with some errors attempting to install from a frozen file lock with yarn.

These days it looks like there's 3 packages that do not work correctly with ARM causing errors, electron-builder, canvas, and fs-attr. It looks like fs-attr is an optional dependency so it might work without that? electron-builder though has a name like it might be important to an electron app :slightly_smiling_face:

Output of yarn debug log:

# Script name: postinstall

patch-package 8.0.0
Applying patches...
@formatjs/[email protected] ✔
@storybook/[email protected] ✔
@storybook/[email protected] ✔
@types/[email protected] ✔
@types/[email protected] ✔
@types/[email protected] ✔
@types/[email protected] ✔
@types/[email protected] ✔
@types/[email protected] ✔
@types/[email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected][email protected] ✔
  • electron-builder  version=24.6.3
  • loaded configuration  file=package.json ("build" field)
  • rebuilding native dependencies  dependencies=@nodert-win10-rs4/[email protected], @nodert-win10-rs4/[email protected], @signalapp/[email protected], @signalapp/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
                                    platform=linux
                                    arch=arm64
  • install prebuilt binary  name=mac-screen-capture-permissions version=2.0.0 platform=linux arch=arm64 napi=
  • build native dependency from sources  name=mac-screen-capture-permissions
                                          version=2.0.0
                                          platform=linux
                                          arch=arm64
                                          napi=
                                          reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
                                          error=/home/ryan/Code/Signal/Signal-Desktop/node_modules/node-abi/index.js:30
      throw new Error('Could not detect abi for version ' + target + ' and runtime ' + runtime + '.  Updating "node-abi" might help solve this issue if it is a new release of ' + runtime)
      ^
    
    Error: Could not detect abi for version 28.2.0 and runtime electron.  Updating "node-abi" might help solve this issue if it is a new release of electron
        at getAbi (/home/ryan/Code/Signal/Signal-Desktop/node_modules/node-abi/index.js:30:9)
        at module.exports (/home/ryan/Code/Signal/Signal-Desktop/node_modules/prebuild-install/rc.js:53:57)
        at Object.<anonymous> (/home/ryan/Code/Signal/Signal-Desktop/node_modules/prebuild-install/bin.js:8:25)
        at Module._compile (node:internal/modules/cjs/loader:1356:14)
        at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
        at Module.load (node:internal/modules/cjs/loader:1197:32)
        at Module._load (node:internal/modules/cjs/loader:1013:12)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
        at node:internal/main/run_main_module:28:49
    
    Node.js v18.19.1
    
  • rebuilding native dependency  name=@nodert-win10-rs4/windows.ui.notifications version=0.4.4
  • rebuilding native dependency  name=@nodert-win10-rs4/windows.data.xml.dom version=0.4.4
  • rebuilding native dependency  name=@signalapp/better-sqlite3 version=8.6.0
  • rebuilding native dependency  name=@signalapp/windows-dummy-keystroke version=1.0.0
  • rebuilding native dependency  name=canvas version=1.0.0
  • rebuilding native dependency  name=bufferutil version=4.0.7
  • cannot build optional native dependency  name=canvas
                                             version=1.0.0
                                             cause=exit status 1
                                             out=Usage Error: Couldn't find a script named "install".
    
    $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] [--require #0] <scriptName> ...
    
                                             command=/tmp/xfs-91d44c42/yarn run install
                                             workingDir=/home/ryan/Code/Signal/Signal-Desktop/node_modules/canvas
  • rebuilding native dependency  name=contextify version=0.1.15
  • rebuilding native dependency  name=mac-screen-capture-permissions version=2.0.0
  • rebuilding native dependency  name=fs-xattr version=0.3.0
  • rebuilding native dependency  name=utf-8-validate version=5.0.10
  • cannot build optional native dependency  name=fs-xattr
                                             version=0.3.0
                                             cause=exit status 1
                                             out=Usage Error: Couldn't find a script named "install".
    
    $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] [--require #0] <scriptName> ...
    
                                             command=/tmp/xfs-91d44c42/yarn run install
                                             workingDir=/home/ryan/Code/Signal/Signal-Desktop/node_modules/fs-xattr
  ⨯ cannot execute  cause=exit status 1
                    out=Usage Error: Couldn't find a script named "install".
    
    $ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] [--require #0] <scriptName> ...
    
                    command=/tmp/xfs-91d44c42/yarn run install
                    workingDir=/home/ryan/Code/Signal/Signal-Desktop/node_modules/contextify

RMcNeely avatar Mar 06 '24 16:03 RMcNeely

Hello! The main problem was with fpm package that require electron during build It downloads it automatically x86 version and their repo don't include aarm64.

I am very thankful to this topics: https://github.com/th-ch/youtube-music/issues/85 https://github.com/jordansissel/fpm/issues/1801#issuecomment-919877499

The main repo of aarm64 build, my hero! https://github.com/jgresham/fpm-arm-binary

Main longread explanation how it works: https://github.com/signalapp/Signal-Desktop/issues/6063#issuecomment-1307001166

So, the solution is to build fpm by yourself and build any electron apps for aarm64 after.

// First install podman and run
podman run -it --platform=linux/arm64 ubuntu:20.04 bash

// Update vm
sudo apt update
sudo apt install -y curl git build-essential rpm

// Build aarm64 fpm
git clone https://github.com/jgresham/fpm-arm-binary
cd fpm-arm-binary/
chmod +x compile-script.sh
./compile-script.sh

// Make fpm usable by fpm command
sudo mv fpm-arm64-exe /usr/local/bin/fpm
sudo chmod +x /usr/local/bin/fpm
which fpm
fpm --version

// Install node with npm and pnpm
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
sudo npm install -g npm@latest
npm install -g pnpm

// Build Youtube Music, Simple Note, Signal-Desktop, Discord, etc. Anything on Electron
export USE_SYSTEM_FPM=true
git clone https://github.com/th-ch/youtube-music
cd youtube-music
pnpm install --frozen-lockfile
pnpm dist:linux:rpm-arm64

daic11 avatar Sep 11 '24 18:09 daic11