Skip to content
Angus Gratton edited this page Aug 31, 2017 · 7 revisions

Currently Broken

As of wine <= 2.15 & current MSYS2 (20161025 base package or newer), this won't work.

See this issue: https://github.com/Alexpux/MSYS2-packages/issues/682

Older MSYS2 (pre-Cygwin 2.6) may work.

Steps to use Msys2, pacman and makepkg in Wine

Compile and Install Wine

  1. IMPORTANT Install latest Wine Staging. Wine Staging provides pre-built packages for a couple of distributions every two weeks.

Install Msys2

  1. Backup or remove your old wineprefix:

    $ mv ~/.wine ~/.wine.bak

    Refer to http://wiki.winehq.org/FAQ#wineprefix for more backgrounds about wineprefix.

  2. Download Msys2 installer

    $ wget http://repo.msys2.org/distrib/msys2-i686-latest.exe

  3. Install Msys2

    $ wine msys2-i686-latest.exe

    (Ignore error "mintty: could not load icon from '/msys2.ico': File not found" if it happens)

  4. Initialize Msys2 shell

    • In Unix shell:

    • $ cd ~/.wine/drive_c/msys32/

    • Workaround bug 40483 and bug 40482

    • $ MSYSTEM=MSYS wine usr/bin/mintty.exe --exec /usr/bin/bash -l

      • If you see a screen that says "This is first start of Msys2. You MUST restart shell to apply necessary actions.", then everything seems fine so far. Now you can leave Msys2, just type exit in Msys2 Shell in Wine console:
      • $ exit

Run pacman

  1. Restart Msys2 shell

    • $ MSYSTEM=MSYS wine usr/bin/mintty.exe --exec /usr/bin/bash -l
  2. (optional) Edit /etc/pacman.d/mirrorlist.* to switch to a faster repo. For example, Chinese users might prefer USTC Mirror rather than the default repo. You can extract msys-ustc-mirror.zip in ~/.wine/drive_c/msys32/etc/pacman.d to overwrite the mirrorlist.

  3. Update the package database, then you can install packages from Msys2 repo

    • In Msys2 shell:
      • $ pacman -Sy
      • and for example $ pacman -S vim
  4. Update system core packages with:

    • $ update-core
  5. Close Msys2, run it again with wine start msys2_shell.bat and update the rest with:

    • $ pacman -Su
  6. After update, if wine start msys2_shell.bat works abnormally, run wine usr/bin/mintty.exe --exec /usr/bin/bash -l instead to work around bug 40482 and 40483.

    Refer to https://msys2.github.io/ for generic Msys2 help.

    Refer to https://wiki.archlinux.org/index.php/pacman for generic pacman help.

Use makepkg to build packages inside Msys2

  1. Install toolchain using pacman

    For example, $ pacman -S --needed base-devel msys2-devel

  2. Start building

    Just checkout the repo with PKGBUILD for the package to build and run makepkg (or makepkg --skippgpcheck if needed).

    Here is an example for building the file package in https://github.com/Alexpux/MSYS2-packages/tree/master/file

    Firstly, use git to checkout https://github.com/Alexpux/MSYS2-packages

    Then, in MSYS2, cd to the directory of file package:

    $ cd /path/to/MSYS2-packages/file

    Then, try makepkg -f -s --skippgpcheck --noconfirm

    The file package should compile and pack correctly on latest Wine Staging.

    Refer to http://sourceforge.net/p/msys2/wiki/Contributing%20to%20MSYS2/ for MSYS2 makepkg and makepkg-mingw help.

    Refer to https://wiki.archlinux.org/index.php/Makepkg for generic makepkg help.

Use Msys2 in Tea CI:

We created https://www.tea-ci.org for Windows open source application developers.

Examples:

http://tea-ci.org/Alexpux/MSYS2-packages

http://tea-ci.org/Alexpux/MINGW-packages

Documentation: https://docs.tea-ci.org/usage/overview/

Project Build Status
LibrePilot Build Status
winpty Build Status
Merkaartor Build Status
MAME Build Status
MyPaint Build Status
libbsdf Build Status
BSDFProcessor Build Status
Lucciefr Build Status

Feel free to share Tea CI to more open source developers. Please add your project to this wiki page as a collection. Join https://gitter.im/TeaCI/drone for discussion about Tea CI.

OUTDATED Use Msys2 in Travis CI:

OUTDATED: Please help us port build configurations from Travis CI to Tea CI

Travis CI is a continuous integration platform, supports Linux and OS X. Travis CI provides free service to open source projects.

Here is a demo for how to build the elinks package in Msys2 on top of Wine in Travis CI: https://travis-ci.org/fracting/elinks In the above demo, we collect all known workarounds together in a set of script, which makes normal users' life easier. Refer to https://github.com/fracting/elinks/blob/master/.travis.yml for more details. The command line interface of our script set is not stable yet, we will document more details once we have a stable interface.

Build Status
Project Msys2 MinGW32 MinGW64
elinks Build Status
irssi Build Status
jhbuild Build Status
tmux Build Status
cython Build Status
rust Build Status
depot_tools Build Status
make Build Status
libffi Build Status
libtre Build Status
nanorc Build Status
conemu Build Status
pax Build Status
repman Build Status
ssh-pageant Build Status
vimpager Build Status
mingw-w64-headers Build Status Build Status
ansicon Build Status
xz Build Status Build Status
ctpl Build Status
dcadec Build Status
dlfcn Build Status
libmongoose Build Status
libmodbus Build Status
libtre Build Status Build Status
libusb-compat Build Status
luajit Build Status
nanovg Build Status
ntldd Build Status
octopi Build Status
rtmpdump Build Status

What works and what doesn't:

  • mintty.exe, vim.exe, emacs.exe, gcc.exe, clang.exe, make.exe, strace.exe, gdb.exe, autoreconf, file.exe, git.exe, xz.exe, bsdtar.exe and many other tools works.

  • winpty.exe does not work. There is a workaround: WINPTY_SHOW_CONSOLE=1

  • performance is not perfect, see performance bugs

  • Cygwin works as well if filesystem is mounted as noacl or mktemp() issue is worked around on Wine.

  • Search wine-staging bugzilla for known bugs. If you find bugs which aren't in the search result, please report one and CC fracting AT gmail DOT com.

Notes for Valgrind users:

It is very useful to use Valgrind + Wine to discovery memory bug of Win32 software. See also http://wiki.winehq.org/Wine_and_Valgrind

Known bugs and limitations for Wine + Valgrind:

To do:

  • Compile and run test suites of all Msys2 packages on top of Wine. See also http://wiki.winehq.org/UnitTestSuites

  • Use c-reduce to convert failure test suite into simplified minimal test case for Wine, integrate c-reduce with CI platform.

  • Upstream our CI build scripts to open source projects.

  • Set up a build bot on Appveyor CI (for Windows, as comparison build). Improve Travis CI build, or investigate customer Drone CI build environment to support Msys2. Run regression tests for every commit to catch bugs in first minute.

  • Implement Wine based build slaver, upstream to Jenkins, buildbot, Drone CI, GitLab CI, etc.

  • Hack Wine + MSYS2 / Wine + Cygwin to provide a Reproducible Build environment.

  • Integrate Wine with Docker, with Mozilla Record Replay pre-installed, Valgrind pre-installed, Dr. Memory pre-installed, etc. Provide an out of box debugging / testing environment for Windows developers through Docker Machine.

  • Improve performance.

  • Full stack on Wine!