Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Run on remote device doesn't apply LD_LIBRARY_PATH

Run on remote device doesn't apply LD_LIBRARY_PATH

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
5 Posts 2 Posters 363 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.
  • L Offline
    L Offline
    liteyear
    wrote on last edited by liteyear
    #1

    I have a QtQuick application that runs on a Linux target provided I specify the Qt library path, like so: LD_LIBRARY_PATH="/opt/Qt/lib" /path/to/app

    I cannot get it to run from Qt Creator. The application is copied to the target successfully, but the environment variable doesn't seem to take effect. This is really odd, because if I set the "Alternate executable on device" to env, I see the Run Environment variables are set!

    Why would env see the LD_LIBRARY_PATH I specify, but the application seemingly does not. My evidence is that it fails to launch with "error while loading shared libraries: libQt6Qml.so.6: cannot open shared object file: No such file or directory", which is the same error I get if I try to run it directly without specifying LD_LIBRARY_PATH.

    Here are my (not very interesting) Run Settings:

    Screenshot 2025-12-04 at 1.23.35 pm.png.

    1 Reply Last reply
    0
    • Axel SpoerlA Online
      Axel SpoerlA Online
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      The environment is set locally, not on the remote machine. env is also run locally. That’s why the local env sees LD_LIBRARY_PATH and the remote application doesn’t.

      24878e70-b45e-46ff-9885-d12e2feb5914-image.png

      Software Engineer
      The Qt Company, Oslo

      L 1 Reply Last reply
      3
      • Axel SpoerlA Axel Spoerl

        The environment is set locally, not on the remote machine. env is also run locally. That’s why the local env sees LD_LIBRARY_PATH and the remote application doesn’t.

        24878e70-b45e-46ff-9885-d12e2feb5914-image.png

        L Offline
        L Offline
        liteyear
        wrote on last edited by
        #3

        @Axel-Spoerl oh no way, that makes a lot of sense. It was actually my first theory, but more tests (eg. other "alternate executables") led me to believe otherwise.

        So is there a way? Or are none of the environment settings relevant to run-on-remote-device configurations?

        1 Reply Last reply
        0
        • Axel SpoerlA Online
          Axel SpoerlA Online
          Axel Spoerl
          Moderators
          wrote on last edited by
          #4

          @liteyear I have no remote configuration here at the moment. But IIRC, you can select it in the combo box just above the env variables.
          I would, however, try not to depend on LD_LIBRARY_PATH. I kitten dies, when you use it.
          I'd rather compile the application with a run path in CMake, pointing to the right libraries.
          I use LD_LIBRARY_PATH just for local experiments, when I want to load e.g. a development version of a public library.

          Software Engineer
          The Qt Company, Oslo

          1 Reply Last reply
          1
          • L Offline
            L Offline
            liteyear
            wrote on last edited by liteyear
            #5

            Alas the only other thing in that combo box is "Clean Environment" and it doesn't make any difference. Not even to the list of variables printed by env.

            Yes, I'm deep in kitten killing territory. I'm targeting a remote device because I'm cross-compiling - it's literally my development device. So being able to fiddle with environment variables and kill a few kittens is a normal part of the process. Same as you might use QT_QPA_PLATFORM=eglfs build/myApp or other flags temporarily when developing locally.

            In other words, if I can't set environment variables on the target (like I can for local run environments), then the "run on remote device" feature is not useful. Better (and way quicker, incidentally) to scp the built binary to the target and run it there manually. But that would be a pity - surely the "Environment" configuration is supposed to allow this?

            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