MSYS2: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
==[[MSYS2]]==
== [[MSYS2]] ==


“MSYS2”: http://sourceforge.net/projects/msys2/ and https://github.com/msys2 : MSYS2 (Minimal <span class="caps">SYS</span>tem 2) is an independent rewrite of <span class="caps">MSYS</span>, a (command-line) shell for development usage, and based on modern Cygwin (<span class="caps">POSIX</span> compatibility layer) and MinGW-w64 (from “MinGW-builds”), with the aim of better interoperability with native Windows software.<br /> It includes: MSYS2-shell and MinGW-w64 Win32 shell &amp; MinGW-w64 Win64 shell.<br /> It supports &amp; can work with both 32bit &amp; 64bit multiple toolchains &amp; targets, (for 64bit a 64bit operating system is needed).<br /> MSYS2 is a successor of <span class="caps">MSYS</span> and MinGW-builds.<br /> MSYS2-shell uses “pacman” for downloading packages from repo, and these are <span class="caps">GPG</span> signed &amp; verified. Packages are by developer: lexx83 (Alexpux), mingwandroid, niXman.<br /> MSYS2 is a complete opensource development environment+shell solution+system.<br /> It can obtain related all toolchains &amp; dependency packages from “MinGW-builds” and MSYS2 <span class="caps">REPO</span>, for compiling/building other software. It can also obtain various directly usable tools &amp; language support &amp; compilers, like: perl, python, ruby, openssl, etc.
“MSYS2”: http://sourceforge.net/projects/msys2/ and https://github.com/msys2 : MSYS2 (Minimal SYStem 2) is an independent rewrite of MSYS, a (command-line) shell for development usage, and based on modern Cygwin (POSIX compatibility layer) and MinGW-w64 (from “MinGW-builds”), with the aim of better interoperability with native Windows software.<br />It includes: MSYS2-shell and MinGW-w64 Win32 shell &amp; MinGW-w64 Win64 shell.<br />It supports &amp; can work with both 32bit &amp; 64bit multiple toolchains &amp; targets, (for 64bit a 64bit operating system is needed).<br />MSYS2 is a successor of MSYS and MinGW-builds.<br />MSYS2-shell uses “pacman” for downloading packages from repo, and these are GPG signed &amp; verified. Packages are by developer: lexx83 (Alexpux), mingwandroid, niXman.<br />MSYS2 is a complete opensource development environment+shell solution+system.<br />It can obtain related all toolchains &amp; dependency packages from “MinGW-builds” and MSYS2 REPO, for compiling/building other software. It can also obtain various directly usable tools &amp; language support &amp; compilers, like: perl, python, ruby, openssl, etc.


A user has these options to choose from: by using MSYS2-shell &amp; MinGW-w64 Win64 shell:<br /> (option-A), either download Qt or QtCreator source (from MSYS2 repo) and compile/build inside MSYS2,<br /> or (option-B), a user can get official Qt source or QtCreator source, and then compile/build using mingw-w64 toolchains obtained from MSYS2 repo, from the windows Cmd-shell,<br /> or (option-C), a user can get Qt or QtCreator software-building scripts from MSYS2’s “<span class="caps">MINGW</span>-packages” repo, and compile/build using mingw-w64 toolchains obtained from MSYS2 repo, inside MSYS2-shell,<br /> or (option-D), a user can download pre-built binary files of Qt &amp; QtCreator (dynamic/shared and/or static built editions) inside MSYS2, and run+use them instantly without compiling.
A user has these options to choose from: by using MSYS2-shell &amp; MinGW-w64 Win64 shell:<br />(option-A), either download Qt or QtCreator source (from MSYS2 repo) and compile/build inside MSYS2,<br />or (option-B), a user can get official Qt source or QtCreator source, and then compile/build using mingw-w64 toolchains obtained from MSYS2 repo, from the windows Cmd-shell,<br />or (option-C), a user can get Qt or QtCreator software-building scripts from MSYS2's &quot;MINGW-packages&amp;quot; repo, and compile/build using mingw-w64 toolchains obtained from MSYS2 repo, inside MSYS2-shell,<br />or (option-D), a user can download pre-built binary files of Qt &amp; QtCreator (dynamic/shared and/or static built editions) inside MSYS2, and run+use them instantly without compiling.


==Obtain &amp; Install==
== Obtain &amp; Install ==


MSYS2 (https://msys2.github.io/ ''[msys2.github.io]''). (Use <span class="caps">HTTPS</span> based secure connection and) obtain MSYS2. Run the installer binary. Install MSYS2 in C:\ drive in “msys2” folder.
MSYS2 (&quot;https://msys2.github.io/&amp;quot;:https://msys2.github.io/). (Use HTTPS based secure connection and) obtain MSYS2. Run the installer binary. Install MSYS2 in C:drive in &quot;msys2&amp;quot; folder.


==Initial Setup of MSYS2==
== Initial Setup of MSYS2 ==


* Run MSYS2 shell (Command Prompt). C:\msys2\msys2_shell.bat
* Run MSYS2 shell (Command Prompt). C:2\msys2_shell.bat


* First update msys2 core components (if you have not done it yet):<br /> You must exit out from MSYS2-shell, restart MSYS2-shell, then run below command, to complete rest of other components update:<br /> Exit out of MSYS2-shell, restart MSYS2-shell, then you are ready to use MSYS2-shell. Note: for initial installation &amp; setup, please also see this page [http://sourceforge.net/p/msys2/wiki/MSYS2 installation/ http://sourceforge.net/p/msys2/wiki/MSYS2%20installation/] Here -S means “sync”.
* First update msys2 core components (if you have not done it yet):<br /><code><br />pacman -Sy<br />pacman —needed -S bash pacman pacman-mirrors msys2-runtime<br /></code><br /> You must exit out from MSYS2-shell, restart MSYS2-shell, then run below command, to complete rest of other components update:<br /><code><br />pacman -Su<br /></code><br /> Exit out of MSYS2-shell, restart MSYS2-shell, then you are ready to use MSYS2-shell.<br /> Note: for initial installation &amp; setup, please also see this page http://sourceforge.net/p/msys2/wiki/MSYS2&amp;amp;#37;20installation/<br /> Here -S means &quot;sync&amp;quot;.


==Prepare MSYS2 for Qt related build development environment==
== Prepare MSYS2 for Qt related build development environment ==


* Start MSYS2-shell. Run/execute below commands to load MinGW-w64 <span class="caps">SEH</span> (64bit/x86_64) posix and Dwarf-2 (32bit/i686) posix toolchains &amp; related other tools, dependencies &amp; components from MSYS2 <span class="caps">REPO</span> ([https://github.com/Alexpux/MINGW-packages <span class="caps">MINGW</span>-packages] ''[github.com]'', [https://github.com/Alexpux/MSYS2-packages MSYS2-packages] ''[github.com]''):<br /> Note: the i686(32bit) toolchain loads into /c/msys2/mingw32/bin (C:\msys2\mingw32\bin) directory location, and, x86_64(64bit) toolchain loads into /c/msys2/mingw64/bin (C:\msys2\mingw64\bin) directory. Perl, Ruby, Python, OpenSSL etc loads into /c/msys2/usr/bin (C:\msys2\usr\bin) directory.
* Start MSYS2-shell. Run/execute below commands to load MinGW-w64 SEH (64bit/x86_64) posix and Dwarf-2 (32bit/i686) posix toolchains &amp; related other tools, dependencies &amp; components from MSYS2 REPO (&quot;MINGW-packages&amp;quot;:https://github.com/Alexpux/MINGW-packages, &quot;MSYS2-packages&amp;quot;:https://github.com/Alexpux/MSYS2-packages):<br /><code><br />pacman -S base-devel git mercurial cvs wget p7zip<br />pacman -S perl ruby python2 mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain<br /></code><br /> Note: the i686(32bit) toolchain loads into /c/msys2/mingw32/bin (C:2\mingw32\bin) directory location, and, x86_64(64bit) toolchain loads into /c/msys2/mingw64/bin (C:2\mingw64\bin) directory. Perl, Ruby, Python, OpenSSL etc loads into /c/msys2/usr/bin (C:2\usr\bin) directory.


* Build Qt : follow Qt building/compiling related articles
* Build Qt : follow Qt building/compiling related articles  
** [[MinGW-64-bit|MinGW 64 bit]]
** [[MinGW-64-bit]]
** or, [[Building-Qt-5-from-Git|Building Qt 5 from Git]], etc
** or, [[Building-Qt-5-from-Git]], etc
** Qt can also be compiled/built, using the software-building scripts from MSYS2 based MinGW-w64 Packages Repo, for details see below “<span class="caps">PKGBUILD</span>” section.
** Qt can also be compiled/built, using the software-building scripts from MSYS2 based MinGW-w64 Packages Repo, for details see below &quot;PKGBUILD&amp;quot; section.


==Obtain Pre-Built Qt &amp; QtCreator binary files and Use instantly without Building/Compiling==
== Obtain Pre-Built Qt &amp; QtCreator binary files and Use instantly without Building/Compiling ==


If you are going to build Qt using MinGW-w64 toolchains which are inside MSYS2, then you do need to do get pre-built Qt binary files, but choice is upto you.
If you are going to build Qt using MinGW-w64 toolchains which are inside MSYS2, then you do need to do get pre-built Qt binary files, but choice is upto you.


* Start MSYS2-shell. Run/execute below commands, to install/load, a pre-built dynamic/shared library environment edition of Qt &amp; QtCreator binary files from MSYS2 <span class="caps">REPO</span>, for developing, testing, compiling/building or releasing opensource or closedsource software:<br /> If you also want to install/load, a pre-built static library environment edition of Qt binary files, for compiling &amp; releasing opensource projects, (with almost one/single file based standalone or portable binary executable file), then run/execute below command:<br /> Note: There is no static edition of QtCreator.
* Start MSYS2-shell. Run/execute below commands, to install/load, a pre-built dynamic/shared library environment edition of Qt &amp; QtCreator binary files from MSYS2 REPO, for developing, testing, compiling/building or releasing opensource or closedsource software:<br /><code><br />pacman -S mingw-w64-i686-qt-creator mingw-w64-x86_64-qt-creator<br /></code><br /> If you also want to install/load, a pre-built static library environment edition of Qt binary files, for compiling &amp; releasing opensource projects, (with almost one/single file based standalone or portable binary executable file), then run/execute below command:<br /><code><br />pacman -S mingw-w64-i686-qt5-static mingw-w64-x86_64-qt5-static<br /></code><br /> Note: There is no static edition of QtCreator.


==How to build using MSYS2’s software-building scripts (<span class="caps">PKGBUILD</span> &amp; patches)==
== How to build using MSYS2's software-building scripts (PKGBUILD &amp; patches) ==


* run MSYS2-shell (C:\msys2\msys2_shell.bat)
* run MSYS2-shell (C:2\msys2_shell.bat)
* create a folder to download build related scripts, then git clone software-building script <span class="caps">REPO</span>, from MSYS2’s [https://github.com/Alexpux/MINGW-packages <span class="caps">MINGW</span>-packages] ''[github.com]'' <span class="caps">REPO</span> (mirror)<br />
* create a folder to download build related scripts, then git clone software-building script REPO, from MSYS2's &quot;MINGW-packages&amp;quot;:https://github.com/Alexpux/MINGW-packages REPO (mirror)<br /><code><br />mkdir /c/msys2/repos<br />cd /c/msys2/repos<br />git clone https://github.com/Alexpux/MINGW-packages.git<br /></code>
* goto your choice of software-building script’s sub-folder, which has a “<span class="caps">PKGBUILD</span>” file. For example, here we are showing how to build Qt5:<br /> For example, we want to build Qt5, so here our command will be: cd /c/msys2/repos/mingw-packages/mingw-w64-qt5
* goto your choice of software-building script's sub-folder, which has a &quot;PKGBUILD&amp;quot; file. For example, here we are showing how to build Qt5:<br /><code><br />cd ${package-name}<br /></code><br /> For example, we want to build Qt5, so here our command will be: cd /c/msys2/repos/mingw-packages/mingw-w64-qt5
* update it:<br />
* update it:<br /><code><br />updpkgsums<br /></code>
* build it:<br />
* build it:<br /><code><br />makepkg-mingw -fsiL<br /></code>
* install built package. (make sure you are inside correct sub-directory, for our example, you need to be inside here /c/msys2/repos/mingw-packages/mingw-w64-qt5) (the -U is “upgrade”)<br /> So for our example, our install command will be: pacman -U *.pkg.tar.xz
* install built package. (make sure you are inside correct sub-directory, for our example, you need to be inside here /c/msys2/repos/mingw-packages/mingw-w64-qt5) (the -U is &quot;upgrade&amp;quot;)<br /><code><br />pacman -U ${package-name}'''.pkg.tar.xz<br /></code><br /> So for our example, our install command will be: pacman -U'''.pkg.tar.xz
 
===Categories:===
 
* [[:Category:MinGW|MinGW]]

Revision as of 10:42, 23 February 2015

MSYS2

“MSYS2”: http://sourceforge.net/projects/msys2/ and https://github.com/msys2 : MSYS2 (Minimal SYStem 2) is an independent rewrite of MSYS, a (command-line) shell for development usage, and based on modern Cygwin (POSIX compatibility layer) and MinGW-w64 (from “MinGW-builds”), with the aim of better interoperability with native Windows software.
It includes: MSYS2-shell and MinGW-w64 Win32 shell & MinGW-w64 Win64 shell.
It supports & can work with both 32bit & 64bit multiple toolchains & targets, (for 64bit a 64bit operating system is needed).
MSYS2 is a successor of MSYS and MinGW-builds.
MSYS2-shell uses “pacman” for downloading packages from repo, and these are GPG signed & verified. Packages are by developer: lexx83 (Alexpux), mingwandroid, niXman.
MSYS2 is a complete opensource development environment+shell solution+system.
It can obtain related all toolchains & dependency packages from “MinGW-builds” and MSYS2 REPO, for compiling/building other software. It can also obtain various directly usable tools & language support & compilers, like: perl, python, ruby, openssl, etc.

A user has these options to choose from: by using MSYS2-shell & MinGW-w64 Win64 shell:
(option-A), either download Qt or QtCreator source (from MSYS2 repo) and compile/build inside MSYS2,
or (option-B), a user can get official Qt source or QtCreator source, and then compile/build using mingw-w64 toolchains obtained from MSYS2 repo, from the windows Cmd-shell,
or (option-C), a user can get Qt or QtCreator software-building scripts from MSYS2's "MINGW-packages&quot; repo, and compile/build using mingw-w64 toolchains obtained from MSYS2 repo, inside MSYS2-shell,
or (option-D), a user can download pre-built binary files of Qt & QtCreator (dynamic/shared and/or static built editions) inside MSYS2, and run+use them instantly without compiling.

Obtain & Install

MSYS2 ("https://msys2.github.io/&quot;:https://msys2.github.io/). (Use HTTPS based secure connection and) obtain MSYS2. Run the installer binary. Install MSYS2 in C:drive in "msys2&quot; folder.

Initial Setup of MSYS2

  • Run MSYS2 shell (Command Prompt). C:2\msys2_shell.bat
  • First update msys2 core components (if you have not done it yet):
    <br />pacman -Sy<br />pacman needed -S bash pacman pacman-mirrors msys2-runtime<br />
    

    You must exit out from MSYS2-shell, restart MSYS2-shell, then run below command, to complete rest of other components update:
    <br />pacman -Su<br />
    

    Exit out of MSYS2-shell, restart MSYS2-shell, then you are ready to use MSYS2-shell.
    Note: for initial installation & setup, please also see this page http://sourceforge.net/p/msys2/wiki/MSYS2&amp;#37;20installation/
    Here -S means "sync&quot;.

Prepare MSYS2 for Qt related build development environment

  • Start MSYS2-shell. Run/execute below commands to load MinGW-w64 SEH (64bit/x86_64) posix and Dwarf-2 (32bit/i686) posix toolchains & related other tools, dependencies & components from MSYS2 REPO ("MINGW-packages&quot;:https://github.com/Alexpux/MINGW-packages, "MSYS2-packages&quot;:https://github.com/Alexpux/MSYS2-packages):
    <br />pacman -S base-devel git mercurial cvs wget p7zip<br />pacman -S perl ruby python2 mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain<br />
    

    Note: the i686(32bit) toolchain loads into /c/msys2/mingw32/bin (C:2\mingw32\bin) directory location, and, x86_64(64bit) toolchain loads into /c/msys2/mingw64/bin (C:2\mingw64\bin) directory. Perl, Ruby, Python, OpenSSL etc loads into /c/msys2/usr/bin (C:2\usr\bin) directory.
  • Build Qt : follow Qt building/compiling related articles
    • MinGW-64-bit
    • or, Building-Qt-5-from-Git, etc
    • Qt can also be compiled/built, using the software-building scripts from MSYS2 based MinGW-w64 Packages Repo, for details see below "PKGBUILD&quot; section.

Obtain Pre-Built Qt & QtCreator binary files and Use instantly without Building/Compiling

If you are going to build Qt using MinGW-w64 toolchains which are inside MSYS2, then you do need to do get pre-built Qt binary files, but choice is upto you.

  • Start MSYS2-shell. Run/execute below commands, to install/load, a pre-built dynamic/shared library environment edition of Qt & QtCreator binary files from MSYS2 REPO, for developing, testing, compiling/building or releasing opensource or closedsource software:
    <br />pacman -S mingw-w64-i686-qt-creator mingw-w64-x86_64-qt-creator<br />
    

    If you also want to install/load, a pre-built static library environment edition of Qt binary files, for compiling & releasing opensource projects, (with almost one/single file based standalone or portable binary executable file), then run/execute below command:
    <br />pacman -S mingw-w64-i686-qt5-static mingw-w64-x86_64-qt5-static<br />
    

    Note: There is no static edition of QtCreator.

How to build using MSYS2's software-building scripts (PKGBUILD & patches)

  • run MSYS2-shell (C:2\msys2_shell.bat)
  • create a folder to download build related scripts, then git clone software-building script REPO, from MSYS2's "MINGW-packages&quot;:https://github.com/Alexpux/MINGW-packages REPO (mirror)
    <br />mkdir /c/msys2/repos<br />cd /c/msys2/repos<br />git clone https://github.com/Alexpux/MINGW-packages.git<br />
    
  • goto your choice of software-building script's sub-folder, which has a "PKGBUILD&quot; file. For example, here we are showing how to build Qt5:
    <br />cd ${package-name}<br />
    

    For example, we want to build Qt5, so here our command will be: cd /c/msys2/repos/mingw-packages/mingw-w64-qt5
  • update it:
    <br />updpkgsums<br />
    
  • build it:
    <br />makepkg-mingw -fsiL<br />
    
  • install built package. (make sure you are inside correct sub-directory, for our example, you need to be inside here /c/msys2/repos/mingw-packages/mingw-w64-qt5) (the -U is "upgrade&quot;)
    <br />pacman -U ${package-name}'''.pkg.tar.xz<br />
    

    So for our example, our install command will be: pacman -U.pkg.tar.xz