Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building QT libraries on Ubuntu Linux

Tags:

build

ubuntu

qt

I am trying to build QT libraries 4.8.2 on Ubuntu Linux by following the instruction mentioned in the documentation .

This is the second time I am trying building... I tried earlier also and when build process did not complete even after 12-13 hrs I thought something is wrong so I started from beginning.

It's been almost 24 hrs I issued make command (In the second attempt) the build process is still going on. Terminal is not showing any error either.

Does building QT libraries on Ubuntu Linux really takes this much time or I have missed something.

like image 412
Vinod Avatar asked Jul 26 '12 04:07

Vinod


People also ask

Where are Qt libraries Ubuntu?

The library files are usually in /usr/include/qt4 . The qmake is in /usr/bin/qmake-qt4 (or /usr/bin/qt4-qmake , I forget). You may have to symbolic link /usr/bin/qmake to either of these. Perhaps your application expected the files to be in /usr/local/include... and /usr/local/bin...

Does Qt work on Ubuntu?

"As well as using Qt to underpin Ubuntu's display framework, Qt is an integral part of Ubuntu's offering for developers who create mobile and desktop applications for Ubuntu devices.


1 Answers

Building Qt takes a couple of hours even on a fast system if you only do the default non-parallel build. By default it also pulls in lots of libraries that you may not need.

So the first thing to try is make -j to do parallel builds. If that is still taking too long then try to slim down the libraries Qt generates. Do you need QtWebKit for instance? If you plan on using an embedded web browser in your application then you'll want it. If not then you can halve the time of your build. Type configure --help to see the options. Some useful ones that can reduce the build time are:

NOTE: some of the following options are no longer applicable in Qt5

  • -fast - Use this if you are just using Qt rather than developing Qt itself
  • -no-webkit - If you don't need the embedded web browser this makes a huge difference
  • -release - If you don't need the debug libraries then this can be quicker
  • -no-qt3-support - you won't need this for a new project
  • -nomake examples - don't build the examples
  • -nomake demos - don't build the demos
  • -no-declarative - If you're not using the QtQuick APIs then omit this
  • -nomake docs - don't build the documentation (this can save a lot of time)

If you're having to pay for the time in this Amazon instance then another option is to create a local Ubuntu machine (on a spare machine or in a virtual machine) and tweak the options there until you get something that works, then use that build configuration on your Amazon instance.

EDIT:

In Qt5, the project changed to use git submodules, so if you are building from a git checkout then the default behaviour is to clone all the submodules, which will add substantially to your build times if there are modules you don't need. There is a script init-repository that is part of the qt5 repository. You can use that to trim your local repository to only contain the submodules you need. So for instance:

git clone https://git.gitorious.org/qt/qt5.git
cd qt5
./init-repository --module-subset="qtbase qtdeclarative qtquick1"
configure --your-options-here
make -j

On my machine I can do a basic build of qtbase in about 10 minutes

like image 174
the_mandrill Avatar answered Sep 24 '22 00:09

the_mandrill