[Development] How to build 32-bit Qt with Qt6/CMake
cristian.adam at qt.io
Wed Nov 25 18:00:04 CET 2020
On my Ubuntu 20.04 x86_64 I've build Qt6Base x86 like this:
1. Upgrade the compiler:
sudo apt install g++-9-multilib
2. Install dev packages:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install '^libxcb.*-dev:i386' libx11-xcb-dev:i386 libglu1-mesa-dev:i386 libxrender-dev:i386 libxi-dev:i386 libxkbcommon-dev:i386 libxkbcommon-x11-dev:i386
Updated pkg-config for i386:
sudo apt-get install pkg-config-i686-linux-gnu
I'm not sure if step 3 is needed, since I haven't actually set PKG_CONFIG_LIBDIR later.
Configured Qt6 with this x86-toolchain.cmake file:
function(cmake_initialize_per_config_variable _PREFIX _DOCSTRING)
if (_PREFIX MATCHES "CMAKE_(C|CXX|ASM)_FLAGS")
foreach (config DEBUG RELEASE MINSIZEREL RELWITHDEBINFO)
Note that I haven't changed the CMAKE_SYSTEM_NAME which would trigger CMake into cross-compiling and then Qt requiring QT_HOST_PATH to be set.
From: Development <development-bounces at qt-project.org> on behalf of Thiago Macieira <thiago.macieira at intel.com>
Sent: Wednesday, November 25, 2020 4:22 PM
To: development at qt-project.org <development at qt-project.org>
Subject: Re: [Development] How to build 32-bit Qt with Qt6/CMake
On Wednesday, 25 November 2020 05:16:58 PST Joerg Bornemann wrote:
> This looks correct so far. A small improvement would be to put all this
> into a CMake toolchain file and additionally do
> set(CMAKE_SYSTEM_NAME Linux)
> Then you can cross-build with -DCMAKE_TOOLCHAIN_FILE=x86-toolchain.cmake
> In a perfect world, your distro would have provided this file.
I checked both distros I use and neither does. I suppose CMake itself should
create the toolchain file for multilib builds on Linux if this is a common
occurrence, but seems not to be the case.
The only toolchain file I can find in my system are the ones inside the Zephyr
and Chromium source codes. In fact, the one in qtwebengine/src/3rdparty/
chromium/third_party/boringssl/src/util/32-bit-toolchain.cmake is nearly
What is the one generated in qtbase/lib/cmake/Qt6/qt.toolchain.cmake for?
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel DPG Cloud Engineering
Development mailing list
Development at qt-project.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Development