rsjudka / intelligent-auto

41 stars 15 forks source link

Can't build app-launcher "no member resize" #24

Closed rhysmorgan134 closed 4 years ago

rhysmorgan134 commented 4 years ago

Tried to build the app-launcher branch today, I got the following error around 80%

/home/pi/Downloads/test/appLauncher/intelligent-auto/include/app/tabs/openauto.hpp:32:50: error: ‘class f1x::openauto::autoapp::service::ServiceFactory’ has no member named ‘resize’
     inline void resize() { this->service_factory.resize(); }
                                                  ^~~~~~
make[2]: *** [CMakeFiles/ia.dir/build.make:157: CMakeFiles/ia.dir/src/app/tabs/data.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:108: CMakeFiles/ia.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
rsjudka commented 4 years ago

what branch of openauto are you using? You should be on develop

rhysmorgan134 commented 4 years ago

ok my bad, yeah I had the wrong branch. Updated that, and it built further. But it got stuck on building launcher.cpp, the fault was with the xGetWindowProperty function, saying it couldnt cast long long to long. I have changed the following line (89) which has allowed it to build

original:

uint64_t nitems_return, bytes_after_return;

modified:

unsigned long nitems_return, bytes_after_return;

This has allowed it to build successfully. However, I'm not sure whether its due to the change I have made, but when launching the app through both, auto start and manually starting, it just loads to a black screen. The only error logging I can see (unless its logging to a file somewhere) is:

qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 539, resource id: -1, major code: 12 (ConfigureWindow), minor code: 0 qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 541, resource id: -1, major code: 7 (ReparentWindow), minor code: 0 qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 542, resource id: -1, major code: 2 (ChangeWindowAttributes), minor code: 0 qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 543, resource id: -1, major code: 18 (ChangeProperty), minor code: 0

However on research this seems to be a symptom rather than a cause.

It does seem to be working well functionality wise those, which is awesome

rsjudka commented 4 years ago

saying it couldnt cast long long to long

I don't think this would affect it, but thanks for the catch! I think I might have changed the type right before committing without testing it :p

when launching the app through both, auto start and manually starting, it just loads to a black screen.

So when you say black screen, do you actually mean BLACK, or just that nothing loaded there? Like are you seeing your custom app launch, and then being manipulated to fit within the tab?

Some things you might want to try:

Just to get some more data points, what are you running this on? Raspberry Pi 3? Is your OS 32 or 64 bit? What version of X11 are you using?

rhysmorgan134 commented 4 years ago
  • So when you say black screen, do you actually mean BLACK, or just that nothing loaded there? Like are you seeing your custom app launch, and then being manipulated to fit within the tab?

see attached picture, it loads into a black area, theres a cross that appears at the top right.

Screenshot 2020-04-11 at 16 11 40

increase the sleep times for launcher.cpp#65-69 to maybe give your custom app more time to load

Tried this with varying values from the default 2 upto 60, no change, it does take longer to load though.

comment out launcher.cpp#26-27 and see what kind of output your custom application has

Done this, however I don't see any extra logging

try with a simple application (one I've been testing with is a KeePassXC appimage) just to make sure the functionality works correctly. Also, maybe try a non-appimage app for sanity sake, like VLC (most likely installed here: /usr/bin/vlc)

Tried both suggestions, and no change with any, so I'm assuming this is looking like a local issue.

Heres a link to the AppImage I am looking to use, if thats any use https://github.com/rhysmorgan134/JaguarXf_CAN/blob/v1.01/install/jag-hu.AppImage

rsjudka commented 4 years ago

Heres a link to the AppImage I am looking to use, if thats any use

i get this when trying to run it

A JavaScript error occurred in the main process
Uncaught Exception:
Error: Error while creating channel
    at Object.exports.createRawChannel (/tmp/.mount_jag-huwBbVUF/resources/app.asar/node_modules/socketcan/socketcan.js:34:67)
    at Object.<anonymous> (/tmp/.mount_jag-huwBbVUF/resources/app.asar/server.js:51:19)
    at Module._compile (internal/modules/cjs/loader.js:786:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:798:10)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (internal/modules/cjs/loader.js:685:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/tmp/.mount_jag-huwBbVUF/resources/app.asar/main.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:786:30)

seems like something with me not actually having the CAN interface? Is it possible to launch just the UI?

Well I'm testing on a 4B and definitely have it working. I think the only thing ive really changed was the DE im using (pixel to xfce). One difference I notice between the two is that pixel uses OpenBox, I wonder if that affects how qt manipulates windows...

Are you remoting into your pi? Could you try running directly on the pi, just to rule out any windowing issues.

rsjudka commented 4 years ago

ill also push up some more debugging prints to see if its failing to interface with x

rhysmorgan134 commented 4 years ago

seems like something with me not actually having the CAN interface? Is it possible to launch just the UI?

Ah yes sorry I forgot, I set all of mine up with a can channel straight of the bat, its pretty easy to set up a virtual can for just the single boot.

sudo modprobe vcan sudo ip link add dev can0 type vcan sudo ip link set up can0

Well I'm testing on a 4B and definitely have it working. I think the only thing ive really changed was the DE im using (pixel to xfce). One difference I notice between the two is that pixel uses OpenBox, I wonder if that affects how qt manipulates windows...

I'll do a bit of research and look into changing over.

Are you remoting into your pi? Could you try running directly on the pi, just to rule out any windowing issues.

I've tried both, I have the official touchscreen connected to the pi, and have tried running it on that.

rsjudka commented 4 years ago

Screenshot_2020-04-11_12-50-22 Well the good news is it seems to be working for me (using a sleep of 5s) :D

I'll try spinning up a "stock" version of raspbian and see exactly what needs to be done to reproduce success

rhysmorgan134 commented 4 years ago

thats great! I've started working on a branch to match the UI of your app, so they should compliment each other pretty well once finished.

Screenshot 2020-04-11 at 19 12 33

Got matching font, and a few other bits, couldnt see where you set the background colour for the main window in your stylesheets, so I think I'm a bit off on that

rsjudka commented 4 years ago

Looking nice! I based my UI off the material guidelines as well if you wanted any more inspiration for any of your elements

couldnt see where you set the background colour for the main window

I set it here, basically as the default widget background color. However, I do some fancy opacity things with the tabs where a lighter background is applied so for example if you are in the launcher tab you would have a background color of #171717

rsjudka commented 4 years ago

So I just ran it on a fresh install of raspbian on my pi4 and I was able to get it to work, so I don't think its an issue of DEs.

I guess my next thought would be either something OS related, which build of raspbian are you using?

rhysmorgan134 commented 4 years ago

Cracked it, my ownership on openauto.ini were set to root, most likely from running it for the first time as root. Changing this ownership to pi and running ia as pi sorted it!

Sorry for all the aggro, but it all seems to be working good now! Will update the pi in the car when I get a chance and get it all running with live data

robert5974 commented 4 years ago

I built this branch and used your AppImage as well and it worked just fine. Although it went full screen instead of within the IA UI, touching the "min" button on the bottom bad returned back to the IA UI with a black screen with the close button in the corner like pictured earlier in the thread. Nice work! I like the app-launcher so far.

The first time I tried building this branch, I kicked it off before bed last night and my Pi froze. Guess I over worked it yesterday lol.

I just wanted to say it worked correctly during building for me which was after this discussion. Really great work!!

rsjudka commented 4 years ago

@robert5974 I think for his appimage specifically you'll want to up the delay to 5 seconds because it takes some more time to launch. I'll probably fix this by having a "delay" option where you can set how long ia will wait before trying to embed the custom app (since there's really no way to signal it).

touching the "min" button on the bottom bad returned back to the IA UI with a black screen with the close button in the corner

Ah yeah that's something I didn't even consider! I think QProcess has a signal for when the running process terminates, so I can then have it close out in ia and return to the launcher.

robert5974 commented 4 years ago

No worries. Glad it pointed something out to you.

rhysmorgan134 commented 4 years ago

@rsjudka I will be removing most of the bottom row buttons now as I was in desperate need of some space for more, so specifically minimise and close can both be removed as I think it doesn't make much sense to have these as functions now. But it may be worth adding in the read me not to run ia as sudo, that's ultimately what messed me up, as the open auto.ini is then root ownership, and prevented me running the app without sudo as it would give an error for being unable to open the file

robert5974 commented 4 years ago

Lol, "min" is "minimize"...of course it is! That would be why when I pressed that button, the window would return to IA. I didn't think about it being minimized.

rsjudka commented 4 years ago

Cracked it, my ownership on openauto.ini were set to root, most likely from running it for the first time as root. Changing this ownership to pi and running ia as pi sorted it!

Thats interesting because openauto.ini actually isn't a file I control haha that's what openauto uses to store its configuration in but glad its working now!

I tried doing some tests with various permissions on all the different files in use and I just could not recreate the issue you were having. What was actually a bit concerning was when I set root as the owner of openauto.ini and ran ia as a non-root user ia would crash after a few seconds (but that issue can be pushed for a later time :p)

rhysmorgan134 commented 4 years ago

Cracked it, my ownership on openauto.ini were set to root, most likely from running it for the first time as root. Changing this ownership to pi and running ia as pi sorted it!

Thats interesting because openauto.ini actually isn't a file I control haha that's what openauto uses to store its configuration in but glad its working now!

I tried doing some tests with various permissions on all the different files in use and I just could not recreate the issue you were having. What was actually a bit concerning was when I set root as the owner of openauto.ini and ran ia as a non-root user ia would crash after a few seconds (but that issue can be pushed for a later time :p)

Yeah, so thats pretty much the issue I had, was that it was crashing, so then I always ran it as root, as I assumed thats what it needed, not realising that where I did the initial run as root, that then created the openauto.ini as root, first time of not running as root successfully, the app launcher worked well.

I've almost finished a bash script that takes care of the entire build process, I will chuck it on a fork of app launcher, but let me know if you want a pull request. Will test it on my car pi shortly.

rsjudka commented 4 years ago

Oh so ia was crashing for you every time? Not just that the external app wasnt loading?

A bash script would definitely be helpful lol anytime I need to rebuild from scratch I waste so much time trying to figure out what I've done to make it work

i think @yoriaantje-dev has also been putting something together, so maybe we can get it all together and actually have some decent documentation for this :smile:

rhysmorgan134 commented 4 years ago

Reopening this as it seems tidier to keep it all in one place, so I have run into a bit of a hiccup on this, I’m sure it’s probably something that I have missed.

1: if I run ia as sudo, android auto works, but the app launcher doesn’t. 2: if I run ia without sudo, app launcher works, however android auto never loads up when the phones connected.

I have done a fresh build yesterday, with everything pulled from scratch and matching the commit IDs for each sub module according to the key-bindings branch

rsjudka commented 4 years ago

so i just tested running ia with sudo, and I'm noticing some apps dont launch (any of my test appimages at least). When trying to run those outside of ia as sudo, they also fail to launch so that makes sense at least.

You definitely dont want to run it as sudo tho.

I feel like everyone has this issue :p do you have the udev permissions set?

rhysmorgan134 commented 4 years ago

Ha, you just beat me to it, literally just found an issue in open auto that contains the udev rules, created them and it's all good now :) will close again.

Thanks for the help!

Sent from my Samsung Galaxy smartphone.

-------- Original message -------- From: Robert Stanley Judka notifications@github.com Date: 29/05/2020 20:52 (GMT+00:00) To: rsjudka/intelligent-auto intelligent-auto@noreply.github.com Cc: rhysmorgan134 rhys1802@hotmail.co.uk, State change state_change@noreply.github.com Subject: Re: [rsjudka/intelligent-auto] Can't build app-launcher "no member resize" (#24)

so i just tested running ia with sudo, and I'm noticing some apps dont launch (any of my test appimages at least). When trying to run those outside of ia as sudo, they also fail to launch so that makes sense at least.

You definitely dont want to run it as sudo tho.

I feel like everyone has this issue :p do you have the udev permissions set?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/rsjudka/intelligent-auto/issues/24#issuecomment-636158241, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIZHOGUOVMWJCT4EL5E46VLRUAG6ZANCNFSM4MFYN5PA.