[Development] How to build 32-bit Qt with Qt6/CMake

Joerg Bornemann joerg.bornemann at qt.io
Wed Nov 25 14:16:58 CET 2020


On 11/24/20 9:32 PM, Thiago Macieira wrote:
> Like the "How to build unit tests & examples on demand with Qt6/CMake?"
> thread, now I need to build a 32-bit build of Qt but I don't know how.
> 
> TL;DR:
> need to set PKG_CONFIG_LIBDIR in the environment and pass to cmake:
>   -DCMAKE_ASM_FLAGS=-m32
>   -DCMAKE_C_FLAGS=-m32\ -O0
>   -DCMAKE_CXX_FLAGS=-m32\ -O0
>   -DCMAKE_PREFIX_PATH=/usr/lib32
> 
> Is this the correct solution? Is there a better way?

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.


Cheers,

Joerg


More information about the Development mailing list