How to build a 32bit application on 64bit Qt Creator



  • Hello friends, I want to ask something about qmake compiler. I want to build an application that is based 32bit, qt creator I install the 64bit, how do we compile our project at IDE 64bit?



  • You need a 32bit Kit in Qt Creator consisting of compiler, debugger and Qt (qmake and libraries). BTW qmake is for generating the projects compile instructions. Ist not a compiler.



  • @sneubert Oh so, compiler kit 32bit already exists, the problem is that when I build the debian package to directly generate the 64bit compiler.



  • could you post some error information



  • @sneubert /usr/bin/untitled: Cannot execute binary file.
    I think it's because the compiler error when I build a debian package was put on 64bit, 64bit I've tried it on and it works.



  • Ok, now I´m confused.
    Could you clarify the exact problem? You are on a 64bit Linux with Qt Creator 64bit installed and a valid 32bit Kit and want to create a 32bit executable. The error you posted raises after building with the 32bit Kit, if you try to run the executable? Or is the error from the build process itself?



  • @sneubert The issue here, when I build a debian package it in a 64bit operating system, Qt Creator that I installed also 64bit. When debian package is finished, I am trying to install on a 64bit operating system is working, when I install on a 32bit operating system, the installation is successful, when I run the application display a notification so at the command line, because I try to run it at the command line.


  • Moderators

    @Renn Then you use the wrong (64bit) kit to build your app. Make sure you use the right kit.



  • Like jsulm suggested make sure you create a 32bit executable. You can check the executable with readelf.
    Could you post the Output of
    readelf -h /usr/bin/untitled



  • @sneubert So what is to be prepared? I do not know what to be prepared to cross compile from 64bit to 32bit.


  • Moderators

    @Renn Didn't you say before you already have a 32bit kit? That's what you need.



  • @Renn said:

    So what is to be prepared? I do not know what to be prepared to cross compile from 64bit to 32bit.

    You need to install the corresponding compiler. On a 64 bits system when you install a compiler, the default is to install only the 64 bits one. But you've already said that you have a 32 bits kit on your computer...

    In order to be sure, I'd compile a simple hello world program from the command line once calling the 64 bits compiler and once calling the 32 bits compiler. I'd run both of them to check that they are both executing fine. Then I'd check the binaries with the readelf utility @sneubert told you about. Forcing the compilation in 32/64 bits is done by adding the -m32 / -m64 to the gcc / clang command line.



  • @jsulm Already there are 32 bits of Qt Creator, I do not know anything about it, whether existing 32bit kit or not, when I said yes already there, it is only in qt creator ............. ..... the rest I do not know whether it is or or not.


  • Moderators

    @Renn It is not about QtCreator. If you want to create 32bit binaries you need a compiler generating 32bit binaries. On Ubuntu the package containing g++ compiler for x86 is called g++:i386, don't know what is the name on Debian.



  • @JohanSolo Yes it is working, but if I make a debian package, it turns into a 64bit only. I've tried to use gcc gcc -m32 and -m64 it can, but when I build a debian package, it only 64bit only .............................



  • Well, in this case ask on your distro forum how to build a 32 bits package from a 64 bits platform...
    Or simply create a source package (i.e. automatically compiled when installing).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.