Skip to content

Compile minimap2 for Windows

Philippe Bordron edited this page Nov 21, 2023 · 15 revisions

On Linux (cross compilation)

Tested on manjaro with minimap-2.24 and debian with minimap-2.26

Install MinGW

On arch-like linux:

sudo pacman -Su mingw-w64
yay -S mingw-w64-zlib

On debian-like linux

sudo apt update
sudo apt install make mingw-w64 libz-mingw-w64-dev

Get minimap2

Download and extract minimap2 zip file from the repository

Compilation

In a terminal, go to minimap2 source folder.

Launch:

make CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ AR=x86_64-w64-mingw32-ar CFLAGS="-g -Wall -O2 -Wc++-compat -static"

Copy minimap2.exe file in a folder. It is a static executable, there is no need to copy dependencies.

Testing

On Linux systems, minimap2.exe can be tested with wine (Minimap2 2.24 was successfully tested with wine-7.0-rc2 - Staging release).


On Windows itself

Original author: Floréal Cabanettes (@florealcab)

We use MSYS2 to do that.

Install MSYS2

Download MSYS2 and install it.

Run MSYS2 executable. It may take a while. Upgrade the system:

pacman -Syu

If needed, close MSYS2, run it again from Start menu. Update the rest with:

pacman -Su

Install dependencies

With pacman, install gcc, make, base-devel, zlib and zlib-devel:

pacman -S gcc make base-devel zlib zlib-devel

Check if ad.exe (and other files present in the usr/x86_64-pc-msys/bin folder inside the msys install folder) are also present in usr/bin. Else copy them (and rename ld.bfd.exe ld.exe inside the usr/bin folder). This problem occurs on fat system. NTFS should not cause it.

Get minimap2

Download and extract minimap2 zip file from the repository

Compilation

Start MSYS2 console, go to minimap2 source folder.

Launch:

make

Copy minimap2.exe file in a folder. Copy in the same folder msys-2.0.dll and msys-z.dll files from the usr/bin folder of the MSYS2 install folder.

That's right! Always keep minimap2.exe in the same folder as the dll files.