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

Debian package builds fail on ARMv7 #5154

Closed
6XGate opened this issue Jul 18, 2020 · 27 comments
Closed

Debian package builds fail on ARMv7 #5154

6XGate opened this issue Jul 18, 2020 · 27 comments
Labels

Comments

@6XGate
Copy link

6XGate commented Jul 18, 2020

  • Version: 22.7.0
  • Electron Version: 8.4.0
  • Electron Type (current, beta, nightly): current
  • Target: armv7l/arm/arm32

Unable to build Debian package (.deb) for --armv7l due to using the wrong build of FPM, which was x86.

  • downloading     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 size=4.6 MB parts=1
  • downloaded      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 duration=3.13s
  ⨯ cannot execute  cause=exit status 127
                    errorOut=/home/node/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/node/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: No such file or directory
    
                    command=/home/node/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/fpm -s dir --force -t deb -d libgtk-3-0 -d libnotify4 -d libnss3 -d libxss1 -d libxtst6 -d xdg-utils -d libatspi2.0-0 -d libuuid1 -d libappindicator3-1 -d libsecret-1-0 --deb-compression xz --architecture armhf --name bridgecmdr --after-install /tmp/t-ufb98R/0-after-install --after-remove /tmp/t-ufb98R/1-after-remove --description '
     Professional switch and monitor controller for retro gaming' --version 2.0.0-beta --package /workdir/dist/bridgecmdr_2.0.0-beta_armv7l.deb --maintainer 'Matthew Holder <[email protected]>' --url 'https://github.com/6XGate/bridgecmdr#readme' --vendor 'Matthew Holder <[email protected]>' --license GPL-3.0-or-later /workdir/dist/linux-armv7l-unpacked/=/opt/BridgeCmdr /workdir/node_modules/app-builder-lib/templates/icons/electron-linux/16x16.png=/usr/share/icons/hicolor/16x16/apps/bridgecmdr.png /workdir/node_modules/app-builder-lib/templates/icons/electron-linux/32x32.png=/usr/share/icons/hicolor/32x32/apps/bridgecmdr.png /workdir/node_modules/app-builder-lib/templates/icons/electron-linux/48x48.png=/usr/share/icons/hicolor/48x48/apps/bridgecmdr.png /workdir/node_modules/app-builder-lib/templates/icons/electron-linux/64x64.png=/usr/share/icons/hicolor/64x64/apps/bridgecmdr.png /workdir/node_modules/app-builder-lib/templates/icons/electron-linux/128x128.png=/usr/share/icons/hicolor/128x128/apps/bridgecmdr.png /workdir/node_modules/app-builder-lib/templates/icons/electron-linux/256x256.png=/usr/share/icons/hicolor/256x256/apps/bridgecmdr.png /tmp/t-ufb98R/2-BridgeCmdr.desktop=/usr/share/applications/bridgecmdr.desktop
@alienzhangyw
Copy link

alienzhangyw commented Jul 24, 2020

You should write the deb key in package.json like this:
"deb": { "fpm": [ "--architecture=armhf" ] }
And arm versions can only be built on Linux x64 or WSL. By the way don't forget to add 'sudo' before your commands.

@6XGate
Copy link
Author

6XGate commented Jul 30, 2020

Oh, that's going to make multi-arc builds even more fun.

@jyangchisyan
Copy link

You should write the deb key in package.json like this:
"deb": { "fpm": [ "--architecture=armhf" ] }
And arm versions can only be built on Linux x64 or WSL. By the way don't forget to add 'sudo' before your commands.

I think the "fpm" property doesn't support

• electron-builder version=22.7.0 os=5.4.51-v8+
• loaded configuration file=/home/pi/workspace/hyper/electron-builder.json
⨯ Invalid configuration object. electron-builder 22.7.0 has been initialized using a configurat$on object that does not match the API schema.
• configuration.linux.target[0] has an unknown property 'fpm'. These properties are valid:
object { target, arch? }
How to fix:
1. Open https://www.electron.build/configuration/linux
2. Search the option name on the page (or type in into Search to find across the docs).
* Not found? The option was deprecated or not exists (check spelling).
* Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", no
t in the root.

this thread provide the good workaround way

@alienzhangyw
Copy link

You should write the deb key in package.json like this:
"deb": { "fpm": [ "--architecture=armhf" ] }
And arm versions can only be built on Linux x64 or WSL. By the way don't forget to add 'sudo' before your commands.

I think the "fpm" property doesn't support

• electron-builder version=22.7.0 os=5.4.51-v8+
• loaded configuration file=/home/pi/workspace/hyper/electron-builder.json
⨯ Invalid configuration object. electron-builder 22.7.0 has been initialized using a configurat$on object that does not match the API schema.
• configuration.linux.target[0] has an unknown property 'fpm'. These properties are valid:
object { target, arch? }
How to fix:

  1. Open https://www.electron.build/configuration/linux
  2. Search the option name on the page (or type in into Search to find across the docs).
  • Not found? The option was deprecated or not exists (check spelling).
  • Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", no
    t in the root.

this thread provide the good workaround way

There is a fpm option here, maybe you missed it. My repo works fine with it.

@jyangchisyan
Copy link

• electron-builder version=22.7.0 os=5.4.51-v8+
• loaded configuration file=/home/pi/workspace/hyper/electron-builder.json
⨯ Invalid configuration object. electron-builder 22.7.0 has been initialized using a configurat$on object that does not match the API schema.
• configuration.linux.target[0] has an unknown property 'fpm'. These properties are valid:
object { target, arch? }

I found I add the fpm object into the Linux object level. I move it in deb object and the above error message not happen.

There is a fpm option here, maybe you missed it. My repo works fine with it.

However, the fpm package still use x86 version.
Let's check document again. the fpm option only support APK, FreeBSD, Pacman, P5P and RPM target option
I will trace the source code confirm that whether the deb support the fpm option.

@alienzhangyw
Copy link

However, the fpm package still use x86 version.
Let's check document again. the fpm option only support APK, FreeBSD, Pacman, P5P and RPM target option
I will trace the source code confirm that whether the deb support the fpm option.

Yes the fpm still use x86 version because it don't have arm versions, but it works with arm options.
You missed this line in the doc:

All LinuxTargetSpecificOptions can be also specified in the deb to customize Debian package.

And "deb" key should be top-level under the "build" key. You can take a look at my repo BlockPi if you still have problems.

@jyangchisyan
Copy link

You missed this line in the doc:

All LinuxTargetSpecificOptions can be also specified in the deb to customize Debian package.

Thanks for your figure out ! I miss this line.

Yes the fpm still use x86 version because it don't have arm versions, but it works with arm options.

That's clarify. I perhaps misunderstand @6XGate the question.
If we will compile and build it at the armv7 platform. We need follow [this thread] because the compiler does not at x86 platform.
(#3901 (comment))
If just need build for armv7 deb package, could direct apply it
"deb": { "fpm": [ "--architecture=armhf" ] }

@6XGate Hope the above disscussion could solve your problem. If we don't have any other confuse or question. Could close this issue.

Thanks @alienzhangyw patiently explain and participate.

@6XGate
Copy link
Author

6XGate commented Aug 4, 2020

Base on the discussion, I'm not sure since this has to target both x86-64 and ARM 32-bit and 64-bit. To do that, it seem node-gyp has to run from those platforms directly to build native dependencies such as node-serialport.

@stale
Copy link

stale bot commented Oct 3, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

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

@stale stale bot added the backlog label Oct 3, 2020
@6XGate
Copy link
Author

6XGate commented Oct 5, 2020

To the bot... Yes, still relevant. Not sure what is blocking. Not sure what else.

@stale stale bot removed the backlog label Oct 5, 2020
@stale
Copy link

stale bot commented Dec 4, 2020

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

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

@stale stale bot added the backlog label Dec 4, 2020
@6XGate
Copy link
Author

6XGate commented Dec 8, 2020

To the bot... Yes, still relevant. Not sure what is blocking. Not sure what else.

The reason running anything on x86 or x64 will not work for ARM builds it related to Node packages that have native components. node-gyp does not support cross-compiling and therefore must run on the same platform as the application which is being built. In my project node-serialport is the problem dependency.

@6XGate
Copy link
Author

6XGate commented Dec 15, 2020

A similar issue with happens with AppImage building due to some missing dependency, per #5153

@stale stale bot removed the backlog label Dec 15, 2020
@stale
Copy link

stale bot commented Feb 13, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

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

@stale stale bot added the backlog label Feb 13, 2021
@6XGate
Copy link
Author

6XGate commented Feb 13, 2021

It's still relevant since ARM packages can't be built natively on ARM with electron-builder. But, to anyone looking for a workaround; use the combination of Electron Rebuild, Electron Packager, and electron-installer-debian to do the same thing.

It is strange that the Debian packager in that list is by the same group as electron-builder and works fine on ARM.

@stale stale bot removed the backlog label Feb 13, 2021
@olof-nord
Copy link

I just ran into this problem myself. It surprises me that this is an issue: I thought this would be one of the core features of a cross-platform tool, to be compatible with many platforms.

Here is an article how to fix it for ARM: https://www.beekeeperstudio.io/blog/electron-apps-for-arm-and-raspberry-pi

@mmaietta
Copy link
Collaborator

mmaietta commented Apr 8, 2021

I'm a newcomer to this subject. What arch/version of fpm do we need to resolve this issue?

@olof-nord
Copy link

The issue is not so much as to which version, but that FPM is not present with the correct arch, for ARM.

I managed to get a successful electron-builder build with the following:

sudo apt install ruby ruby-dev
sudo gem install fpm
export USE_SYSTEM_FPM=true

I am trying to use electron-builder on a PinePhone, an ARM device.
When building I get the same error as shown by Matthew Rathbone, quoting from the link I posted previously, section "Fixing DEB and RPM Builds for ARM":

Electron Builder uses FPM to build DEB and RPM files. Typically Electron Builder will download Ruby and FPM to a local directory automatically to make it work.
When you try to build you’ll get the following error:

Cannot execute  cause=exit status 1
  errorOut=/home/rathboma/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/rathboma/.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

If you look closely at the error you can see that electron-builder is trying to use an x86 version version of FPM. This is hard coded, and so does not work on an ARM box.

Luckily there is a workaround - Install Ruby, Rubygems, and FPM, then set the totally undocumented USE_SYSTEM_FPM environment variable to true.

@stale
Copy link

stale bot commented Jun 9, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

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

@stale stale bot added the backlog label Jun 9, 2021
@6XGate
Copy link
Author

6XGate commented Jun 9, 2021

I'll have to give that a try soon

@stale stale bot removed the backlog label Jun 9, 2021
@stale
Copy link

stale bot commented Aug 28, 2021

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

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

@stale stale bot added the backlog label Aug 28, 2021
@stale stale bot closed this as completed Sep 21, 2021
eventualbuddha added a commit to votingworks/kiosk-browser that referenced this issue Apr 26, 2022
In the process, it was easier to switch from the seemingly not really maintained `electron-forge` to using `electron-builder` and `electron` directly. This did introduce one wrinkle: `electron-builder` uses `fpm` to build `.deb` packages, which itself depends on Ruby. `electron-builder` tries to use a self-contained `fpm` and Ruby build, but it doesn't work on ARM yet (electron-userland/electron-builder#5154). I work around this problem by telling `electron-build` (via an environment variable) to use the system version of `fpm`, then ensure that Ruby and the `fpm` gem are installed in `install-dependencies.sh`.
eventualbuddha added a commit to votingworks/kiosk-browser that referenced this issue Apr 26, 2022
In the process, it was easier to switch from the seemingly not really maintained `electron-forge` to using `electron-builder` and `electron` directly. This did introduce one wrinkle: `electron-builder` uses `fpm` to build `.deb` packages, which itself depends on Ruby. `electron-builder` tries to use a self-contained `fpm` and Ruby build, but it doesn't work on ARM yet (electron-userland/electron-builder#5154). I work around this problem by telling `electron-build` (via an environment variable) to use the system version of `fpm`, then ensure that Ruby and the `fpm` gem are installed in `install-dependencies.sh`.
@mkurz
Copy link

mkurz commented Nov 8, 2022

If someone wants to make fpm in electron-builder work for arm64/aarch64 I wrote a guide how to do so here: signalapp/Signal-Desktop#6063 (comment)
Feel free to pick up that work, I don't have time to do so.

@jgresham
Copy link
Contributor

Is anyone else working on @mkurz's proposed steps to fix this in electron-builder? I'm thinking to take a try at this

@mmaietta
Copy link
Collaborator

If someone wants to pick up the work for electron-builder-binaries (I'm not sure how that repo works or have write-access to it atm), I can help with the app-builder and electron-builder updates as I have write-access to those

@jgresham
Copy link
Contributor

jgresham commented Mar 18, 2024

If someone wants to pick up the work for electron-builder-binaries (I'm not sure how that repo works or have write-access to it atm), I can help with the app-builder and electron-builder updates as I have write-access to those

I spent some time looking at this today. The options for compiling ruby to a binary executable seem nonexistent. There was a popular tool called ruby-packer/rubyc but is 3 years old and no longer works. tebako is newer and could be what we're looking for, but I ran into numerous errors when trying it on fpm. Perhaps a Ruby dev could point us in the right direction so I added an issue on fpm repo asking for help.

@jgresham
Copy link
Contributor

If someone wants to pick up the work for electron-builder-binaries (I'm not sure how that repo works or have write-access to it atm), I can help with the app-builder and electron-builder updates as I have write-access to those

I believe I have an arm64 executable for fpm https://github.com/jgresham/fpm-arm-binary. I will update this comment with the steps to create it in a docker container soon.

root@0deeb46a2e0c:/fpm-arm-binary# fpm -s npm -t deb express
bash: fpm: command not found
root@0deeb46a2e0c:/fpm-arm-binary# ./fpm-arm64-binary -s npm -t deb express
Created package {:path=>"node-express_4.18.3_arm64.deb"}
root@0deeb46a2e0c:/fpm-arm-binary# ./fpm-arm64-binary -v
1.15.1

@jgresham
Copy link
Contributor

@mmaietta do you want to take it from here? or should I try to make the remaining changes suggested in signalapp/Signal-Desktop#6063 (comment)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants