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

cannot execute binary file: Exec format error #5432

Closed
Mair opened this issue Nov 20, 2020 · 10 comments
Closed

cannot execute binary file: Exec format error #5432

Mair opened this issue Nov 20, 2020 · 10 comments
Labels

Comments

@Mair
Copy link

Mair commented Nov 20, 2020

  • Version: 22.9.1
  • Electron Version: 11.0.1
  • Electron Type (current, beta, nightly): current
  • Target: --armv7l --linux deb

I am creating an Electron app that uses CRA for the Raspberry pi using Raspian.

The app works fine in dev but when running a build I get an error that seems ruby related.
I tried to follow #3901 to no avail :(

Any help would be appreciated
Error output as follows

root@raspberrypi:/home/pi/pi-hunter# npm run build

> [email protected] build /home/pi/pi-hunter
> npm run react-build && tsc -p electron && npm run electron-build


> [email protected] react-build /home/pi/pi-hunter
> react-scripts build

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  41.58 KB  build/static/js/2.597642b9.chunk.js
  1.4 KB    build/static/js/3.bd26388e.chunk.js
  1.17 KB   build/static/js/runtime-main.3117473d.js
  742 B     build/static/js/main.b47505a3.chunk.js
  531 B     build/static/css/main.8c8b27cf.chunk.css

The project was built assuming it is hosted at ./.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.

Find out more about deployment here:

  https://cra.link/deployment


> [email protected] electron-build /home/pi/pi-hunter
> electron-builder --dir --armv7l --linux deb

  • electron-builder  version=22.9.1 os=5.4.72-v7l+
  • loaded configuration  file=package.json ("build" field)
  • loaded parent configuration  preset=react-cra
  • writing effective config  file=dist/builder-effective-config.yaml
  • rebuilding native dependencies  [email protected] platform=linux arch=armv7l
  • packaging       platform=linux arch=armv7l electron=11.0.1 appOutDir=dist/linux-armv7l-unpacked
  • building        target=deb arch=armv7l file=dist/pi-hunter_0.1.0_armv7l.deb
  • default Electron icon is used  reason=application icon is not set
  • application Linux category is set to default "Utility"  reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux
  ⨯ cannot execute  cause=exit status 1
                    errorOut=/root/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /root/.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
    /root/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /root/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: Success
    
                    command=/root/.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 pi-hunter --after-install /tmp/t-yig8oz/0-after-install --after-remove /tmp/t-yig8oz/1-after-remove --description '
     PI Hunter for PRI 4' --version 0.1.0 --package /home/pi/pi-hunter/dist/pi-hunter_0.1.0_armv7l.deb --maintainer 'Mair <[email protected]>' --url http://./ --vendor 'Mair <[email protected]>' /home/pi/pi-hunter/dist/linux-armv7l-unpacked/=/opt/pi-hunter /home/pi/pi-hunter/node_modules/app-builder-lib/templates/icons/electron-linux/16x16.png=/usr/share/icons/hicolor/16x16/apps/pi-hunter.png /home/pi/pi-hunter/node_modules/app-builder-lib/templates/icons/electron-linux/32x32.png=/usr/share/icons/hicolor/32x32/apps/pi-hunter.png /home/pi/pi-hunter/node_modules/app-builder-lib/templates/icons/electron-linux/48x48.png=/usr/share/icons/hicolor/48x48/apps/pi-hunter.png /home/pi/pi-hunter/node_modules/app-builder-lib/templates/icons/electron-linux/64x64.png=/usr/share/icons/hicolor/64x64/apps/pi-hunter.png /home/pi/pi-hunter/node_modules/app-builder-lib/templates/icons/electron-linux/128x128.png=/usr/share/icons/hicolor/128x128/apps/pi-hunter.png /home/pi/pi-hunter/node_modules/app-builder-lib/templates/icons/electron-linux/256x256.png=/usr/share/icons/hicolor/256x256/apps/pi-hunter.png /tmp/t-yig8oz/2-pi-hunter.desktop=/usr/share/applications/pi-hunter.desktop
                    workingDir=
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] electron-build: `electron-builder --dir --armv7l --linux deb`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] electron-build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-11-20T05_48_21_522Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `npm run react-build && tsc -p electron && npm run electron-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-11-20T05_48_21_610Z-debug.log

config in package.json is as follows

"build": {
    "extends": "react-cra",
    "appId": "pi-hunter",
    "files": [
      "build/**/*",
      "node_modules/**/*"
    ],
    "directories": {
      "buildResources": "assets"
    },
    "linux": {
      "target": "deb"
    }
  },

Scripts as follows


  "scripts": {
    "react-start": "react-scripts start",
    "react-build": "react-scripts build",
    "react-test": "react-scripts test --env=jsdom",
    "react-eject": "react-scripts eject",
    "electron-build": "electron-builder --dir --armv7l --linux deb",
    "postinstall": "electron-builder install-app-deps",
    "release": "tsc -p electron && npm run react-build && electron-builder --publish=always",
    "build": "npm run react-build && tsc -p electron && npm run electron-build",
    "start": "concurrently \"cross-env BROWSER=none npm run react-start\" \"tsc -p electron -w\" \"wait-on http://localhost:3000 && electron --no-sandbox --inspect .\""
  },
@stale
Copy link

stale bot commented Jan 20, 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 Jan 20, 2021
@hovancik
Copy link

it was 2 weeks ago, so probably yes.

@stale stale bot removed the backlog label Jan 21, 2021
@riccardolardi
Copy link

riccardolardi commented Apr 11, 2021

Hi @Mair @hovancik have you been able to solve or work around this? I'm facing the same issue trying to build for Raspberry Pi OS.

@Mair
Copy link
Author

Mair commented Apr 11, 2021

@riccardolardi No unfortunately not yet

@hovancik
Copy link

I am having some workarounds and I am able to build: arm64.deb and armv7l.deb. You can check it here: https://github.com/hovancik/stretchly/blob/trunk/.drone.yml

Would be nice if this could be fixed in electron builder. I still can't make snap packages working...

@riccardolardi
Copy link

riccardolardi commented Apr 14, 2021

Thanks @hovancik sadly it's out of question for me since I'm on Raspberry Pi OS and some dependencies in your chain (gcc-multilib, g++-multilib) are not available for the platform. Are you using Ubuntu on the Raspi? Or other Debian?

@hovancik
Copy link

@riccardolardi check what platform you run your Raspi. gcc tools are for amd64

For example arm64 is like this:

platform:
  os: linux
  arch: arm64

steps:
- name: Build
  image: arm64v8/node:14.16.0-buster
  commands:
  - apt update && apt-get install --no-install-recommends -y ruby-full bsdtar rpm libopenjp2-tools
  - gem install fpm -v 1.10.1
  - export USE_SYSTEM_FPM="true"
  - npm install
  - npm install npm -g
  - node_modules/.bin/electron-builder build --arm64
  environment:
    GH_TOKEN:
      from_secret: GH_TOKEN

You can also see that it is Debian Buster.

@riccardolardi
Copy link

@hovancik I am on armv7l

@hovancik
Copy link

I guess that's arm32v7? I don't know

@stale
Copy link

stale bot commented Jun 16, 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 16, 2021
@stale stale bot closed this as completed Jun 26, 2021
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

3 participants