AnsweredAssumed Answered

How to run qt app in service on I.MX8M 

Question asked by coin du on Apr 23, 2019
Latest reply on Apr 25, 2019 by Joan Xie

I hope the qt app run automatically  when the board power-on.

the environment :

sdk version  is 4.9.88 SDK and build with  DISTRO=fsl-imx-xwayland param

 

test_qt.service contents is as follows

```

[Unit]
Description=qt test
After=weston.service

[Service]
Type=oneshot
EnvironmentFile=-/etc/default/test_env
ExecStart=/home/root/test_timer -platform wayland-egl
TimeoutSec=20000

[Install]
WantedBy=multi-user.target

```

 

test_env 

···

#!/bin/sh
XDG_RUNTIME_DIR=/run/user/0
if test -z "$XDG_RUNTIME_DIR"; then
   XDG_RUNTIME_DIR=/run/user/0
   if ! test -d "${XDG_RUNTIME_DIR}"; then
   mkdir --parents "${XDG_RUNTIME_DIR}"
   chmod 0700 "${XDG_RUNTIME_DIR}"
   fi
fi

···

 

But the qt faild to run  

journalctl -u test_qt --no-page

···

-- Logs begin at Mon 2019-04-15 00:47:52 UTC, end at Mon 2019-04-15 00:47:58 UTC. --
Apr 15 00:47:54 imx8mqevk systemd[1]: Starting qt test...
Apr 15 00:47:55 imx8mqevk test_qt[3302]: Failed to create display (No such file or directory)
Apr 15 00:47:55 imx8mqevk systemd[1]: test_qt.service: Main process exited, code=exited, status=1/FAILURE
Apr 15 00:47:55 imx8mqevk systemd[1]: Failed to start qt test.
Apr 15 00:47:55 imx8mqevk systemd[1]: test_qt.service: Unit entered failed state.
Apr 15 00:47:55 imx8mqevk systemd[1]: test_qt.service: Failed with result 'exit-code'.

···

 

if i exec the systemctl start test_qt,it will run suceess.

 

how to resolve it,or give a qt sample to run with service

Look forward to your reply ,thanks.

Outcomes