Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. Run Environment is missing DISPLAY env variable

Run Environment is missing DISPLAY env variable

Scheduled Pinned Locked Moved Solved QtonPi
3 Posts 2 Posters 2.9k Views 1 Watching
  • 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.
  • vikramgV Offline
    vikramgV Offline
    vikramg
    wrote on last edited by
    #1

    When deploying to a device (Odroid in this case, but the specific device is not significant), the Run Environment is lacking the DISPLAY env variable. This causes the deployment to fail with a QXcbConnection: Could not connect to display error. Adding the DISPLAY variable set to :0 allows the application to launch correctly.

    If I check env in a shell on the target device, the DISPLAY variable is of course set to :0, as expected. But hitting "Fetch Device Environment" in QtCreator pulls in only a small subset (crucially, missing DISPLAY) from the device environment.

    How can this be fixed, besides adding that variable manually every time I open a project?

    raven-worxR 1 Reply Last reply
    0
    • vikramgV vikramg

      When deploying to a device (Odroid in this case, but the specific device is not significant), the Run Environment is lacking the DISPLAY env variable. This causes the deployment to fail with a QXcbConnection: Could not connect to display error. Adding the DISPLAY variable set to :0 allows the application to launch correctly.

      If I check env in a shell on the target device, the DISPLAY variable is of course set to :0, as expected. But hitting "Fetch Device Environment" in QtCreator pulls in only a small subset (crucially, missing DISPLAY) from the device environment.

      How can this be fixed, besides adding that variable manually every time I open a project?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @vikramg
      you can try qputenv before creating a QApplication instance.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      vikramgV 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @vikramg
        you can try qputenv before creating a QApplication instance.

        vikramgV Offline
        vikramgV Offline
        vikramg
        wrote on last edited by
        #3

        Thanks @raven-worx
        I'm not convinced that any proactive action ought to be required, but I have verified that adding qputenv("DISPLAY", ":0"); before creating the QApplication instance does indeed work.

        1 Reply Last reply
        0

        • Login

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