We build qt-4.8.7 and qt creator using mingw-w64 on windows (10), with a bonus we configure it to work with github

    A couple of words about why this was needed at all: I had a simple situation - there was no fast Internet and there was a computer with windows 10 cleanly installed. In addition, the picking project requires assembly for both 32 and 64 bit architecture, therefore It seemed to me that the presence of Qt, equally configured and compiled for these architectures would be only a plus.

    0) It is advisable to chop off Windows Search and Superfetch services and Windows Defender in advance. They will only slow down the system at our operations, and we will need resources soon. In addition, it is very useful to set the default input language to English.

    1) Create the folder “C: \ QT” - our assemblies will live here.

    2) For starters, of course we need the mingw-w64 compiler itself. Download the installer here .

    3) We install both versions in turn: the
    first installation:
    Version - 5.2.0 - the last at the time of writing;
    Architecture - i686 - first we put the 32 bit version (let it not scare you that it is not i386, i686 is Intel Pentium pro and higher, you will be able to run 2k Windows on something older - good luck!)
    Threads - win32 - if you do not port the source from Unix better to choose native;
    Exeption - sjlj - I need it if you need others - for God's sake;
    Build revision - 1 again the last at the time of writing;
    The destination was selected by “C: \ mingw-w64-i686” because from the Program Files there may be problems with spaces in the qt paths.
    The second installation is all the same except:
    Architecture - x86_64;
    The path is "C: \ mingw-w64-x86_64";
    I also removed the “create shortcuts” checkbox, otherwise they will be overwritten with the 64 bit version, it’s inconvenient for me.
    If you do not want to produce a lot of folders, you can set it in the root in “C: \ QT \ mingw-w64-i686” and “C: \ QT \ mingw-w64-x86_64” according to the architecture, this does not play a role.

    4) Download the sources of the QT 4.8.7 library here

    5) Unpack Qt itself (here it is better to preoccupy with the presence of the 7zip programfor the Windows archiver will first unpack to a temporary folder, then copy a bunch of small files from it, an idiot, and then also create an additional folder inside with the same name) immediately in 2 copies “C: \ QT \ qt-4.8.7- mingw-w64-i686 "and" C: \ QT \ qt-4.8.7-mingw-w64-x64 "(the second is needed in case of configuration errors, it’s much faster to rename the copy and let the background unpack another one than to wait until mingw32 works -make confclean). If you are not sure about the archiver, we check that the folders bin, util, src, etc. are immediately in these folders, if the archiver created another subfolder, we pull out the contents one level higher.

    6) We go into the properties of the system and change the PATH variable (it is necessary in my 10-ke made the normal interface for this) we add the path there so far only to the 32-bit version of the compiler, I have this: "C: \ mingw-w64-i686 \ mingw32 \ bin ". If suddenly you have PATH paths to other compilers, temporarily remove them from there.

    7) Run cmd from the admin (this is important) and enter: the infa about the compiler should appear, if this did not happen, the compile is installed incorrectly, we are looking for an error in the previous steps. If the information is displayed, we check that we have not messed up anything: we are really running the 32 bit version, and that it is the one that we installed in the previous steps, and not from the original mingw without w64 (these are essentially different projects) or, God forgive me, visual studio. If everything is fine, go to the folder with Qt:

    g++ -v






    cd C:\QT\qt-4.8.7-mingw-w64-i586


    we run the configuration there like this: in this config, to the maximum, everything that can be collected without dependencies. I do not really need openssl, otherwise it needs to be built in advance. If time is critical, you can disable the examples, do not collect additional topics and the odbc plugin. Help on the options can be obtained like this: ". \ Configure -help". Next, we wait a few minutes until the config works, and run the compilation:

    .\configure -debug-and-release -opensource -confirm-license -platform win32-g++ -graphicssystem raster -no-openssl -nis -iconv -system-proxies -no-freetype -plugin-sql-odbc -plugin-sql-sqlite -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -qt-style-plastique -qt-style-cleanlooks -qt-style-motif -qt-style-cde -qt-style-windowsce -qt-style-windowsmobile -qt-style-s60




    mingw32-make -j4


    I have a 4 core processor, this option -j4 it means doing compilation in 4 threads. Immediately make a reservation, compilation with this option does not go through to the end, it crashes on qtdeclarative with a file copy error, apparently, dependencies are written somewhere incorrectly. It was enough for me to start compilation after the failure again. By the way, the error was repeated on the 64 bit version. On a core i5-3570 with 8 gigs of opera, compiling one version into 4 streams takes almost 2 hours.

    8) If you have slow Internet while Qt compiles, you can download qt creator 3.2.2 (this is the latest version, which compiles on 4.8.x), ActivePerl-5.20.2! 32 bit version! and msysgit! 32 bit version!The versions indicated here are the last at the time of writing, and, accordingly, those with which I worked. If something went wrong with the newer ones, try the ones I mentioned. I’ll warn you right away, it’s very undesirable to install msysgit before the qtcreator build, the creator will not normally assemble if it sees sh.exe in the patch, and for normal work with the git it should be set with the PATH setting.

    9) Install perl: I did not put the documentation and examples, I made the destination “C: \ perlx86”. The "Add perl to the PATH environment variable" checkbox is not removed. After installation on the command line (naturally not in the one in which Qt is compiled) we write “perl -v”, version information should appear.

    10) Unpack qt creator in "C: \ QT \ qt-creator-opensource-src-3.2.2", also check that there is no subfolder inside, but immediately there is a bin folder and the rest.

    11) We are waiting for qt to compile. There will be no direct messages that the compilation was completed successfully. My last one was 'C: /QT/qt-4.8.7-mingw-w64-i586/demos/declarative/webbrowser'. You can run qtdemo.exe to check, run examples. Again, open the environment variable editor, add in PATH "C: \ QT \ qt-4.8.7-mingw-w64-i586 \ bin". Again, make sure that this is the only qt profile in PATH. We check ourselves by restarting the command line and typing “qmake -v”.

    12) Open the block file "C: \ QT \ qt-creator-opensource-src-3.2.2 \ src \ libs \ utils \ tcpportsgatherer.cpp", find the line
    #if __GNUC__ == 4 && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 2)

    and change it to
    #if __MINGW64_VERSION_MAJOR == 5 || (__GNUC__ == 4 && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 2))

    13) Restart cmd again from the admin. Putting creator in a new folder: I hope you don’t need to repeat about the -j4 option. 14) We are waiting for the end of compilation, run qtcreator, make sure that it works. Close, there’s nothing to configure in it yet. If you really feel sorry for disk space and RAM, you can drop the compiled creator into the folder with Qt (copy only the bin, lib, share folders) and drop the missing dlls from mingw into the bin folder. Humanly, on the contrary, it is necessary to remove the compiler and Qt from PATH and copy the creator dlls from the bin folders from Qt and the compiler into the bin folder of the creator.

    mkdir C:\QT\qt-creator-3.2.2-x86
    cd C:\QT\qt-creator-3.2.2-x86
    qmake -r ../qt-creator-opensource-src-3.2.2/qtcreator.pro
    mingw32-make release -j4






    15) Open the PATH editor again, remove the path to the compiled Qt “C: \ QT \ qt-4.8.7-mingw-w64-i586 \ bin” from there and change the path to the compiler c “C: \ mingw-w64-i686 \ mingw32 \ bin "to" C: \ mingw-w64-x86_64 \ mingw64 \ bin ". Again, restart cmd from the admin and check that it will be given to us if everything is normal, do the same thing as in step 6, only we will now have a different path. 16) Now, while the 64-bit version of Qt is compiled, you can also do the git (jit, I don’t know which transcription is more correct). Install msysgit v2.6.3! 32 bit version!

    g++ -v




    cd C:\QT\qt-4.8.7-mingw-w64-x86_64
    .\configure -debug-and-release -opensource -confirm-license -platform win32-g++ -graphicssystem raster -no-openssl -nis -iconv -system-proxies -no-freetype -plugin-sql-odbc -plugin-sql-sqlite -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -qt-style-plastique -qt-style-cleanlooks -qt-style-motif -qt-style-cde -qt-style-windowsce -qt-style-windowsmobile -qt-style-s60
    mingw32-make -j4


    we run the installer immediately from the admin, otherwise it will deliver us the version only for the local user, we do not need it. The path I chose is “C: \ msysGitX86”. In the next step, you can poke a daw, which will create a shortcut to the console on the desktop. After another step, select "Use git from the Windows Command Promt", I also selected "Use Windows` default console window" for the terminal, the rest is amateur or default.

    There is a great article on blogspot on how to make friends qt creator and github. However, it does not give instructions on what to do if the screw on which all this is configured burns with a blue flame. Let's try to fill this gap.

    17) Run git-bash from the admin, from the shortcut that the installer created for us

    we make the settings, of course, substituting the mail for which the account on the github is registered and generate a new key pair for ssh with your nickname : press enter 3 times, go to your profile on the github with your browser, delete the old key (unless of course we are going to use it, and he lost like mine) and add a new one. try to clone the existing repository:

    git config --global user.email "myMail@example.com"
    git config --global user.name "myGithubNick"
    git config --global push.default simple




    ssh-keygen -t rsa -C "myMail@example.com"






    mkdir C:\\myproject
    cd C:\\myproject
    git clone git@github.com:myGithubNick/mysuperproject.git


    note that the user is “git” and not a nickname; the nickname is indicated after the colon. In addition, there should not be any https: // or git: // in front of the address, if you get a message that you need to use https, then the github did not recognize the owner of the repository in you, look for problems with keys or ssh. If everything is ok, git will make us a copy of the repository in the mysuperproject folder. We’ll go into it and check that the repository is working, and we have all the rights, of course, there should be no errors, if there is something means something is wrong with installing gita or ssh.

    cd ./mysuperproject
    git remote -v
    touch .testfile.txt
    git add .testfile.txt
    git commit -m test
    git push
    git reset --hard HEAD~1
    git push -f




    18) We wait until the 64-bit version of Qt is compiled. We remove the 64-bit compiler from PATH, either completely, or change to the 32-bit version, this is already more convenient. Open with a notepad “C: \ QT \ qt-4.8.7-mingw-w64-x86_64 \ mkspecs \ win32-g ++ \ qmake.conf”, immediately after the comments add “QMAKE_TARGET.arch + = x86_64”, save, close.

    19) We start creator again (if now it has stopped running, it means that there is something superfluous in path or not all libraries we put to it).

    Open Tools -> Options. Immediately in the Environment section of the General tab, we are asked to enter the path to the patch command, you can use "C: \ msysGitX86 \ usr \ bin \ patch.exe". We go to the External Tools (External Tools) - right path.

    Go to the Build & Run section, go to the Debuggers tab, click Add, give the name: “mingw32-w64-gdb”, the path: “C: \ mingw-w64-i686 \ mingw32 \ bin \ gdb.exe ". Again, click Add, give the name: "mingw64-w64-gdb", the path: "C: \ mingw-w64-x86_64 \ mingw64 \ bin \ gdb.exe".

    Go to the Compilers tab, click Add -> MinGW, if there is no name defined in path, give “MinGW32-W64” and the path “C: \ mingw-w64-i686 \ mingw32 \ bin \ g ++. Exe” ( You can make a copy for convenience, not scary). We add one more: the name is “MinGW64-W64”, the path is “C: \ mingw-w64-x86_64 \ mingw64 \ bin \ g ++. Exe”, we select 64-bit ABI, if any.

    Go to the Qt profiles tab (Qt versions). If there is no 32-bit profile in path, first add it “C: \ QT \ qt-4.8.7-mingw-w64-i586 \ bin \ qmake.exe”. Then we add the 64-bit "C: \ QT \ qt-4.8.7-mingw-w64-x86_64 \ bin \ qmake.exe". The names I have are “Qt 4.8.7 mingw-w64 i586” and “Qt 4.8.7 mingw-w64 x86_64”, respectively.

    Go to the kits tab, first configure the Desktop profile:
    Name: Desktop
    Name in the file system: x86
    Device type: Desktop
    Device: Local PC
    Sysroot: - leave it empty
    Compiler: MinGW32-W64
    Debugger: mingw32-w64-gdb
    Qt profile: Qt 4.8.7 mingw-w64 i586
    Add another
    Name: Desktop 64
    Name on the file system: x86_64
    Device type: Desktop
    Device: Local
    Sysroot PC : - leave it empty
    Compiler: MinGW64-W64
    Debugger: mingw64-w64-gdb
    Qt profile: Qt 4.8.7 mingw-w64 h86_64
    save, use, try to collect something.

    That's probably all that I remembered on this topic.

    By the way, a small hack: if you need to slightly reconfigure an already-assembled assembly, well, for example, you decided to add openssl or the plug-in didn’t gather any muscle, and wait 2-3-4 hours until everything is recompiled and smiles, we do this: set the system time 10-15 minutes earlier than the last time you configured the assembly, reconfigure, return the time to the present. With a notepad we change that (those) makefile (s) that affects our changes and start the make up, if you didn’t make a mistake with the makefiles (in fact, if you know what Qt consists of and what it depends on, it’s hard to make an error) only the piece that we need.

    Also popular now: