Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Failed to deploy Qt application using windeployqt



  • Hi

    I can run my qt with qml application from QtCreator, but failed with the following errors when running the exe from a command prompt although i have used the windeployqt to deploy my qt application.

    QQmlApplicationEngine failed to load component
    qrc:/main.qml:23:1: Type ApplicationWindow unavailable
    file:///C:/Qt/5.15.2/msvc2019_64/qml/QtQuick/Controls.2/qmldir: plugin cannot be loaded for module "QtQuick.Controls": Cannot install type 'VerticalHeaderView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'HorizontalHeaderView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install element 'SplitHandle' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'SplitView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install element 'Overlay' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'MenuBarItem' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'MenuBar' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ActionGroup' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Action' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ScrollView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'DelayButton' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ToolSeparator' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'RoundButton' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'MenuSeparator' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'DialogButtonBox' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Dialog' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Tumbler' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ToolTip' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ToolButton' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ToolBar' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'TextField' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'TextArea' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'TabButton' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'TabBar' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'SwitchDelegate' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Switch' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'SwipeView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'SwipeDelegate' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'StackView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'SpinBox' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Slider' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ScrollIndicator' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ScrollBar' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'RangeSlider' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'RadioDelegate' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'RadioButton' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ProgressBar' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Popup' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Pane' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'PageIndicator' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Page' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'MenuItem' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Menu' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Label' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ItemDelegate' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'GroupBox' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Frame' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Drawer' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Dial' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Control' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Container' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ComboBox' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'CheckDelegate' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'CheckBox' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ButtonGroup' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Button' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'BusyIndicator' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ApplicationWindow' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'AbstractButton' into protected module 'QtQuick.Controls' version '2'
    

    This is how i run windeployqt from cmd prompt

    windeployqt --qmldir D:\mylib\qml --qmldir D:\myapp\qml --qmldir C:\Qt\5.15.2\msvc2019_64\qml --plugindir C:\Qt\5.15.2\msvc2019_64\plugins --plugindir C:\Qt\5.15.2\msvc2019_64\plugins\platforms D:\myapp\test-windeployqt
    

    What have i been missing??


  • Moderators

    @pfnus
    what i first noticed was that you just need to set the --qmldir parameter to directories containing YOUR qml files. No need to also specify the qml folder from Qt. Same for the --libdir. windeployqt knows it's Qt installation it belongs to.
    You may also add the --release --compiler-runtime parameters. And also just run windeployqt on a release built binary.



  • i change my project build to release mode;
    added the option --release and --compiler-runtime; remove the unnecessary --qmldir to the qt installation dir, but nothing much changed., except additional errors

    qrc:/main.qml:124:6: Type PermanentPanels unavailable
    qrc:/panels/MyPanels.qml:13:5: Type MyControls unavailable
    qrc:/panels/MyControls.qml:20:1: Type SidePanel unavailable
    

    MyPanels.qml, MyControls.qml etc, all the qml files are actually in the --qmldir

    Also i can run as reelase mode too using QtCreator. It is very strange why it failed for windeployqt only, googling the errors all seemed to point to the --qmldir, but i have included that in.., can the --qmldir contains subsirectories?? I have a lot of qml files inside different sub-directories, and i point --qmldir to thje top level qml dir, is that an issue? I have more than 20 subdirectories inside the main top level qmldir, it can't be that i need to include one by one all the sub-dir of my qml directories that contain the qml files!!???

    QQmlApplicationEngine failed to load component
    qrc:/main.qml:124:6: Type PermanentPanels unavailable
    qrc:/panels/MyPanels.qml:13:5: Type MyControls unavailable
    qrc:/panels/MyControls.qml:20:1: Type SidePanel unavailable
    
    file:///C:/Qt/5.15.2/msvc2019_64/qml/QtQuick/Controls.2/qmldir: plugin cannot be loaded for module "QtQuick.Controls": Cannot install type 'VerticalHeaderView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'HorizontalHeaderView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install element 'SplitHandle' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'SplitView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install element 'Overlay' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'MenuBarItem' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'MenuBar' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ActionGroup' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Action' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ScrollView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'DelayButton' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ToolSeparator' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'RoundButton' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'MenuSeparator' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'DialogButtonBox' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Dialog' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Tumbler' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ToolTip' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ToolButton' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ToolBar' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'TextField' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'TextArea' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'TabButton' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'TabBar' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'SwitchDelegate' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Switch' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'SwipeView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'SwipeDelegate' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'StackView' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'SpinBox' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Slider' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ScrollIndicator' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ScrollBar' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'RangeSlider' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'RadioDelegate' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'RadioButton' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ProgressBar' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Popup' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Pane' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'PageIndicator' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Page' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'MenuItem' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Menu' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Label' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ItemDelegate' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'GroupBox' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Frame' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Drawer' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Dial' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Control' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Container' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ComboBox' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'CheckDelegate' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'CheckBox' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ButtonGroup' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'Button' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'BusyIndicator' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'ApplicationWindow' into protected module 'QtQuick.Controls' version '2'
    <Unknown File>: Cannot install type 'AbstractButton' into protected module 'QtQuick.Controls' version '2'
    

  • Moderators

    @pfnus said in Failed to deploy Qt application using windeployqt:

    except additional errors
    qrc:/main.qml:124:6: Type PermanentPanels unavailable
    qrc:/panels/MyPanels.qml:13:5: Type MyControls unavailable
    qrc:/panels/MyControls.qml:20:1: Type SidePanel unavailable

    actually you should have this errors already before. I dont see why you shouldnt.

    I have a lot of qml files inside different sub-directories, and i point --qmldir to thje top level qml dir, is that an issue?

    Thats ok. windeployqt scans the folder recursively for all import statements.
    When you now have files in the filesystem without having them in a qml module (with a qmldir file) they wont be picked up. Easiest would be to put them alos into the qrc.

    The errors like Cannot install type 'HorizontalHeaderView' into protected module 'QtQuick.Controls' version '2' are a mystery to me. How do you get the error messages actually? You ran windeploy and then simply start the binary? Where do you see the error messages then?



  • Hi again,

    I have managed to run the qt application now, after following the guides using a brute force method, quick and dirty way, by copying all the qml and dlls files/dir from my qt installation directory to the deployment dir.

    https://wiki.qt.io/Deploy_an_Application_on_Windows

    But i still don't know why windeployqt doesn't work as it should., so this looks like a problem of the windeployqt tool which failed to copy the necessary files/dirs to the deployment directory. And i don't think it is fun to do the clean up after as mentioned in the guides after putting everything there, as that is what windeployqt should be meant for.

    @raven-worx said in Failed to deploy Qt application using windeployqt:

    @pfnus said in Failed to deploy Qt application using windeployqt:

    except additional errors
    qrc:/main.qml:124:6: Type PermanentPanels unavailable
    qrc:/panels/MyPanels.qml:13:5: Type MyControls unavailable
    qrc:/panels/MyControls.qml:20:1: Type SidePanel unavailable

    actually you should have this errors already before. I dont see why you shouldnt.

    I have a lot of qml files inside different sub-directories, and i point --qmldir to thje top level qml dir, is that an issue?

    Thats ok. windeployqt scans the folder recursively for all import statements.
    When you now have files in the filesystem without having them in a qml module (with a qmldir file) they wont be picked up. Easiest would be to put them alos into the qrc.

    The errors like Cannot install type 'HorizontalHeaderView' into protected module 'QtQuick.Controls' version '2' are a mystery to me. How do you get the error messages actually? You ran windeploy and then simply start the binary? Where do you see the error messages then?

    I run the exe from cmd line like this; where D:\myapp\test-windeployqt contains all the deployed qt files/dirs:

    D:\myapp\test-windeployqt\myapp.exe


Log in to reply