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

Stripping Electron ARMv7 binary files fails in RPM maker. #3102

Closed
3 tasks done
SpacingBat3 opened this issue Dec 1, 2022 · 7 comments
Closed
3 tasks done

Stripping Electron ARMv7 binary files fails in RPM maker. #3102

SpacingBat3 opened this issue Dec 1, 2022 · 7 comments

Comments

@SpacingBat3
Copy link
Contributor

SpacingBat3 commented Dec 1, 2022

Pre-flight checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project uses.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Electron Forge version

6.0.3, 6.0.4

Electron version

22.0.0

Operating system

ubuntu-latest (GitHub Actions), probably any GNU/Linux distro with recent enough software

Last known working Electron Forge version

6.0.3 (with Electron 21.x.y) on ubuntu-20.04

Expected behavior

RPM distributables will make without any failures with newer binutils version found in ubuntu-latest.

Actual behavior

/usr/bin/strip seem to not be able to recognize format of ARMv7 libraries or executables, returning a non-zero exit code and causing failure of the maker.

Steps to reproduce

Just try to generate RPM distributables for armhf on x64 hosts with Electron Forge and Ubuntu with binutils=2.38-4ubuntu2 or Arch Linux with binutils=2.39 (I guess it affects binutils of at least version 2.38).

Additional information

Full logs and build/make steps can be seen in the following GitHub workflow run:

https://github.com/SpacingBat3/WebCord/actions/runs/3587615855/jobs/6038174672

This seems to be regression caused on Electron side, workflow runs before Electron update seem to generate RPMs successfully (on Electron Forge 6.0.3). EDIT: Thanks @jbtobar, it indeed looks like this is a bug with more recent binutils version. I haven't myself get deep into this issue, I just blamed it could be caused by switch to new Electron major version, not software update.

@jbtobar
Copy link

jbtobar commented Dec 1, 2022

In case it helps you because I just spent nearly a day debugging this. ubuntu-latest runs on ubuntu 22 where it was failing - same error as your run. I switched to ubuntu-20.04 on github actions and worked.

SpacingBat3 added a commit to SpacingBat3/WebCord that referenced this issue Dec 2, 2022
Downgrade GitHub-hosted Linux runner to `ubuntu-20.04`.
@SpacingBat3
Copy link
Contributor Author

In case it helps you because I just spent nearly a day debugging this. ubuntu-latest runs on ubuntu 22 where it was failing - same error as your run. I switched to ubuntu-20.04 on github actions and worked.

@jbtobar I've also noticed it doesn't really happend for ARM64 at all – I'll try to update bug description accordingly to all of that information we gathered. I'd love deprecating ARM 32-bit someday, but in Linux ARM world 32-bit processors are still quite common and even Raspberries of version 4 are still considered to be stable only on 32-bit OS, in most cases due to the lack of 64-bit drivers for all SoC components.

And really appreciate your time investment on this issue, I've been also able to reproduce it on Arch Linux as well. I haven't much digged into it myself once I reported it, I wanted to deeply take a look at it before new version of my software and once I actually have time for that.

As stripping doesn't seem to be a really important process of packaging, maybe Electron Forge shouldn't really care much if it succeed or not (display a warning instead of causing a failure)? I guess it would be rather useful to progress further than cause a global failure of the make command unless strip is necessary while generating RPMs and there's no way to get further without using it.

@VerteDinde
Copy link
Member

@SpacingBat3 @jbtobar Thanks both for the detailed reports! We'll look into the issue on Ubuntu 22.04 with binutils.

Just to clarify the range of the issue - does the issue seem to be dependent on having both Ubuntu 22.04 and Electron 22? Or does the issue also appear on Ubuntu 22.04 while using older versions of Electron?

@SpacingBat3
Copy link
Contributor Author

TL;DR: Electron doesn't matter, keeping binutils at recent versions should make it reproducible.


Just to clarify the range of the issue - does the issue seem to be dependent on having both Ubuntu 22.04 and Electron 22?

@VerteDinde not really, it seems to happen with older Electron versions as well, Ubuntu 22.04 is also not a requirement althrough it is the OS used in GitHub makers. See updated Steps to reproduce section:

Just try to generate RPM distributables for armhf on x64 hosts with Electron Forge and Ubuntu with binutils=2.38-4ubuntu2 or Arch Linux with binutils=2.39 (I guess it affects binutils of at least version 2.38).

Given Ubuntu 20.04 uses much older version of binutils, this issue is confirmed to be reproducible with recent enough binutils version.

So requirement to constantly reproduce this issue is to run Electron Forge make job with --arch=armv7l and having binutils installed of version in SemVer range >=2.38 <=2.39. It is very likely future binutils releases will also cause RPM maker to fail. As of RPM tools versions, on Arch they're currently at 4.18.0, IDK how it is with Ubuntu 22.04.

@SpacingBat3 SpacingBat3 changed the title Stripping Electron ARM binary files fails in RPM maker. Stripping Electron ARMv7 binary files fails in RPM maker. Dec 11, 2022
erickzhao added a commit to electron/fiddle that referenced this issue Jan 10, 2023
@dsanders11
Copy link
Member

Thanks for reporting the issue and writing it up @SpacingBat3!

As stripping doesn't seem to be a really important process of packaging, maybe Electron Forge shouldn't really care much if it succeed or not (display a warning instead of causing a failure)? I guess it would be rather useful to progress further than cause a global failure of the make command unless strip is necessary while generating RPMs and there's no way to get further without using it.

The error comes from within rpmbuild, and I don't believe they provide any options for that kind of graceful behavior.

As of RPM tools versions, on Arch they're currently at 4.18.0, IDK how it is with Ubuntu 22.04.

Ubuntu 22.04 has version 4.17.0.

I've dug into this and the root cause is not in binutils, but in the rpm package, specifically this commit (which was first in the 4.17 release) is what caused the behavior change between Ubuntu 20.04 and 22.04. Before that change, on Ubuntu 20.04 the executable files weren't being stripped, so there wasn't the problem of trying to use the system /usr/bin/strip to strip executables for a different target architecture than the host architecture. That won't work regardless of the binutils version.

The reason arm64 acted differently is due to another bug which caused it to be built slightly differently by rpmbuild, that issue is being fixed in #3137, at which point arm64 will also hit this issue. 🙃

Working on an upstream fix for this issue in electron-userland/electron-installer-redhat#325.

I'd recommend @jbtobar's workaround for now. If you can't use that workaround, you should be able to disable stripping by creating a ~/.rpmmacros file with the line %__strip /bin/true - that changes the binary used for stripping to one that will be a no-op and allow the RPM building process to continue. That will affect all usage of rpmbuild on the system though, so keep that in mind.

@erickzhao
Copy link
Member

erickzhao commented Jan 12, 2023

Looks like adding echo "%__strip /bin/true" >> ~/.rpmmacros works for us over in Electron Fiddle:

electron/fiddle@d4825d3

I'll work on releasing electron-installer-redhat and updating it for the next Forge release a future Forge release. :)

@dsanders11
Copy link
Member

dsanders11 commented Feb 8, 2023

@SpacingBat3, this should be fixed with electron-installer-redhat@^3.3.0 and Forge v6.0.5. I'm going to tentatively close this, but if you still see it on those new versions, please ping and I'll reopen.

cc @jbtobar as well

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

No branches or pull requests

5 participants