Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Deploy to remote and run in terminal (as root!)?

Deploy to remote and run in terminal (as root!)?

Scheduled Pinned Locked Moved Unsolved General and Desktop
cross compileraspberry pirootdeployterm
2 Posts 1 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • pauleddP Offline
    pauleddP Offline
    pauledd
    wrote on last edited by
    #1

    Hi

    I set up a crosscompile enviroment between my desktop-pc Qt-Creator and a RaspberryPi2 as described in this Guide.

    So I can already write,compile and deploy my code from my desktop-pc to the RaspberryPi, thats works flawlessly.

    The problem is I NEED to run the deployed executable:

    • with argument "--platform xcb"

    • as root

    because it accesses the bcm2835 library for SPI access, so there is no way around root.
    Is that possible at all?

    I normally would use "run in terminal" and then add a "-e sudo" if I would run it locally but with a deployed executable there is no such an option.

    Bildschirmfoto_2019-11-01_13-17-40.png

    I tried to invoke "Alternate executable on device" and used various commands like:

    /usr/bin/xterm -e sudo /home/pi/adas0002  --platform xcb
    

    but then I get

    Starting /usr/bin/xterm -e sudo /home/pi/adas0002 --platform xcb...
    bash: /usr/bin/xterm -e sudo /home/pi/adas0002 --platform xcb: File or directory not found
    13:22:40: Application finished with exit code 127.
    

    The executable is succesfuly transfered to the RaspberryPi and is in /home/pi and I can actually execute it with the same command directly on the Raspberry without problems...

    Bildschirmfoto_2019-11-01_13-26-05.png
    Any ideas how to solve that?

    1 Reply Last reply
    0
    • pauleddP Offline
      pauleddP Offline
      pauledd
      wrote on last edited by
      #2

      I somehow workaround it.
      On the RaspberryPi I created a bash script in /usr/bin:

      /usr/bin/x5

      #!/bin/bash
      xhost +local:
      sudo /home/pi/adas0002 --platform xcb
      

      I made it executable and then on my Desktop-Pc in Qt-Creator
      I have "/usr/bin/x5" in "Alternate executable on device".

      Now my application starts with root even without invoking any terminal.
      I know this is very bad in security point of view but I dont care on my little offline
      Raspi...

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved