Vinod
Vinod

Reputation: 1086

Building QT libraries on Ubuntu Linux

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.

Upvotes: 13

Views: 13329

Answers (2)

Marcos Mayorga
Marcos Mayorga

Reputation: 1

memory requirements to compile Qt 4.7 are 1.2 Gb (mostly demanded by QWebKit link stage), if you don't have enough create an extra swap file (see https://www.centos.org/docs/5/html/5.2/Deployment_Guide/s2-swap-creating-file.html)

Upvotes: 0

the_mandrill
the_mandrill

Reputation: 30862

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

Upvotes: 21

Related Questions