Can't install qt-components-ubuntu because I'm using full release of QT 5.0.0

It appears that since I didn't install the beta1 version of QT5 from the ppa, I'm unable to use the Ubuntu components package. I have the released version QT5 already and not interested in installing a beta version now. Is there a workaround?

The following packages have unmet dependencies:
qt-components-ubuntu : Depends: qtbase but it is not installable
                       Depends: qtdeclarative but it is not installable

The instructions to install the preview toolkit are here. I skipped the step to install QT5 because I already have a newer version straight from qt-project.org.


These instructions were tested on Ubuntu 12.04, Ubuntu 12.10 both 32-bit and 64-bit.

First off we need to install some dependencies. Install these even if you already have Qt5 installed:

sudo apt-get install build-essential libgtk2.0-dev libgl1-mesa-dev

If you haven't already, download and install the QtSDK from http://qt-project.org/downloads.

For Ubuntu 64-bit run:

cd ~
wget http://releases.qt-project.org/qt5/5.0.0/qt-linux-opensource-5.0.0-x86_64-offline.run
mv qt-linux-opensource-5.0.0-x86_64-offline.run qt5-installer.run

For Ubuntu 32-bit run:

cd ~
wget http://releases.qt-project.org/qt5/5.0.0/qt-linux-opensource-5.0.0-x86-offline.run
mv qt-linux-opensource-5.0.0-x86-offline.run qt5-installer.run

Then make it executable:

chmod +x qt5-installer.run

Now run it as root in order to install it to /opt:

sudo ./qt5-installer.run

Follow the prompts and, when asked where to install, select /opt/QtSDK. From now on I will assume that you have it installed to that location, if you already had the Qt installed to a different location, adapt the steps in order to reflect your installation.

After installation I suggest you delete the QtCreator configuration folder as the permissions are wrong. QtCreator will recreate them when restarted.

cd ~/.config
sudo rm -rf QtProject

Now for the Qt Ubuntu Components, download the source file and unpack it:

wget https://launchpad.net/~ui-toolkit/+archive/ppa/+files/qt-components-ubuntu_0.1.24%7Equantal1.tar.gz
tar -zxvf qt-components-ubuntu_0.1.24~quantal1.tar.gz

Now in order to compile and install the components we need to create some sim-links.

For Ubuntu 64-bit run:

sudo ln -s /opt/QtSDK/5.0.0/gcc_x64 /opt/qt5

For Ubuntu 32-bit run:

sudo ln -s /opt/QtSDK/5.0.0/gcc /opt/qt5

One more thing before we compile and install, we need to change two environment variables, PATH and QML_IMPORT_PATH:

export PATH=$PATH:/opt/qt5/bin
export QML_IMPORT_PATH=/opt/qt5/imports
echo 'export PATH=$PATH:/opt/qt5/bin' >> ~/.bashrc
echo 'export QML_IMPORT_PATH=/opt/qt5/imports' >> ~/.bashrc

Now we need generate a Makefile an build the Qt Ubuntu Components:

cd ~/trunk
qmake ubuntu-sdk.pro
make
sudo make install

If everything went OK, the the components should be built and installed, now we need to try it out to make sure everything went alright. I suggest you log out and the back in before doing the next steps.

  • Open QtCreator, go to Tools -> Options, select the External Tools tab.
  • For Qt Quick 1 Preview (qmlviewer), in the Executable field write: /opt/qt5/bin/qmlviewer
  • For Qt Quick 2 Preview (qmlscene), in the Executable field write: /opt/qt5/bin/qmlscene.
  • Click Apply and close the Options window.

Everything should be working now, one thing to keep in mind is that in order to successfully execute a QML Ubuntu Phone Application, in the .qmlproject file you need to uncomment importPaths and add "/opt/qt5/imports" to it like so:

Project {
    ...
    /* List of plugin directories passed to QML runtime */
        importPaths: [ "/opt/qt5/imports" ]
    ...
}

That's about it. For any questions comment and I'll try to get back to you. Have Fun!


Thanks for your inputs kicsyromy. I just happened to follow below steps to resolve "import QtQuick 2.0" and other issues on executing and testing Ubuntu components on my installation.

  • Untar Ubuntu components (qt-components-ubuntu_0.1.24~quantal1.tar.gz) under any permission directory and you will get the trunk directory like this /home/<user>/UbuntuQt/trunk/

  • Try to override permission for trunk directory as (sometimes I happen to see error as permission denied):

    sudo chown <user-name> -R trunk/
    
  • Set your QML_IMPORT_PATH to your /home/<user>/UbuntuQt/trunk/modules

  • Try to execute components demo with ubuntu-sdk.pro with this command:

    /opt/qt5/bin/qmake -o Makefile ubuntu-sdk.pro
    qmlscene --fullscreen -I modules demos/PhoneComponentShowcase.qml
    

    or

    qmlscene -I modules demos/ComponentShowcase.qml
    
  • To test unit converter, do create qmlproject.user in /trunk/examples/

    /opt/qt5/bin/qmake -o Makefile examples.pro
    qmlscene -I ../../modules unit-converter/converter.qml