rhysmorgan134 / react-carplay

MIT License
382 stars 58 forks source link

App exiting with SIGABRT #13

Closed LRYMND closed 2 years ago

LRYMND commented 2 years ago

Hello, I'm trying to customize the app a bit to my needs but as of yesterday no matter what I do, the app crashes right after it tries to launch the CarPlay module, after the console log "directory found". The only code it throws is a SIGABRT.

Even tried downgrading from 18.4.0 to Node Version 16.15.1, NPM is 8.11.0.

Im new to node.js and I'm not sure what could cause this. I tried to do a fresh npm install on the main branch as well as the latest release with the same result when trying to run the app. What's weird is that it was working before and I didn't really change anything in my setup.

Hope somebody might know what to do..

rhysmorgan134 commented 2 years ago

Could you copy and paste the full terminal output, and also the command you are running to start it.

The app downloads the apk, then extracts the contents to get some OS files. It then transfers those files to the dongle. When it is saying directory found, it’s just confirming the presence of these files. It may be worth deleting the apk file and the directory then re running and making sure you give it the time required to download the files.

thanks

Rhys

LRYMND commented 2 years ago

Sure thing,

I'm running "npm start" ("start": "export BROWSER=none && react-scripts start"). Afterwards "npm run start-electron" ("start-electron": "export ELECTRON_START_URL=http://localhost:3000 && electron . --no-sandbox").

Development Server ist starting without issues. After the second command, the electron window appears and closes again.

Console log:

npm run start-electron

> carplay@0.1.0 start-electron
> export ELECTRON_START_URL=http://localhost:3000 && electron . --no-sandbox

Listening for incomming MPEG-TS Stream on http://127.0.0.1:8081/<secret>
Awaiting WebSocket connections on ws://127.0.0.1:8082/
siri
spawning carplay {
  dpi: 240,
  nightMode: 0,
  hand: 0,
  boxName: 'nodePlay',
  width: 800,
  height: 480,
  fps: 30
}
directory found
/home/volvo/share/react-carplay-main/node_modules/electron/dist/electron exited with signal SIGABRT

The same happens when I'm trying to run the current release. It also happens when I first delete the Resources and APK file. It the downloads the stuff and crashes after unzipping it.

rhysmorgan134 commented 2 years ago

you are running on a super old version there, JS-Mpeg was removed quite a while ago from the repo, it now uses jmuxer. I would recommend a fresh pull and npm install

LRYMND commented 2 years ago

Yeah that was actually more to try out. The same happens with the current release 1.0.4 as well (downloaded the 1.0.4 zip but version inside actually still says 1.0.3)

Here's the log, same result:

volvo@raspberrypi:~/share/react-carplay-og $ npm run start-electron

> carplay@1.0.3 start-electron
> export ELECTRON_START_URL=http://localhost:3000 && electron . --no-sandbox

spawning carplay {
  dpi: 480,
  nightMode: 0,
  hand: 0,
  boxName: 'nodePlay',
  width: 1200,
  height: 600,
  fps: 60
}
Assets not present, downloading
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 8650k  100 8650k    0     0   324k      0  0:00:26  0:00:26 --:--:--  370k
file downloaded, unzipping
/home/volvo/share/react-carplay-og/node_modules/electron/dist/electron exited with signal SIGABRT
volvo@raspberrypi:~/share/react-carplay-og $ 

Is there a way to get more information on why it threw a SIGABRT?

LRYMND commented 2 years ago

I tried again on a fresh Raspian installation. Same error.

admin@raspberrypi:~/Share/react-carplay-1.0.4 $ npm run start-electron

> carplay@1.0.3 start-electron
> export ELECTRON_START_URL=http://localhost:3000 && electron . --no-sandbox

spawning carplay {
  dpi: 480,
  nightMode: 0,
  hand: 0,
  boxName: 'nodePlay',
  width: 1200,
  height: 600,
  fps: 60
}
directory found
device not connected
/home/admin/Share/react-carplay-1.0.4/node_modules/electron/dist/electron exited with signal SIGABRT

Now it outputs "Device not connected" though. Everything is plugged in and it downloaded and unzipped the assets. The Carlinkit Adapter is definitely working since I also tried to run the AppImage again.

//EDIT: It seems like there is an issue with the USB after all. When unplugging the Carlinkit, the app launches. Still works with the AppImage though..

rhysmorgan134 commented 2 years ago

It doesn't try and interface to usb at all until the assets have been downloaded and are present.

maybe it is trying to download usb version > 2.0

run npm install, then navigate to node_modules/node-carplay, edit the package.json, change the line "usb": "~1.7.1" to "usb": "@1.7.1" then re run npm install

LRYMND commented 2 years ago

Didn't work. I understood now, that the assets are being downloaded from the web. So the app definitely crashes when starting to interface with the carplay dongle since, like I mentioned above, it launches without crash after removing the dongle.

LRYMND commented 2 years ago

Tried to build the app today and I`m getting the following error:

⨯ cannot execute  cause=exit status 1
                    errorOut=npm ERR! code 1
    npm ERR! path /home/admin/Share/react-carplay/node_modules/usb
    npm ERR! command failed
    npm ERR! command sh -c prebuild-install --runtime napi --target 4 --verbose || node-gyp rebuild
    npm ERR! prebuild-install info begin Prebuild-install version 5.3.6
    npm ERR! prebuild-install info install installing standalone, skipping download.
    npm ERR! gyp info it worked if it ends with ok
    npm ERR! gyp info using node-gyp@9.0.0
    npm ERR! gyp info using node@16.15.1 | linux | arm
    npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
    npm ERR! gyp http GET https://electronjs.org/headers/v13.1.8/node-v13.1.8-headers.tar.gz
    npm ERR! gyp http 200 https://artifacts.electronjs.org/headers/dist/v13.1.8/node-v13.1.8-headers.tar.gz
    npm ERR! gyp http GET https://electronjs.org/headers/v13.1.8/SHASUMS256.txt
    npm ERR! gyp http 200 https://artifacts.electronjs.org/headers/dist/v13.1.8/SHASUMS256.txt
    npm ERR! gyp info spawn /usr/bin/python3
    npm ERR! gyp info spawn args [
    npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
    npm ERR! gyp info spawn args   'binding.gyp',
    npm ERR! gyp info spawn args   '-f',
    npm ERR! gyp info spawn args   'make',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/home/admin/Share/react-carplay/node_modules/usb/build/config.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
    npm ERR! gyp info spawn args   '-I',
    npm ERR! gyp info spawn args   '/home/admin/.electron-gyp/13.1.8/include/node/common.gypi',
    npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
    npm ERR! gyp info spawn args   '-Dvisibility=default',
    npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/admin/.electron-gyp/13.1.8',
    npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
    npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/admin/.electron-gyp/13.1.8/<(target_arch)/node.lib',
    npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/admin/Share/react-carplay/node_modules/usb',
    npm ERR! gyp info spawn args   '-Dnode_engine=v8',
    npm ERR! gyp info spawn args   '--depth=.',
    npm ERR! gyp info spawn args   '--no-parallel',
    npm ERR! gyp info spawn args   '--generator-output',
    npm ERR! gyp info spawn args   'build',
    npm ERR! gyp info spawn args   '-Goutput_dir=.'
    npm ERR! gyp info spawn args ]
    npm ERR! gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
    npm ERR! gyp ERR! configure error 
    npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
    npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
    npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
    npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
    npm ERR! gyp ERR! System Linux 5.15.32-v7+
    npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    npm ERR! gyp ERR! cwd /home/admin/Share/react-carplay/node_modules/usb
    npm ERR! gyp ERR! node -v v16.15.1
    npm ERR! gyp ERR! node-gyp -v v9.0.0
    npm ERR! gyp ERR! not ok

    npm ERR! A complete log of this run can be found in:
    npm ERR!     /home/admin/.npm/_logs/2022-06-22T21_30_42_976Z-debug-0.log

                    command=/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js rebuild usb@1.7.2
                    workingDir=

Does that eventually help to narrow down the issue?

LRYMND commented 2 years ago

I got it figured out. libusb is requiring root access to interface with the USB. After updating my libudev config and assigning read/write access to the USB device it was working again.

Thats probably the reason why the AppImage worked since I was starting it with sudo.

rhysmorgan134 commented 2 years ago

Good job, thanks for the update. I forgot libusb is a requirement of node-usb!

rhysmorgan134 commented 2 years ago

As an aside, you can bypass the sudo requirement by adding some udev rules. See the pi script for an example

LRYMND commented 2 years ago

Do you think you could tell me how you’re catching the event when touching the manufacturer icon? I tried digging through the code but it is not really clear to me.

I‘d really appreciate it!

Cheers

rhysmorgan134 commented 2 years ago

It’s handled here

https://github.com/rhysmorgan134/react-carplay/blob/7dacb6cae6bf655fe2262d79965850053f7d5502/electron/main.js#L94

acts as a quit CarPlay function