question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to pack the application as RPM/deb format under the ARM64 environment

See original GitHub issue
  • Version: 20.34.0
  • Target: aarch64

The company I worked is running a project developing a client program based on Electron. The customer requires us to deploy the client on computers having ARM64 architecture. Now we package the client on an aarch64-based server running openSUSE. So far, there are no problems when packaging the client into an AppImage. However, we found out that the customer’s computer only accepts programs installed as rpm/deb format due to unknown security reasons. We added rpm and deb in the linux section in the electron-builder configuration, attempting to package the client into an rpm/deb package on the same aarch64-based computer. The packaging procedure failed as follows:

  • downloading               path=/home/test/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86 url=https://github.com/electron-userland/electron-builder-binaries/releases/download/fpm-1.9.3-2.3.1-linux-x86/fpm-1.9.3-2.3.1-linux-x86.7z
  • downloading               parts=1 size=4.6 MB url=https://github.com/electron-userland/electron-builder-binaries/releases/download/fpm-1.9.3-2.3.1-linux-x86/fpm-1.9.3-2.3.1-linux-x86.7z
  • downloaded                duration=28.855s url=https://github.com/electron-userland/electron-builder-binaries/releases/download/fpm-1.9.3-2.3.1-linux-x86/fpm-1.9.3-2.3.1-linux-x86.7z

 ERROR  `electron-builder` says...

Error: Exit code: 1. Command failed: /home/test/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/fpm -s dir -t rpm --architecture arm64 --name cocall --force --after-install /tmp/t-VCbTzj/0-after-install --after-remove /tmp/t-VCbTzj/1-after-remove --description desc --version 5.1.15 --package /home/test/project/output/client-5.1.15.arm64.rpm ..........................
/home/test/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/test/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: cannot execute binary file: Exec format error
/home/test/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/test/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: Success

/home/test/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/test/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: cannot execute binary file: Exec format error
/home/test/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/test/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: Success

Obviously, electron-builder downloaded the package fpm compiled into the wrong format. I could not find the ARM64 version of the fpm package in the release page of https://github.com/electron-userland/electron-builder-binaries/ . So what should I do to build our project into an rpm/deb package under the ARM64 condition? Can we get the source of the fpm project then manually compile it for the electron-builder’s use?

NOTE: The project contains some native code which cannot be re-written in JS. So compiling the application on the computer that uses the architecture required is the most convenient way. Cross-compiling is more difficult.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16

github_iconTop GitHub Comments

8reactions
BSoD-Ultimatecommented, Jun 5, 2019

I’ve found a solution which can partially solve this problem.

electron-builder checks a system variable naming USE_SYSTEM_FPM when attempting to acquire the fpm tool, which is used to generate rpm and deb package. When this environment variable is set to true, electron-builder will attempt to launch fpm provided by the system. for example, fpm may locate in /usr/bin/fpm. the code relates to this mechanism lies here: https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/tools.ts

You can get fpm using other ways the Linux system provides. You have to install packages which make ruby and gem command usable. Since I use openSUSE as the building environment, YaST is written in Ruby, and it’s an essential module in openSUSE. I could install fpm simply running the command gem install fpm. After the installation, a soft link might have to be created to help electron-builder find fpm. In my environment, I created the link by running the following command

sudo ln -s /usr/bin/fpm/fpm.ruby2.5 /usr/bin/fpm

Then, before the packaging procedure, just set the environment variable by running

export USE_SYSTEM_FPM="true"

and the packaging procedure runs with no error.

I could only say the problem is partially but not fully solved. fpm could not generate a usable deb package which can be successfully installed in Debian when packaging under openSUSE environment. see this issue: https://github.com/jordansissel/fpm/issues/737

However, if you use Debian, it’s all fine.

3reactions
mmaiettacommented, Jul 16, 2021

I think easiest way to resolve this would be someone to contribute to the electron-builder-binaries repo an arm64 ruby binary. Electron builder would then download and use an arch-specific bin. Develar could then perform a release of it and I can promptly update electron-builder

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create a Linux RPM package | Enable Sysadmin
This article shows you how to package a script into an RPM file for easy installation, updating, and removal from your Linux systems....
Read more >
3 Common Tasks — The Yocto Project ® 4.1.999 documentation
3 Common Tasks . This chapter describes fundamental procedures such as creating layers, adding new software packages, extending or customizing images, ...
Read more >
Installation Guide for Linux - NVIDIA Documentation Center
To use NVIDIA CUDA on your system, you will need the following installed: ▷ CUDA-capable GPU. ▷ A supported version of Linux with...
Read more >
Raspberry Pi and Visual Studio Code: A great combination
Microsoft's Visual Studio Code development environment is another of ... of Visual Studio Code are available in rpm, deb, and tar formats, ...
Read more >
MinIO Object Storage for Linux
Procedure. Install the MinIO Server. The following tabs provide examples of installing MinIO onto 64-bit Linux operating systems using RPM, DEB, or ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found