Skip to content

Compiling on Windows

Andrey Zholos edited this page Nov 24, 2016 · 4 revisions

With Cygwin

Run either setup-x86.exe or setup-x86_64.exe (either works on w64) from http://cygwin.com to install Cygwin.

Required packages:

  • make
  • patch
  • python
  • perl (for --build-openblas)
  • curl or wget
  • mingw-gcc-fortran or
    mingw64-i686-gcc-fortran (for w32)
  • mingw64-x86_64-gcc-fortran (for w64)
$ cd /cygdrive/c/Users/.../qml
$ ./configure --build-blas
$ make

With MSYS and MinGW

MSYS and MinGW come from the same project. The compiler is only for w32.

Run mingw-get-setup.exe from http://www.mingw.org to install MSYS and MinGW.

Required packages (bin class):

  • msys-base
  • msys-patch
  • msys-perl (for --build-openblas)
  • msys-wget
  • msys-openssl (for sha256sum)
  • mingw32-gcc-fortran

Run C:\MinGW\msys\1.0\msys.bat to start the shell.

$ mount C:/MinGW /mingw
$ cd /C/Users/.../qml
$ ./configure --build-blas
$ make

With MSYS and MinGW-w64

MinGW-w64 is a separate project. The compilers are for both w32 and w64.

Run mingw-get-setup.exe from http://www.mingw.org to install MSYS.

Required packages (bin class):

  • msys-base
  • msys-patch
  • msys-perl (for --build-openblas)
  • msys-wget
  • msys-openssl (for sha256sum)

Run mingw-w64-install.exe from http://mingw-w64.sourceforge.net under "Mingw-builds" to install MinGW-w64. Choose 32-bit or 64-bit to match q. Choose "win32" threads to avoid a runtime depencency on libwinpthread-1.dll.

Run C:\MinGW\msys\1.0\msys.bat to start the shell.

$ mount C:/Progra~1/mingw-w64/.../mingw?? /mingw-w64  # no spaces
$ export PATH=$PATH:/mingw-w64/bin:/mingw-w64/opt/bin
$ cd /C/Users/.../qml
$ ./configure --build-blas
$ make

With MSYS2

MSYS2 is an independent rewrite of MSYS. It includes MinGW-w64 compilers for both w32 and w64.

Follow instructions at https://msys2.github.io to install MSYS2. Choose 32-bit or 64-bit to match Windows, not q.

Required packages:

  • tar
  • make
  • patch
  • mingw-w64-i686-gcc-fortran (for w32)
  • mingw-w64-x86_64-gcc-fortran (for w64)
$ export PATH=$PATH:/mingw32/bin:/mingw64/bin
$ cd /C/Users/.../qml
$ ./configure --build-blas
$ make

DLL dependencies

Although the qml build system tries to avoid this, sometimes qml.dll gets built with runtime dependencies on DLLs from the build environment (i.e. Cygwin or MinGW DLLs).

DLL dependencies can be listed with:

$ objdump -p qml.dll | grep 'DLL Name'
        DLL Name: q.exe
        DLL Name: KERNEL32.dll
        DLL Name: msvcrt.dll
        DLL Name: USER32.dll

If this lists anything other than q.exe and Windows system DLLs as shown above, the locations of those DLLs must be added to the Windows PATH.

In particular, binaries built with MinGW-w64 with "posix" threads (the default) depend on libwinpthread-1.dll. To avoid this, use MinGW-w64 with "win32" threads, as described under With MSYS and MinGW-w64.