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

ARM64 rebuild package not working - always deploys X86 #8677

Open
supertick opened this issue Nov 11, 2024 · 5 comments
Open

ARM64 rebuild package not working - always deploys X86 #8677

supertick opened this issue Nov 11, 2024 · 5 comments

Comments

@supertick
Copy link

supertick commented Nov 11, 2024

  • Electron-Builder Version: 25.1.8
  • Node Version: 20.18.1
  • Electron Version: 31.7.3
  • Electron Type (current):
  • Target: arm64

Trying to cross compile on a github action runner for arm64 (raspi) for serialport bindings

  "package": "yarn prebuild && yarn build && yarn copy-public",
  "package-linux-arm64": "yarn package && npx electron-rebuild -f --arch=arm64 && electron-builder --linux AppImage --arm64",

The rebuild reports arm64

  COPY Release/cpufeatures.node
make: Leaving directory '/home/runner/work/robotlab-x/robotlab-x/server/node_modules/cpu-features/build'
✔ Rebuild Complete
  • electron-builder  version=25.1.8 os=6.5.0-1025-azure
  • loaded configuration  file=package.json ("build" field)
  • @electron/rebuild already used by electron-builder, please consider to remove excess dependency from devDependencies

To ensure your native dependencies are always matched electron version, simply add script `"postinstall": "electron-builder install-app-deps" to your `package.json`
  • executing @electron/rebuild  electronVersion=31.7.3 arch=arm64 buildFromSource=false appDir=./
  • installing native dependencies  arch=arm64
  • preparing       moduleName=@serialport/bindings arch=arm64
  • finished        moduleName=@serialport/bindings arch=arm64
  • preparing       moduleName=@serialport/bindings-cpp arch=arm64
  • finished        moduleName=@serialport/bindings-cpp arch=arm64
  • preparing       moduleName=cpu-features arch=arm64
  • finished        moduleName=cpu-features arch=arm64
  • completed installing native dependencies
  • packaging       platform=linux arch=arm64 electron=31.7.3 appOutDir=/home/runner/work/robotlab-x/robotlab-x/dist/packages/linux-arm64-unpacked
  • downloading     url=https://github.com/electron/electron/releases/download/v31.7.3/electron-v31.7.3-linux-arm64.zip size=106 MB parts=8
  • downloaded      url=https://github.com/electron/electron/releases/download/v31.7.3/electron-v31.7.3-linux-arm64.zip duration=432ms
  • building        target=AppImage arch=arm64 file=/home/runner/work/robotlab-x/robotlab-x/dist/packages/robotlab-x-0.9.224-arm64.AppImage
  • downloading     url=https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-12.0.1/appimage-12.0.1.7z size=1.6 MB parts=1
  • downloaded      url=https://github.com/electron-userland/electron-builder-binaries/releases/download/appimage-12.0.1/appimage-12.0.1.7z duration=141ms
Done in 25.02s.

The AppImage is arm64 but the serialport/bindings are x86:

file /tmp/.mount_robotlxD4414/resources/app.asar.unpacked/node_modules/@serialport/bindings/build/Release/bindings.node
/tmp/.mount_robotlxD4414/resources/app.asar.unpacked/node_modules/@serialport/bindings/build/Release/bindings.node: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=b386300dd94cd02c193230bd3b319aee2fe19472, not stripped
@mmaietta
Copy link
Collaborator

mmaietta commented Nov 13, 2024

Can you try with v26.0.0-alpha.6?

I contributed some changes upstream to electron/rebuild and electron-builder updated that dependency in one of the recent alpha versions. Note: you shouldn't need npx electron-rebuild -f --arch=arm64 in your build script.

@supertick
Copy link
Author

supertick commented Nov 15, 2024

Thanks,
I tried v26.0.0-alpha.6, both with npx electron-rebuild -f --arch=arm64 && and without.
Always with electron-builder --linux AppImage --arm64
Same behavoir, it appears to correctly build the executable but, the AppImage release contains x86-64 binaries
image

@mmaietta
Copy link
Collaborator

Can you share a minimum reproducible repo that I could take a look at? This sounds like a bug in @electron/rebuild that I could investigate and fix upstream.

To hopefully unblock you, you can use the previous app-builder-bin implementation, set nativeRebuilder: legacy in your config.

@supertick
Copy link
Author

The project is currently green shield in github - https://github.com/RobotLab-X/robotlab-x
This is the package.json defining the arm 64 build:
https://github.com/RobotLab-X/robotlab-x/blob/main/server/package.json

Steps to reproduce should be straight forward:
on a linux x86 64 machine:

git clone https://github.com/RobotLab-X/robotlab-x.git
cd robotlab-x
yarn install-all
yarn build-client
yarn install-client
yarn package-linux-arm64

An AppImage will get created in dist/packages.
It will be executable on arm64 - but the file extracted in /tmp/.mount ..../resources/app.asar.unpacked/node_modules /Release/bindings.node will be a x86-64 binary

Thanks for looking into this :)

@supertick
Copy link
Author

At the moment I have a self-hosted git runner that's building it on a raspi since the cross compiler deployment isn't working

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

No branches or pull requests

2 participants