Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-125223

Plugin's install_rpath error during deployment by qt_generate_deploy_qml_app_script.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 6.8.4
    • 6.7.0
    • Build System: CMake
    • None
    • Ubuntu 24.04
    • Linux/X11
    • ecd63d469 (dev), a4b3409b3 (tqtc/lts-6.8), 19cd476da (6.9)

      When deploying the program through qt_generate_deploy_qml_app_script using the default CMAKE_INSTALL_LIBDIR (typically 'lib'), the install rpath of the QML module's plugin target will unexpectedly inherit its build rpath.

      When I inspect the INSTALL_RPATH property of the plugin target using CMake

      get_target_property(plugin_install_rpath myrectmoduleplugin INSTALL_RPATH)
      message("INSTALL_RPATH of myrectmoduleplugin is: ${plugin_install_rpath}")

      The result is as expected:

      INSTALL_RPATH of myrectmoduleplugin is: $ORIGIN/../../../lib 

      However, when using chrpath to check the rpath of libmyrectmoduleplugin.so, the observed rpath is unexpected:

      ❯ chrpath --list libmyrectmoduleplugin.so
      libmyrectmoduleplugin.so: RUNPATH=/home/warindy/Develop/QmlDemo/build/output:/home/warindy/Develop/dep/qt/6.7.0/gcc_64/lib

       

      One workaround is to specify '.' as the value for CMAKE_INSTALL_LIBDIR.

      set(CMAKE_INSTALL_LIBDIR "." CACHE STRING "The lib path to use for make install" FORCE) 

      Then we obtained the correct result.

      ❯ chrpath --list libmyrectmoduleplugin.so
      libmyrectmoduleplugin.so: RUNPATH=$ORIGIN/../../../ 

       

      Please download the attachment and replicate the problem.

      When using the default CMAKE_INSTALL_LIBDIR:

      # Uncomment the following section to make the program run correctly.
      # set(CMAKE_INSTALL_LIBDIR "." CACHE STRING "The lib path to use for make install" FORCE)
      # set(CMAKE_INSTALL_BINDIR "." CACHE STRING "The bin path to use for make install" FORCE) 

      Build the program, then use chrpath to inspect the results.

      cd QmlDemo
      mkdir build && cd build
      cmake ../ -GNinja
      ninja
      ninja install
      chrpath --list ./release/qml/myapp/myrect/libmyrectmoduleplugin.so

      The outcome should be

      libmyrectmoduleplugin.so: RUNPATH=$ORIGIN/../../../
      

      For comparison, set the value of CMAKE_INSTALL_LIBDIR to "."

      # Uncomment the following section to make the program run correctly.
      set(CMAKE_INSTALL_LIBDIR "." CACHE STRING "The lib path to use for make install" FORCE)
      set(CMAKE_INSTALL_BINDIR "." CACHE STRING "The bin path to use for make install" FORCE)  

      Rebuild the program and and check the rpath.

      cd QmlDemo
      mkdir buildB && cd buildB
      cmake ../ -GNinja
      ninja
      ninja install
      chrpath --list ./release/qml/myapp/myrect/libmyrectmoduleplugin.so 

      The result should be

      libmyrectmoduleplugin.so: RUNPATH=/home/warindy/Develop/QmlDemo/build/output:/home/warindy/Develop/dep/qt/6.7.0/gcc_64/lib

        For Gerrit Dashboard: QTBUG-125223
        # Subject Branch Project Status CR V

            jbornema Joerg Bornemann
            warindy yi wang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes