Qt is a huge project, especially like the module, QtWebKit. If you happen to be in a computer farm, it is very useful to use distributed complation to speed up the build of Qt.
Here I suggest to use icecream on Linux and Mac OS X, and IncrediBuild on Windows(at least for Microsoft’s Visual Studio compilers). About IncrediBuild, more details perhaps will be updated in the future. See also qtrepotools: publish ibmake.bat, incredibuild xge wrapper for make/buildconsole.
Today, this blog is more about icecc/icecream.
Preparation
Linux
icecream is maintained by the SUSE people. Then there are less issues in OpenSUSE than in Ubuntu. But Ubuntu is more popular one. I just use Ubuntu as example here.
- Install your compiler, like gcc and clang.
- Install icecc and icemon(optional). icemon is the monitor of icecream build, better to check it when you setup the enviroments. It’s an GUI application based on Qt 4.8. Note: you need to install 0.9.8~git2012121601-0ubuntu2 and later version for icecc. More details in “icecc” package in Ubuntu.
1 2 |
sudo apt-get install icecc sudo apt-get install icemon (optional) |
- For clang users, if you want to make icecream compiler package, better to do:
- 13.04:
$ sudo ln -s /usr/include/clang/3.2/include /usr/lib/clang/3.2/
- 12.04:
$ sudo ln -s /usr/include/clang /usr/lib/
- 13.04:
- Create compiler package: please do it. Here is the example for 13.04:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$ gcc --version gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 $ /usr/lib/icecc/icecc-create-env --gcc /usr/bin/gcc /usr/bin/g++ ... creating 0b6089afb59bbcef327c8ec59b021132.tar.gz $ mv 0b6089afb59bbcef327c8ec59b021132.tar.gz ~/icecc-package-gcc-4.7.3.tar.gz $ clang --version Ubuntu clang version 3.2-1~exp9ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2) $ /usr/lib/icecc/icecc-create-env --clang /usr/bin/clang /usr/lib/icecc/compilerwrapper … creating bbfeb5eb17d851d04a17bed5f9f1f621.tar.gz $ mv bbfeb5eb17d851d04a17bed5f9f1f621.tar.gz ~/icecc-package-clang-3.2-1.tar.gz |
- Enviroment settings before build:
1 2 3 4 5 6 7 8 9 |
$ cat .icecc_rc-gcc export PATH=/usr/lib/icecc/bin:$PATH export ICECC_VERSION=/home/liangqi/icecc-package-gcc-4.7.3.tar.gz alias make="make -j48" $ cat .icecc_rc-clang export PATH=/usr/lib/icecc/bin:$PATH export ICECC_VERSION=/home/liangqi/icecc-package-clang-3.2-1.tar.gz alias make="make -j48" |
- Run icecc-scheduler in one of your Ubuntus:
- Edit
/etc/default/icecc
, setSTART_ICECC_SCHEDULER="true"
.
- Edit
- Start icecc service:
sudo /etc/init.d/icecc start
, icecc-scheduler service also could be started with this. Not suggest to run multiple icecc-scheduler in same network with default values, you could edit/etc/icecc/icecc.conf
with more options. - Stop icecc service(optional):
sudo /etc/init.d/icecc stop
Mac OS X
- Create a ‘qt’ user. Open System Preferences -> Users & Groups -> “+” under the list of users (you might need to click the lock icon first and type in your password), add a user “qt” with your standard password.
- Install HomeBrew
1 |
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" |
- Install XCode and command line tools.
- Install icecc and icemon(optional).
- Copy icecream.rb and icemon.rb to
/usr/local/Library/Formula/
. brew install icecream icemon
- Copy icecream.rb and icemon.rb to
- Create compiler package: please do it. Here is the example for 10.8:
1 2 3 4 5 6 7 8 |
$ clang --version Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn) Target: x86_64-apple-darwin12.4.0 Thread model: posix $ /usr/local/opt/icecream/libexec/icecc/icecc-create-env --clang /usr/bin/clang /usr/local/opt/icecream/libexec/icecc/compilerwrapper … creating bbfeb5eb17d851d04a17bed5f9f1f621.tar.gz $ mv bbfeb5eb17d851d04a17bed5f9f1f621.tar.gz ~/icecc-package-clang-3.2-svn.tar.gz |
- Enviroment settings before build: (Note: looks like it doesn’t work well with a compiler package. 2013-06-19)
1 2 3 4 |
$ cat .icecc_rc export PATH=/usr/local/opt/icecream/libexec/icecc/bin:$PATH #export ICECC_VERSION=/Users/liangqi/icecc-package-clang-3.2-svn.tar.gz alias make="make -j48 CC=clang CXX=clang++" |
- Copy com.github.iceccd.plist into into
/Library/LaunchDaemons
. sudo chown root /Library/LaunchDaemons/com.github.iceccd.plist
- Start icecc service:
sudo launchctl load /Library/LaunchDaemons/com.github.iceccd.plist
- Stop icecc service(optional):
sudo launchctl unload /Library/LaunchDaemons/com.github.iceccd.plist
Building Qt
Normally just do source ~/.icecc_rc
, configure
and make
.
- For clang build(both Linux and Mac OS X), please keep in mind to use
-no-pch
whenconfigure
. - For Qt4 build, the
-arch
argument that Qt 4 passes to the compiler confuses icecream. So for now, if you use Qt4, you need to patch your mkspec to not add that (if you build for your local architecture only), eg. inmkspecs/common/gcc-base-macx.conf
.(Note: looks like it’s only on Mac OS X, I haven’t tried it yet.)
Known Issues
- Using icecream currently screws up debug information for all object files that we compiled remotely!(Mac OS X only)