iohook icon indicating copy to clipboard operation
iohook copied to clipboard

invalid ELF header

Open baj9032 opened this issue 3 years ago • 9 comments
trafficstars

I am trying to integrate this package into the electron app.

Node: v14.18.2 iohook: ^0.9.3 electron: 16.0.0 Ihook configuration:

"iohook": {
    "targets": [
      "electron-99"
    ],
    "platforms": [
      "linux",
      "win32",
      "darwin"
    ],
    "arches": [
      "x64",
      "ia32"
    ]
  }

my package JSON file:


{
  "name": "time-tracker",
  "version": "1.0.0",
  "description": "Time Tracker",
  "keywords": [
    "angular",
    "angular 13",
    "electron",
    "electron 16",
    "nodejs",
    "typescript",
    "playwright",
    "eslint",
    "sass",
    "windows",
    "mac",
    "linux"
  ],
  "main": "app/main.js",
  "private": true,
  "scripts": {
    "postinstall": "electron-builder install-app-deps",
    "ng": "ng",
    "start": "npm-run-all -p electron:serve ng:serve",
    "build": "npm run electron:serve-tsc && ng build --base-href ./",
    "build:dev": "npm run build -- -c dev",
    "build:prod": "npm run build -- -c production",
    "ng:serve": "ng serve -c web -o",
    "electron": "electron",
    "electron:serve-tsc": "tsc -p tsconfig.serve.json",
    "electron:serve": "wait-on tcp:4200 && npm run electron:serve-tsc && electron . --serve",
    "electron:local": "npm run build:prod && electron .",
    "electron:build": "npm run build:prod && electron-builder build --publish=never",
    "test": "ng test --watch=false",
    "test:watch": "ng test",
    "e2e": "npm run build:prod && playwright test -c e2e/playwright.config.ts e2e/",
    "e2e:show-trace": "playwright show-trace e2e/tracing/trace.zip",
    "version": "conventional-changelog -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
    "lint": "ng lint"
  },
  "dependencies": {
    "@angular/animations": "13.0.1",
    "@angular/cdk": "^13.1.1",
    "@angular/common": "13.0.1",
    "@angular/compiler": "13.0.1",
    "@angular/core": "13.0.1",
    "@angular/forms": "13.0.1",
    "@angular/language-service": "13.0.1",
    "@angular/material": "^13.1.1",
    "@angular/platform-browser": "13.0.1",
    "@angular/platform-browser-dynamic": "13.0.1",
    "@angular/router": "13.0.1",
    "@electron/remote": "^2.0.1",
    "iohook": "^0.9.3",
    "rxjs": "7.4.0",
    "tslib": "^2.1.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "13.0.0",
    "@angular-devkit/build-angular": "13.0.2",
    "@angular-eslint/builder": "13.0.0-alpha.0",
    "@angular-eslint/eslint-plugin": "13.0.0-alpha.0",
    "@angular-eslint/eslint-plugin-template": "13.0.0-alpha.0",
    "@angular-eslint/schematics": "13.0.0-alpha.0",
    "@angular-eslint/template-parser": "13.0.0-alpha.0",
    "@angular/cli": "13.0.2",
    "@angular/compiler-cli": "13.0.1",
    "@ngx-translate/core": "14.0.0",
    "@ngx-translate/http-loader": "7.0.0",
    "@playwright/test": "1.16.3",
    "@types/jasmine": "3.10.2",
    "@types/jasminewd2": "2.0.10",
    "@types/node": "16.11.7",
    "@typescript-eslint/eslint-plugin": "5.4.0",
    "@typescript-eslint/parser": "5.4.0",
    "conventional-changelog-cli": "2.1.1",
    "electron": "16.0.0",
    "electron-builder": "22.13.1",
    "electron-reload": "1.5.0",
    "eslint": "8.2.0",
    "eslint-plugin-import": "2.25.3",
    "eslint-plugin-jsdoc": "37.0.3",
    "eslint-plugin-prefer-arrow": "1.2.3",
    "jasmine-core": "3.10.1",
    "jasmine-spec-reporter": "7.0.0",
    "karma": "6.3.9",
    "karma-coverage-istanbul-reporter": "3.0.3",
    "karma-electron": "7.1.0",
    "karma-jasmine": "4.0.1",
    "karma-jasmine-html-reporter": "1.7.0",
    "node-polyfill-webpack-plugin": "1.1.4",
    "npm-run-all": "4.1.5",
    "playwright": "1.16.3",
    "ts-node": "10.4.0",
    "typescript": "~4.4.4",
    "wait-on": "6.0.0",
    "webdriver-manager": "12.1.8"
  },
  "engines": {
    "node": ">=14.0.0"
  },
  "browserslist": [
    "chrome 91"
  ],
  "iohook": {
    "targets": [
      "electron-99"
    ],
    "platforms": [
      "linux",
      "win32",
      "darwin"
    ],
    "arches": [
      "x64",
      "ia32"
    ]
  }
}

the error that I am getting

image

baj9032 avatar Dec 29 '21 08:12 baj9032

Looks like you're using Electron 16.0.0 not 6.0.0, correct? iohook doesn't yet offer prebuilds for Electron 16 but you can build it manually. However it can only work in the main process because iohook is not context aware. Which means that you can't require it in the renderer process past Electron 13.

marcelblum avatar Dec 29 '21 15:12 marcelblum

Looks like you're using Electron 16.0.0 not 6.0.0, correct? iohook doesn't yet offer prebuilds for Electron 16 but you can build it manually. However it can only work in the main process because iohook is not context aware. Which means that you can't require it in the renderer process past Electron 13.

oh yaa electron 16

baj9032 avatar Dec 29 '21 18:12 baj9032

Looks like you're using Electron 16.0.0 not 6.0.0, correct? iohook doesn't yet offer prebuilds for Electron 16 but you can build it manually. However it can only work in the main process because iohook is not context aware. Which means that you can't require it in the renderer process past Electron 13.

is there any doc that we can do build manually?

baj9032 avatar Dec 29 '21 18:12 baj9032

https://wilix-team.github.io/iohook/manual-build.html

marcelblum avatar Dec 29 '21 18:12 marcelblum

https://wilix-team.github.io/iohook/manual-build.html

manual build doesn't work

image

baj9032 avatar Dec 29 '21 18:12 baj9032

You'll get best results cloning the iohook repo and building from there rather than building from /node_modules/ inside another project. Try cloning the repo, then npm install, then node build.js --runtime electron --version 16.0.0 --abi 99 --upload=false

marcelblum avatar Dec 29 '21 19:12 marcelblum

@marcelblum

what is use of this build? image

baj9032 avatar Dec 29 '21 20:12 baj9032

I don't understand your question. Looks from your screenshot like you successfully built the binaries. Next copy them into your project's /node_modules/iohook/ folder so you can use them there. For linux and electron 16 I believe you need to place the iohook.node and uiohook.so binaries into /node_modules/iohook/builds/electron-v99-linux-x64/build/Release/.

marcelblum avatar Dec 29 '21 21:12 marcelblum

I don't understand your question. Looks from your screenshot like you successfully built the binaries. Next copy them into your project's /node_modules/iohook/ folder so you can use them there. For linux and electron 16 I believe you need to place the iohook.node and uiohook.so binaries into /node_modules/iohook/builds/electron-v99-linux-x64/build/Release/.

Resolved thanks. we can close this issue

baj9032 avatar Jan 03 '22 07:01 baj9032