electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.64k stars 1.74k forks source link

serialport: wrong ELF class: ELFCLASS64 #2586

Closed muccix closed 6 years ago

muccix commented 6 years ago

NB: Not sure this is an electron-builder issue.

I'm building an app from a linux mint sytem (64bit). When I try to run the application on the target machine (raspberry PI 3) I get the follofing error:

Uncaught Exception:
Error: /tmp/.org.chromium.Chromium.Nz7oiq: wrong ELF class: ELFCLASS64
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:187:18)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at bindings (/tmp/.mount_electrtNtVh0/app/resources/app.asar/node_modules/bindings/bindings.js:81:44)
    at Object.<anonymous> (/tmp/.mount_electrtNtVh0/app/resources/app.asar/node_modules/serialport/lib/bindings/linux.js:2:36)

To me, It looks like the package serialport is compile for a 64bit system instead of 32bit.

Her is my package.json:

{
  "name": "****",
  "version": "1.0.0",
  "description": "****",
  "main": "main.js",
  "scripts": {
    "start": "./node_modules/.bin/electron .",
    "test": "mocha --recursive",
    "pack": "electron-builder --dir",
    "dist": "electron-builder",
    "distRasp": "electron-builder --armv7l",
    "postinstall": "electron-builder install-app-deps"
  },
  "repository": "****",
  "keywords": [
    "Electron",
    "brina"
  ],
  "author": "********",
  "license": "*****",
  "devDependencies": {
    "electron": "~1.7.8",
    "electron-builder": "^20.0.4",
    "electron-rebuild": "^1.6.0",
    "electron-reload": "^1.2.2",
    "expect.js": "^0.3.1",
    "mocha": "^5.0.0"
  },
  "dependencies": {
    "bitwise": "^0.2.0",
    "bulma": "^0.6.2",
    "data-table": "^2.0.0",
    "deep-equal": "^1.0.1",
    "electron-store": "^1.3.0",
    "font-awesome": "^4.7.0",
    "javascript-state-machine": "^3.0.1",
    "jquery": "^3.2.1",
    "serialport": "^6.0.4"
  },
  "build": {
    "appId": "******",
    "linux": {
      "target": ["AppImage", "deb"]
    }
  }
}
develar commented 6 years ago
  1. electron-rebuild is not required — electron-builder rebuilds deps.
  2. Probably serialport doesn't provide prebuild version for "raspberry PI 3" — arm64 (check what arch). Please file issue to serialport As far I see — https://github.com/node-serialport/node-serialport/releases/tag/v6.1.0 — no prebuilds for ARM.
njho commented 5 years ago

@muccix Did you have any luck with resolving this? I'm having the same issue.

Macek007 commented 5 years ago

I have not solution but workaround that works for me (after several hours of experiments without solution)

Take correctly builded node_modules/@serialport on Raspberry and copy them on system where you are building AppImage. (npm install have to be called before copying) In your package.json add

"build":
...
    "npmRebuild":false
...

Than call npm build

After running AppImage on RPi you may have this issue https://github.com/RocketChat/Rocket.Chat.Electron/issues/676 with noexec on /tmp

reza7rm commented 4 years ago

I have the same issue as well, any solution? @Macek007 I am building an electron app on an ubuntu machine with different architecture creating an appImage for raspberry. everything works until I use the serial port. could you please explain more about the solution?