Install Ubuntu 23.10, for me, it’s an VM via VMware Fusion 13.5.0 on MacBook Pro 2019.
Install some needed packages,
1 2 3 4 5 6 7 8 |
sudo apt install -y zsh build-essential perl python3 git sudo snap install cmake --classic sudo apt install ninja-build sudo apt-get build-dep qtbase-opensource-src sudo apt-get install libxcb-xinerama0-dev sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev sudo apt-get install libdbus-1-dev libglib2.0-dev |
Default gcc/g++ is 13.2.0.
Add following in env:
1 2 3 |
export MAKEFLAGS='--jobs=8' export CMAKE_GENERATOR=Ninja |
Let’s try to install multipler versions of gcc/g++:
1 2 |
sudo vi /etc/apt/sources.list |
Add following lines in the end, then save and quit:
1 2 3 |
deb [arch=amd64] http://archive.ubuntu.com/ubuntu focal main universe deb [arch=amd64] http://archive.ubuntu.com/ubuntu bionic main universe |
1 2 3 4 5 6 7 8 9 |
sudo apt update sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 130 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-13 sudo apt install gcc-9 g++-9 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9 sudo apt install gcc-5 g++-5 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50 --slave /usr/bin/g++ g++ /usr/bin/g++-5 --slave /usr/bin/gcov gcov /usr/bin/gcov-5 sudo apt install gcc-4.8 g++-4.8 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.8 |
You can manually select a version of gcc/g++:
1 2 |
sudo update-alternatives --config gcc |
Check out source code of qtbase and qt(4):
Note: there are 3 patchs about SSL which is cherry-picked from https://github.com/wkhtmltopdf/qt wk_4.8.7 branch.
1 2 3 4 5 6 |
cd ~ mkdir qt cd qt git clone https://github.com/qt/qtbase.git git clone https://github.com/liangqi/qt.git |
Build dev(6.8) of qtbase: https://doc-snapshots.qt.io/qt6-dev/supported-platforms.html
1 2 3 4 5 6 7 8 9 10 |
cd ~/qt mkdir qtbase-build cd qtbase-build ../qtbase/configure -developer-build -opensource -confirm-license -nomake examples -nomake tests -verbose cmake --build . --parallel -j8 mkdir examples cd examples ../bin/qmake ~/qt/qtbase/examples/examples.pro make -j8 sub-gui |
Build 5.15 of qtbase: https://doc.qt.io/qt-5/supported-platforms.html
Select version 9 for gcc/g++ first.
1 2 3 4 5 6 7 8 9 10 11 12 |
cd ~/qt/qtbase git worktree add ../qtbase-515-src v5.15.11-lts-lgpl cd ~/qt mkdir qtbase-515-build cd qtbase-515-build ../qtbase-515-src/configure -developer-build -opensource -confirm-license -nomake examples -nomake tests -verbose cmake --build . --parallel -j8 mkdir examples cd examples ../bin/qmake ~/qt/qtbase/examples/examples.pro make -j8 sub-gui |
Build 5.12 of qtbase: https://doc.qt.io/archives/qt-5.12/index.html
Select version 5 for gcc/g++ first. (Perhaps other versions are also fine.)
1 2 3 4 5 6 7 8 9 10 11 12 |
cd ~/qt/qtbase git worktree add ../qtbase-512-src v5.12.12 cd ~/qt mkdir qtbase-512-build cd qtbase-512-build ../qtbase-512-src/configure -developer-build -opensource -confirm-license -nomake examples -nomake tests -verbose cmake --build . --parallel -j8 mkdir examples cd examples ../bin/qmake ~/qt/qtbase/examples/examples.pro make -j8 sub-gui |
Build 4.8 of qt: https://doc.qt.io/archives/qt-4.8/supported-platforms.html
Select version 4.8 for gcc/g++ first. (Perhaps other versions are also fine.)
There are some issues about mysql plugin, we can ignore them for now.
1 2 3 4 5 6 7 8 |
cd ~/qt/ mkdir qt-build cd qt-build ../qt/configure -developer-build -opensource -confirm-license -nomake examples -nomake tests -nomake tools -verbose -openssl-linked -fast make -j8 cd demos/gradients make |