Cross-compiling 5.7 on Windows



  • I want to cross compile Qt for my RPi on Widnows and I'm a little stuck right now. I tried this guide but had some issues at step 12. I decided to scrap everything and start again, this time following this guide to get my environment setup.

    My steps so far:

    1. Installed Qt Creator with Qt 5.7 including the source code and MinGW
    2. Downloaded Jom
    3. Created the cmd file to setup my variables
    4. Run configure -platform win32-g++ -debug -nomake examples -opensource

    Doing this gives me an error that '_popen' was not declared in this scope in qmakebuiltins.cpp

    What am I missing or am I approaching this all wrong?

    Below is the .cmd file that sets up my variables

    SET _QT_SRC=D:\Dev\Qt\5.7\Src
    SET _MINGW=D:\Dev\Qt\5.7\mingw53_32
    SET _JOM=D:\Dev\Jom
    
    REM Add the MinGW bin directory to the path
    SET PATH=%_MINGW%\bin;%PATH%
    
    REM Add the QT directories to the path
    SET PATH=%_QT_SRC%\qtbase\bin;%_QT_SRC%\gnuwin32\bin;%PATH%
    
    REM Add the Jom directory to the path
    SET PATH=%_JOM%;%PATH%
    
    REM SET QMAKESPEC=win32-msvc2013
    
    CD %_QT_SRC%
    
    SET _QT_SRC=
    SET _MINGW=
    SET _JOM=
    
    

    My end goal is to have Qt with OpenGl ES on my RPi and develop on my Windows PC



  • I managed to move forward, slightly. I did some research and it was suggested that I add the -U__STRICT_ANSI__ flag. I tried adding it to the qmake.conf file as per Step 11 of this guide but that didn't work. I decided to add the flag to the generated \qtbase\gmake\Makefile and ran it manually. I now get a different error (the same error I ran into when I first tried compiling everything before I decided to restart from scratch):

    D:\Dev\Qt-Build\qt-everywhere-opensource-src-5.7.0\qtbase/qmake/generators/win32/msvc_vcproj.cpp: In function 'DotNET which_dotnet_version(const QByteArray&)':
    D:\Dev\Qt-Build\qt-everywhere-opensource-src-5.7.0\qtbase/qmake/generators/win32/msvc_vcproj.cpp:108:43: error: 'KEY_WOW64_32KEY' was not declared in this scope
    
                                               KEY_WOW64_32KEY);
                                               ^
    make: *** [msvc_vcproj.o] Error 1
    

    I tried Goolg'ing this before and came up with nothing. Any ideas?



  • My "fudge" to get around the issues were simply:

    in qtbase\mkspecs\win32-g++

    in qmake.conf modify QMAKE_CXXFLAGS to read:
    "QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -U__STRICT_ANSI__ -D KEY_WOW64_64KEY=0x0100 -DKEY_WOW64_32KEY=0x0200"

    in qplatformdefs.h disable the definition of EXTENDED_NAME_FORMAT, ie change the #if/#endif wrap
    "#if !defined(_WIN32_WINNT) || (_WIN32_WINNT-0 < 0x0500)" to
    "#if 0 //!defined(_WIN32_WINNT) || (_WIN32_WINNT-0 < 0x0500)"

    To fix a "make" issue...

    In qtbase\src\corelib\global\qglobal.h disable the dynamic_cast check, so change
    "#if defined(QT_NO_DYNAMIC_CAST) && !defined(dynamic_cast)" to
    "#if 0 // defined(QT_NO_DYNAMIC_CAST) && !defined(dynamic_cast)"

    Not a fix, a fudge, but it allows qmake to build, and "make && make install" to complete.

    Bruce.



  • @BruceNaylor Hmm that's interesting! I posted on the C++ Gurus forum and a couple guys there suggested I use the MinGW that gets installed with QT Creator (when you select that option) and that actually fixed my issue with registry keys. I was going to give cross compiling another try on Windows, maybe your fudges will fix some other issues I've into. I appreciate the suggestions!



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