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

qtdeclarative-examples: shared module not installed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 6.11.0 FF
    • 6.8, 6.9.1
    • Yocto: meta-qt6 layer
    • None
    • fbaed93d8 (dev)

      1. examples which depends on shared module

      build qtdeclarative examples from meta-qt6(6.8), shared module miss installed on target.

      https://code.qt.io/cgit/qt/qtdeclarative.git/tree/examples/quick/shared/CMakeLists.txt?h=6.8#n38

      removed install part from https://codereview.qt-project.org/c/qt/qtdeclarative/+/548920

      all examples depends on shared module will prompt the error:

      qrc:/qt/qml/views/views.qml:5:1: module "shared" is not installed
          import shared as Examples
          ^
      

      candidate fix is add the install part back.

      diff --git a/examples/quick/shared/CMakeLists.txt b/examples/quick/shared/CMakeLists.txt
      index 7382df76..0819234e 100644
      --- a/examples/quick/shared/CMakeLists.txt
      +++ b/examples/quick/shared/CMakeLists.txt
      @@ -36,3 +36,10 @@ qt_add_qml_module(${PROJECT_NAME}_shared
               "images/slider_handle.png"
               "images/tab.png"
       )
      +install(TARGETS ${PROJECT_NAME}_shared
      +    LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}/shared
      +)
      +install(FILES
      +    "${CMAKE_CURRENT_BINARY_DIR}/qmldir"
      +    DESTINATION ${CMAKE_INSTALL_BINDIR}/shared
      +)
      

      2. examples attachedstylepropertiesexample Miss finding libMyStyle.so

       

      qrc:/attachedstyleproperties.qml:7:1: Cannot load library /usr/share/examples/quickcontrols/attachedstyleproperties/bin/MyStyle/libMyStyleplugin.so: libMyStyle.so: cannot open shared object file: No such file or directory
      

      the libMyStyle.so install to <examples>/lib64 directory

      root@qemux86-64:/usr/share/examples/quickcontrols/attachedstyleproperties/bin/MyStyle# readelf -d libMyStyleplugin.so 
      
      Dynamic section at offset 0x3cf0 contains 32 entries:
        Tag        Type                         Name/Value
       0x0000000000000001 (NEEDED)             Shared library: [libMyStyle.so]
       0x0000000000000001 (NEEDED)             Shared library: [libQt6Qml.so.6]
       0x0000000000000001 (NEEDED)             Shared library: [libQt6Core.so.6]
       0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
       0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
       0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
       0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN:$ORIGIN/../lib64]
      

      the rpath of libMyStyleplugin.so will search ../lib64, the actually path is ../../lib64
      candidate fix patch is

      diff --git a/examples/quickcontrols/attachedstyleproperties/MyStyle/CMakeLists.txt b/examples/quickcontrols/attachedstyleproperties/MyStyle/CMakeLists.txt
      index 0ff17420..51206d2d 100644
      --- a/examples/quickcontrols/attachedstyleproperties/MyStyle/CMakeLists.txt
      +++ b/examples/quickcontrols/attachedstyleproperties/MyStyle/CMakeLists.txt
      @@ -35,7 +35,7 @@ target_link_libraries(MyStyle PRIVATE
       install(TARGETS MyStyle
           BUNDLE DESTINATION .
           RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
      -    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
      +    LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR}/MyStyle
       )
      
       install(TARGETS MyStyleplugin
      
      

      Maybe need check the deployment api to find the root cause.

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

            sapiippo Samuli Piippo
            pengzh Peng Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes