[Solved] Ubuntu qt components installation error



  • I've tried to install ubuntu qt components on archlinux, i've created a build script and it builds fine, basically it builds like this:
    @
    qmake-qt5 -r ubuntu-sdk.pro
    make --quiet
    make INSTALL_ROOT=${pkgdir} install
    @

    the package builds fine and installs the component library under /usr/lib/qt5/imports/Ubuntu/Components/
    i've tried this sample application under qtcreator
    @
    import QtQuick 2.0
    import Ubuntu.Components 0.1

    Rectangle {
    id: root
    width: units.gu(60)
    height: units.gu(80)
    color: "lightgray"

    property real margins: units.gu(2)
    property real buttonWidth: units.gu(9)
    
    Label {
       id: title
       ItemStyle.class: "title"
       text: i18n.tr("Currency Converter")
       height: contentHeight + root.margins
       anchors {
           left: parent.left
           right: parent.right
           top: parent.top
       }
    }
    

    }
    @
    but when i run the application it says the following

    @Starting external tool '/usr/lib/qt5/bin/qmlscene' /home/riccardo/Programmi/Prova/qml/Prova/main.qml
    file:///home/riccardo/Programmi/Prova/qml/Prova/main.qml:2 module "Ubuntu.Components" is not installed@

    Why? What's the mistake? And why qtcreator doesn't underline the import statement?
    Any hints will be appreciated!



  • Try exporting QML_IMPORT_TRACE=1 in your environment, and see what output you get. It seems like the import path is incorrect (QML2_IMPORT_PATH should be /usr/lib/qt5/imports/ by default).

    Cheers,
    Chris.



  • it turns out that the default import paths are /usr/lib/qt5/qml and /usr/lib/qt5/bin, doing
    @export QML2_IMPORT_PATH=/usr/lib/qt5/imports@
    fixed the problem!

    Thank you!



  • I bet I will face this type of stuff soon as well. I just wanted to thank you for posting the answer you figured out on your own. You might want to mark it as [Solved] as well. Good sleuthing.



  • Marked, i've found that in the project files there's an install path variable initialized like this:
    @installPath = $$[QT_INSTALL_IMPORTS]/$$replace(uri, \., /)@
    and changing QT_INSTALL_IMPORTS to QT_INSTALL_QML provides a radical solution to the problem

    So what is correct to use to install qml components? QT_INSTALL_QML (in my system /usr/lib/qt5/qml) or QT_INSTALL_IMPORTS ?



  • Hi, referrazz

    I have the same problem with you!

    but set environment variable "QML2_IMPORT_PATH", this way can't work.

    export QML2_IMPORT_PATH=/usr/lib/qt5/imports

    QT_INSTALL_PREFIX:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64
    QT_INSTALL_ARCHDATA:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64
    QT_INSTALL_DATA:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/
    QT_INSTALL_DOCS:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/doc
    QT_INSTALL_HEADERS:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/include
    QT_INSTALL_LIBS:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/lib
    QT_INSTALL_LIBEXECS:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/libexec
    QT_INSTALL_BINS:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/bin
    QT_INSTALL_TESTS:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/tests
    QT_INSTALL_PLUGINS:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/plugins
    QT_INSTALL_IMPORTS:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/imports
    QT_INSTALL_QML:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/qml
    QT_INSTALL_TRANSLATIONS:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/translations
    QT_INSTALL_CONFIGURATION:/etc/xdg
    QT_INSTALL_EXAMPLES:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/examples
    QT_INSTALL_DEMOS:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/examples
    QT_HOST_PREFIX:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64
    QT_HOST_DATA:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64
    QT_HOST_BINS:/home/thuai/local/Qt5.0.0/5.0.0/gcc_64/bin
    QMAKE_SPEC:linux-g++-64
    QMAKE_XSPEC:linux-g++-64
    QMAKE_VERSION:3.0
    QT_VERSION:5.0.0

    Can you give me some help?

    Thks!



  • where are your components installed? you have qt5 in your home directory so QML2_IMPORT_PATH should be /home/thuai/local/Qt5.0.0/5.0.0/gcc_64/imports or /home/thuai/local/Qt5.0.0/5.0.0/gcc_64/qml



  • Hi rferrazz,

    Thks for your replying!

    I tried QML2_IMPORT_PATH=/home/thuai/local/Qt5.0.0/gcc_64/imports or /home/thuai/local/Qt5.0.0/gcc_64/qml.

    Both can not work!

    I install Qt5 and Ubuntu UI toolkit according this website http://developer.ubuntu.com/get-started/gomobile/#step-write-app
    Acording this article, Ubuntu UI toolkit can not be recognized by QtCreator

    So i reinstall Qt5 and Ubuntu Components according to http://askubuntu.com/questions/236012/cant-install-qt-components-ubuntu-because-im-using-full-release-of-qt-5-0-0

    After reinstall Qt5 and Ubuntu Components.

    "import Ubuntu.Components 0.1" is resolved.

    And label element is recognized but the ItemStyle attribute isn't.

    Do you meet the problem about ItemStyle?

    Thks!



  • the syntax checker don't recognize it but it works correctly



  • You are right.
    It's syntax check.

    Thank you!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.