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

Added ARM architectures to the Linux build #2456

Merged
merged 2 commits into from
Nov 10, 2020
Merged

Added ARM architectures to the Linux build #2456

merged 2 commits into from
Nov 10, 2020

Conversation

SpacingBat3
Copy link
Contributor

It is possible to package the app using the electron-builder app on the ARM architectures (tested on ARM64: Raspberry Pi 4B, Manjaro ARM 20.10).

Fix

Allows to build the app as an tar.gz archive with the electron-builder tool.

Test

  1. Clone this repository and cd to it.
  2. Use the npm install to get it's all dependencies.
  3. Install electron-builder globally on your machine and package this repo with it for ARM64 and ARMv7 architectures:
electron-builder -l tar.gz --arm64 --armv7l

Release

In my opinion this change could be included in RELEASE-NOTES.md – however I haven't done this yet, as I would wait with that for the next release.

It is possible to package the app using the `electron-builder` app on the ARM architectures (tested on ARM64: Raspberry Pi 4B, Manjaro ARM 20.10).
Copy link
Contributor

@belcherj belcherj left a comment

Choose a reason for hiding this comment

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

All the builds function, I tested here: #2462

I did not test the artifacts as I do not have a machine to test.

@belcherj belcherj changed the title Added ARM architectures to the "tar.gz" array Added ARM architectures to the Linux build Nov 10, 2020
@belcherj belcherj merged commit c1a74ea into Automattic:develop Nov 10, 2020
@belcherj
Copy link
Contributor

Thank you for your contribution!!

@belcherj belcherj added this to the 2.2.0 milestone Nov 10, 2020
Copy link
Contributor Author

@SpacingBat3 SpacingBat3 left a comment

Choose a reason for hiding this comment

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

I haven't added this to the other file formats with a reason: building AppImages, DEB files, pacman packages etc. is broken now with the electron-builder while building the app on ARM host – or at least I couldn't make it working with my Raspberry Pi 4. The error while building on ARM is produced when the electron-builder tries to run an X86 application with foreign arch (and of course it fails because X86 binaries won't run on ARM machines without an emulation) that is downloaded and then used to produce these packages. That's why tar.gz (or any tar* file format) is now the only working option!

@SpacingBat3
Copy link
Contributor Author

If you've tested it on X86 machine, consider emulating ARM machines with the QEMU and trying to do the test.
I'm gonna verify once again things on ARMv7 again to check if it is actually failing or not... Maybe I were wrong in this review?
But with my knowledge it also fails on ARMv7 hosts.

@belcherj
Copy link
Contributor

belcherj commented Nov 11, 2020

Interesting. I can put in a PR to remove it from all but the tar.gz build.

Do you run your own build of Simplenote on your ARM device? Is that when the AppImage, Deb, and rpm build fails?

@SpacingBat3
Copy link
Contributor Author

@belcherj I've actually built many electron apps using the electron-builder and I believe this behaviour is independent of the application I've built – every time building an electron app as DEB, AppImage, RPM or even pacman packages. And yes, I've tried built all these apps on my Raspberry Pi, as I've written earlier – including yours.

I'm also myself a dev of Discord Web App that uses the Electron and is currently focused at support for the ARM devices. I haven't also succeed building it any distro-specific packages yet and I believe that's fault with the electron-builder itself. I might even consider making an issue on their GitHub repository and point you to it once I'll have enough time.

Right now I'm myself working on the Raspberry Pi 4 SBC under the ARM64 distro, but many people had also an issue building the electron apps on the ARMv7 arch and I believe that there's the same reason that is with ARM64.

I hope this comment will brighten a little a building process on the ARM hosts and helps you to set a proper configuration for the electron-builder.

BTW I'm not myself using this app, but someone pointed me to it by this issue that were made in my own GitHub repository and I've decided to check this out...

@dmsnell
Copy link
Member

dmsnell commented Nov 12, 2020

BTW I'm not myself using this app, but someone pointed me to it by this issue that were made in my own GitHub repository and I've decided to check this out...

mad props @SpacingBat3 - really appreciate you sharing your knowledge here.

@rekab72
Copy link

rekab72 commented Nov 12, 2020

@SpacingBat3 Thank you so much. Following the post I successfully built all on Raspberry Pi 4 8GB Ubuntu MATE 20.10 and am now using "Simplenote-linux-2.1.0-beta2-arm64.AppImage" with all of the new feature the Simplenote team have been adding. Along with your electron-discord-webapp https://github.com/SpacingBat3/electron-discord-webapp the Pi 4 is almost a desktop replacement. @dmsnell @belcherj Thanks too for keeping this going and making the changes to support ARM again.

@SpacingBat3
Copy link
Contributor Author

(...) Following the post I successfully built all on Raspberry Pi 4 8GB Ubuntu MATE 20.10 and am now using "Simplenote-linux-2.1.0-beta2-arm64.AppImage" (...)

Oh, I've earlier tried to built an AppImage on ARM64 and I've failed, but now it seems to work as well!

@SpacingBat3
Copy link
Contributor Author

... but this is an error when building the distro-specific packages (like deb, pacman, rpm etc.), that I've translated back from my native language back to English:

/home/spacingbat3/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/spacingbat3/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: cannot execute the binary file: Wrong format of the executable file.

This means that electron-builder downloads the ruby file for Linux X86 only and not for any of the ARM64 architectures (and I believe it can fail when the Linux X86_64 don't have installed any 32-bit libs).

Conclusion: AppImage, tar.gz and (probably, as I couldn't set multipass working with the Manjaro ARM) snap can be easily built with the electron-builder tool on the ARM architectures.

@rekab72
Copy link

rekab72 commented Nov 16, 2020

@belcherj 2.2.0-beta1AppImage works as designed. No issues. Thanks. Going to post info about Simplente again in Raspberry Pi forum.

@belcherj
Copy link
Contributor

belcherj commented Nov 23, 2020

Please open an issue if there are remaining issues with the ARM builds. Want to make sure we get everyone full sorted.

@daic11
Copy link

daic11 commented Sep 11, 2024

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:
th-ch/youtube-music#85
jordansissel/fpm#1801 (comment)

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

Main longread explanation how it works:
signalapp/Signal-Desktop#6063 (comment)

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

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.

5 participants