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:
- Created 4 years ago
- Comments:16
Top GitHub Comments
I’ve found a solution which can partially solve this problem.
electron-builder
checks a system variable namingUSE_SYSTEM_FPM
when attempting to acquire thefpm
tool, which is used to generaterpm
anddeb
package. When this environment variable is set totrue
,electron-builder
will attempt to launchfpm
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.tsYou can get
fpm
using other ways the Linux system provides. You have to install packages which makeruby
andgem
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 installfpm
simply running the commandgem install fpm
. After the installation, a soft link might have to be created to helpelectron-builder
findfpm
. In my environment, I created the link by running the following commandThen, before the packaging procedure, just set the environment variable by running
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 usabledeb
package which can be successfully installed in Debian when packaging under openSUSE environment. see this issue: https://github.com/jordansissel/fpm/issues/737However, if you use Debian, it’s all fine.
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