Qt build from source - 3dct/open_iA GitHub Wiki

On Windows, we exclusively use pre-built Qt binaries.

Linux

  • Install build dependencies. On Ubuntu/Debian, execute:
    • $ sudo apt-get build-dep qt5-default
    • $ sudo apt-get install libxcb-xinerama0-dev
  • Find the latest source release archive from https://download.qt.io/official_releases/qt/ (e.g. http://download.qt.io/official_releases/qt/5.9/5.9.3/single/qt-everywhere-opensource-src-5.9.3.tar.xz for release 5.9.3)
  • Download archive to e.g. /workspace/qt and open terminal there (we use the version 5.9.3 here, adapt that to the actual version you are using)
  • Extract: $ tar xf qt-everywhere-opensource-src-5.9.3.tar.xz
  • $ mv qt-everywhere-opensource-src-5.9.3 src-5.9.3
  • Remove archive: $ rm qt-everywhere-opensource-src-5.9.3.tar.xz
  • $ cd src-5.9.3
  • Create separate bin directory for out-of-source build: $ cd .. && mkdir bin-5.9.3 && cd bin-5.9.3
  • Configure (make sure to adapt the /dir-to-install-... to the path where you want to install the final build): $../src-5.9.3/configure -release -opensource -confirm-license -nomake examples -nomake tests -nomake tools -skip qtandroidextras -skip qtconnectivity -skip qtdeclarative -skip qtgamepad -skip qtlocation -skip qtmacextras -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwayland -skip qtvirtualkeyboard -qt-xcb -prefix /dir-to-install-qt-5.9.3
  • Build: you'll typically want to utilize multiple cores. To compile using e.g. 8 threads, use $ make -j 8
  • Install: $ make install
  • After you have verified that the build works (by building and running vtk, itk and open_iA using the install directory), and when you're not planning to re-build that same qt version again, you can conserve space by deleting the src-5.9.3 directory