Results 1 to 2 of 2

Thread: Using Cmake to compile QtQuick and QM: How to load qt plugins

  1. #1
    Join Date
    Apr 2017
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Using Cmake to compile QtQuick and QM: How to load qt plugins

    Hello,

    I am trying to compile the wireframe example using Cmake. I am able to to get a good build using the CMakeLists.txt below. However, when I run the executable I get the an error associate with the loading of plugins. It appears that the executable is looking for the plugins in an other application (gleamviz)?? Is there a way to point Qt in the right direction for the plugins in the CMakeLists.txt?

    Error message:

    [reuben@reuben-mba build]$ ./gui/eema_gui
    qrc:/main.qml:51:1: plugin cannot be loaded for module "QtQuick": Cannot load library /Applications/GLEAMviz-5/gleamviz.app/Contents/Frameworks/qml/QtQuick.2/libqtquick2plugin.dylib: (dlopen(/Applications/GLEAMviz-5/gleamviz.app/Contents/Frameworks/qml/QtQuick.2/libqtquick2plugin.dylib, 133): Library not loaded: @executable_path/../Frameworks/QtQuick.framework/Versions/5/QtQuick
    Referenced from: /Applications/GLEAMviz-5/gleamviz.app/Contents/Frameworks/qml/QtQuick.2/libqtquick2plugin.dylib
    Reason: image not found)
    [reuben@reuben-mba build]$

    CMakeLists.txt:

    # configure Qt
    set(CMAKE_INCLUDE_CURRENT_DIR ON)
    set(CMAKE_AUTOMOC ON)

    find_package(Qt5 COMPONENTS Core Quick QML 3DQuickExtras QuickControls2 REQUIRED)

    foreach(plugin ${Qt5Core_PLUGINS})
    get_target_property(_loc ${plugin} LOCATION)
    message("Plugin ${plugin} is at location ${_loc}")
    endforeach()

    # add the qml.qrc file
    qt5_add_resources(qml_QRC wireframe.qrc)

    file(GLOB_RECURSE CODE_FILES *.cpp)

    add_executable(eema_gui
    ${CODE_FILES}
    ${qml_QRC}
    )

    target_link_libraries(eema_gui Qt5::Core Qt5::Qml Qt5::Quick Qt5::3DQuickExtras Qt5::QuickControls2)

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,310
    Thanks
    244
    Thanked 678 Times in 668 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Using Cmake to compile QtQuick and QM: How to load qt plugins

    Running the executable you build with CMake has nothing to do with CMake or the CMakeLists.txt file. It's your runtime environment that's to blame. All of the plugins and/or dynamic (shared) libraries used by your program have to be "findable" when the program runs. This means they either have to be in a location the executable looks by default (eg. the executable's directory) or in a directory that can be found in the system PATH.

    The error message tells you what the runtime is looking for and that's where the problem lies, but I am not familiar enough with Mac OS to tell you exactly how to fix this.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Load custom plugins after application startup.
    By rwhartzell in forum Newbie
    Replies: 6
    Last Post: 29th August 2015, 19:36
  2. qtwebkit-plugins load but not work
    By brcontainer in forum Newbie
    Replies: 1
    Last Post: 8th March 2015, 09:54
  3. Qt5 Load muliple plugins
    By porterneon in forum Qt Quick
    Replies: 0
    Last Post: 20th February 2013, 13:34
  4. Load Plugins on Windows
    By ruben.rodrigues in forum Qt Programming
    Replies: 8
    Last Post: 13th May 2011, 08:39
  5. Why can Qt Creator use QPluginLoader to load plugins?
    By MorrisLiang in forum Qt Programming
    Replies: 4
    Last Post: 25th April 2010, 17:00

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.