Install Android and Windows compilers

  • Hi,

    I'm trying to install compilers for Android and Windows. I'm working on Ubuntu 16.04. I've installed MinGW to compile for Windows. The compiler is working properly, but when I try to install it in Qt, I've an error "The compiler cannot produce code for Qt 5.5.1".

    Is it possible to install this compiler in Qt ? Or is it possible to find a Qt installer with all compilers (Linux/Windows/Android) already set in ? Last time I did that, it was a specific Qt version for Android, the compiler was already installed.

    Do you have some information to solve this problem ?


  • Moderators


    You are using MinGW under linux and you want to compile for windows?

    Never heard that this is possible with MinGW, but I may be wrong.

    AFAIK is MinGW only a windows adaptation of the gcc suite as you typically use under linux. gcc version numbers are idential between gcc for linux and Windows/MinGW. However, you need a recompilation on the respective OS.

    This implies that also Qt libs have to be compiled for the target system. Therefore, you can download a MinGW compiled Qt version for use on Windows. This is different from the same version compiled for linux.

  • Yes, I've installed the MinGW compiler on Ubuntu and compiled an application (just a little Hello window) for Windows. It is working. I just installed MinGW via apt-get on Ubuntu.

    After that, I've tried to install it in Qt, but it wasn't possible to compile my Qt application. I thought that compiling for Windows from Linux was possible with Qt. The other solution is to install Qt in a Windows VM... but I would have preferred working on Linux directly.

  • Moderators


    But you did run your hello world app in windows after you have cross-compiled it on linux?

    My guess is that you do not have the windows Qt libs for cross-compilation. Those have to be different from standard Qt libs as you can directly install in linux.

    I had done cross-compilations on Ubuntu for embedded linux. That meant to use gcc with Qt libs directly on desktop. The cross-compilation for embedded required a cross-compiler (also gcc based, but different from your desktop compiler). For the Qt application to bring to embeeded linux you have to cross-compile the Qt libs as well. In creator I used one toolchain forUbuntu desktop and another complete toolchain for embedded.

    Basically the same you would have to do as well. You would need a complete toolchain for your Ubuntu desktop. This toolchain includes Qt compiled for linux. When you have a cross-compiler for cross-compilation to windows, you require also the Qt libs cross-compiled for windows. I doubt that there is any chance to use the MinGW compiled version directly. Possibly you could use some windows emulator for linux, but I am not sure if they are stable enough. Propbably the better solution would be to do the cross-compile of Qt.

    Personally I would avoid cross-compiling. I am typically working on windows. I made some short tests for cross-compilation to embedded linux, but gave up soon. I had installed a separate linux and did compile also a desktop version on linux and the cross-compilation to my embedded linux (more an incremental step). Actually that was my incentive to start using creator. It is the same on windows and on linux.

  • Yes, I did run my Hello World window in Windows 7 after cross-compiling it on Linux. You just install MinGW for x86_64 architecture and W64 (Win64) OS and you can produce code for Windows ! You just use the cross-compiler as you use the GCC commands.

    Normally, Qt is based on GCC/G++ compiler. So, you just have to change the compiler and put MinGW to cross-compile for Windows. But it's the MinGW version problem. All libraries would be compiled with the new compiler. No need to find Qt libraries for Linux or Windows, just the right cross-compiler.

    MinGW is an extension of GCC/G++ for Windows (Minimalist GNU for Windows). So if you use GCC, it would be for Linux and MinGW for Windows.

    Now I'm trying to work on a Windows 7 VM. I installed Qt, but it's not as easy as Linux. On Linux, you just have to install Qt with apt-get and it's working. On Windows, you install it but it's not directly operational. You have to install the good version of Visual Studio or MinGW to be able to compile your first application... everything is more difficult and complicated under Windows !

    I think it's possible to cross-compile for Windows, but it's necessary to find the good version of MinGW. The one which is in the apt-get is not working with Qt 5.5.1.

    Cross-compiling is not a problem, it works if you have the good compiler. To compile for Linux-embedded systems, it's better to work on Linux. I also use Linux to develop software for embedded systems. I've never tried to use Windows for that.

    I think I will stay on Linux with my application for the moment.


  • Moderators


    I can completely agreewith your statements above. However, I think you miss an important point. BTW the sam e point is bothering you with VM and win 7.

    In order to have a complete application executable for win 7 you need all libs for your target platform. With your heelo world app you are using some libs provided by MinGW on linux. If you want to use Qt you need also the libs of Qt.

    [side note, I needed to switch PC, because of a browser issue]

    In VM win 7 you would have to install MinGW compiled for linking of your app and also you need to have the appropriate dlls.

    For cross-compiling you need to MinGW compiled Qt libs for linking and later MinGW compiled dlls for deployment on your target Win7. However, the MinGW compiled Qt libs you probably have not installed on linux. Those are for sure different from those are used in Linux.

    Personally I doubt that you can simply install the MinGW Qt libs as available from Qt site. Those are ready for use on windows and an installation there.

    My conclusion is that you have to generate your own MinGW cross-compiled Qt libs on linux. Otherwise you cannot link your exe completely on linux, because the dll stubs are missing and you will get a compile error.

Log in to reply

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