rhysmorgan134 / react-carplay

MIT License
423 stars 65 forks source link

Build fails when prebuilding USB #14

Closed LRYMND closed 2 years ago

LRYMND commented 2 years ago

When trying to build the app it is having troubles to do the pre build for the node usb module.

Here's the log:

> electron-builder build --linux AppImage --armv7l -c.extraMetadata.main=build/electron/main.js --publish never

  • electron-builder  version=22.14.13 os=5.15.32-v8+
  • loaded configuration  file=package.json ("build" field)
  • public/electron.js not found. Please see https://medium.com/@kitze/%EF%B8%8F-from-react-to-an-electron-app-ready-for-production-a0468ecb1da3
  • loaded parent configuration  preset=react-cra
  • description is missed in the package.json  appPackageFile=/home/volvo/Development/rtvi/package.json
  • electron-rebuild not required if you use 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`
  • writing effective config  file=dist/builder-effective-config.yaml
  • rebuilding native dependencies  dependencies=usb@1.7.2 platform=linux arch=armv7l
  • install prebuilt binary  name=usb version=1.7.2 platform=linux arch=armv7l napi=
  • build native dependency from sources  name=usb
                                          version=1.7.2
                                          platform=linux
                                          arch=armv7l
                                          napi=
reason=prebuild-install failed with error (run with env DEBUG=electron-builder to get more information)
                                          error=prebuild-install info begin Prebuild-install version 5.3.6
    prebuild-install WARN install prebuilt binaries enforced with --force!
    prebuild-install WARN install prebuilt binaries may be out of date!
    prebuild-install info looking for cached prebuild @ /home/volvo/.npm/_prebuilds/5d82ba-usb-v1.7.2-napi-v4-linux-armv7l.tar.gz
    prebuild-install http request GET https://github.com/tessel/node-usb/releases/download/v1.7.2/usb-v1.7.2-napi-v4-linux-armv7l.tar.gz
    prebuild-install http 404 https://github.com/tessel/node-usb/releases/download/v1.7.2/usb-v1.7.2-napi-v4-linux-armv7l.tar.gz
    prebuild-install WARN install No prebuilt binaries found (target=4 runtime=napi arch=armv7l libc= platform=linux)

So even though I get an appimage at the end, when trying to launch it (after chmod +x) it only says "no such file or directory"

Libudev is installed. When trying to build the "node usb electron test app" which is using the latest node usb release it doesn't throw this error and builds successfully.

Is it maybe an issue with 1.7.2? I tried to pin the dependency on 1.7.1 but it's always going for 1.7.2.

Is it eventually possible to upgrade to the latest node usb release and see if that resolves the issue?

rhysmorgan134 commented 2 years ago

Are you running on buster or bullseye? also 32 bit or 64 bit?

Upgrading is possible, but v2 of the usb protocol uses a different api so would need quite a bit of work.

LRYMND commented 2 years ago

Running Bullseye and tried on 32bit and 64bit.

rhysmorgan134 commented 2 years ago

Ok, I don’t think you are actually seeing an error here, those logs look like prebuilt binaries logs. It should just build from source, which as you said you get an appimage I guess it is working fine.

The no directory error perhaps sounds like a permissions issue? Try and run the setup-pi script in the repo, this creates udev rules that allow you to remove the sudo command when running.

LRYMND commented 2 years ago

Apparently it's unable to set some permissions:

Creating udev rules
SUBSYSTEM=="usb", ATTR{idVendor}=="1314", ATTR{idProduct}=="1520", MODE="0660", GROUP="plugdev"
setup-pi.sh: 12: [[: not found
-e Unable to create permissions

The file for the new rules is created however and I ran the shell with sudo.

rhysmorgan134 commented 2 years ago

And how about if you now run your built appimage without sudo and sandbox option?

rhysmorgan134 commented 2 years ago

If it’s still no luck I will image a fresh pi in 32bit bullseye, all my testing so far was on buster

LRYMND commented 2 years ago

I tried rebuilding once more just to be sure but it's still printing "No such file or directory" when trying to execute. I will do the same and install buster on another SD Card to see if that's really the issue.

LRYMND commented 2 years ago

Build on Buster was successful and is running. Having some other issues now that I need to investigate but the AppImage launches. Thanks for the poke into the right direction!