2

Hi sorry for the answer I´m very inexperienced in Raspbian, just started to use the pi a few weeks ago, I need to start an app developed with Qt in C++, it has a GUI, this app has strict timing requirements so I need to get rid of all the overhead of the graphic interface of Raspbian. So the question is how can I start only this app on startup. Please excuse my english, it's not my mother tongue.

1

As @eftshift0 suggested in his answer I would also start with Raspbian Stretch Lite 2018-03-13. On this minimal platform you can get your application to run with installing just the minimal required packets. For example you can install the integrated development environment (IDE) for Qt with all its dependencies (150 additional packets):

rpi3 ~$ sudo apt install qtcreator
[...]
0 upgraded, 150 newly installed, 0 to remove and 0 not upgraded.
Need to get 231 MB of archives.
After this operation, 802 MB of additional disk space will be used.

If you get your application running start it with an optimized service for systemd. systemd is starting services parallel so with smart selected dependencies Before and After starting just needed services you should be able to start your application as fast as possible. Here I have made a simple test service in an other context but it may give you an idea how it works.

  • I think you made a mistake in the link of your "simple test service", it directs me to "raspberrypi.org/downloads/raspbian", could you please fix it, so I can see your example code, I really don´t known anything about "systemd". – Jorge German Perez Blanco Apr 19 '18 at 19:38
  • @JorgeGermanPerezBlanco sorry, you are right. The link was still in my clipboard from the first link in the answer. I have fixed it. – Ingo Apr 19 '18 at 19:54
0

instead of trying the GUI-based distros for raspberry pi I think you should try the ones that are based on terminal and then install the x server (or wayland... not sure of which one is supported on raspberry) plus the dependencies to start your application. You could write a script that does two things (this would have worked a few years ago with X server.... would have to give it a test these days to see if it still holds water):

startx &
wait a couple of seconds to make sure that X is working
export DISPLAY=:0.0
start_your_application

Talking about X server, you have to make sure than X is configured to accept tcp connections and that should be enough. If it's wayland, I'm not sure of how exactly it would work but it should be something similar.

Then you could set up this script to be started with systemd on boot, which is a whole different topic.

  • Hmm... I think "wait a couple of seconds to make sure that X is working" isn't the way because "this app has strict timing requirements". Instead starting an optimized service with systemd seems to be a solution. – Ingo Apr 17 '18 at 22:48
  • thanks for the answer but the app is still in development, I´m working on Qt as previously mentioned and if I install a non GUI based distro it would be difficult to develop the code as I would´t have the Qt creator, I'm trying to achieve cross compilation between Ubuntu and Raspbian but still not succeded – Jorge German Perez Blanco Apr 18 '18 at 14:16
  • You can add whatever packages you need (and they will install their dependencies) so it should be no problem to start from a terminal-based distro, even if you are only developing and you need your compilation/deployment stuff. – eftshift0 Apr 18 '18 at 14:19
  • Excuse me for my ignorance on the topic but I´m also new to linux in general, so you´re telling me that I can install a non GUI based distro and then install Qt creator and use it´s graphical interface to develop code? Thank you so much for the quick answer, it´s been very helpfull. – Jorge German Perez Blanco Apr 18 '18 at 14:39
  • qt-creator should be available as a package and it should require all the packages it needs for itself to work (I would assume that it will also require some stuff related to GUI stuff... not sure, though). Given what you said about having timing requirements, that led @Ingo and me to advice to use a terminal-based distro instead of a desktop-based one because that takes away a lot of packages and services that you probably don't need. Now, if you are still developing on it, then working on a desktop-based distro will be ok so that you don't end up on X with a fixed terminal on the screen – eftshift0 Apr 18 '18 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.