I’m not sure if the Wine in apt is multilib so for this I recommend building from source as described below.

My Linux environment Mint 17.1

GCC 5.3 (Don’t use 5.2)

My Windows environment Windows 10

MSVC2015 Update 1

Windows SDK 10

Configuring wine may fail if libraries are missing, and libfreetype doesn’t like having 32 and 64bit libraries simultaneously. The environment variable WINEPREFIX only uses absolute paths, so change all instances of "/home/<user>" to your home directory. Wine might complain that you don’t have certain things installed when running winecfg, none are required for this to work.

wine from source cd ~/ mkdir -p wine cd wine mkdir -p 32 64 wget https://ftp.winehq.org/wine/source/1.8/wine-1.8.tar.bz2 tar xf wine-1.8.tar.bz2 cd 64 sudo apt-get install libfreetype6-dev ../wine-1.8/configure --enable-win64 make -j4 cd ../32 sudo apt-get install libfreetype6-dev:i386 ../wine-1.8/configure --with-wine64=../64 make -j4 WINEARCH=win32 ~/wine/64/wine winecfg WINEPREFIX=/home/<user>/.wine64 ~/wine/64/wine64 winecfg

maiken from source cd ~/ mkdir -p tmp cd tmp git clone http://github.com/dekken/maiken.git -b 0.7.7 maiken cd maiken make nix LDFLAGS="-pthread -static" ./mkn build -dtKa "-O2 -std=c++14 -D__KUL_OS__=\"win\" -D_MKN_REMOTE_EXEC_=0" -l -pthread mv ./bin/build/mkn mkn_nix2win touch ~/.maiken/win32.yaml ~/.maiken/win64.yaml

Edit ~/.maiken/win32.yaml and ~/.maiken/win64.yaml so they have the appropriate paths for your MSVC installation.

File: ~/.maiken/win32.yaml local: repo: ~/.maiken/repos/win inc: /path/to/win10SDK/Include/10.0.10240.0/ucrt /path/to/win10SDK/Include/10.0.10240.0/um /path/to/win10SDK/Include/10.0.10240.0/shared /path/to/VSC15/VC/include path: /path/to/win10SDK/Lib/10.0.10240.0/um/x86 /path/to/win10SDK/Lib/10.0.10240.0/ucrt/x86 /path/to/VSC15/VC/lib env: - name: PATH mode: prepend value: ~/wine/64:/path/to/VSC15/VC/bin - name: WINEDEBUG mode: replace value: -all file: - type: cpp:c compiler: wine wait4 cl archiver: wine wait4 lib linker: wine wait4 link

File: ~/.maiken/win64.yaml local: repo: ~/.maiken/repos/win inc: /path/to/win10SDK/Include/10.0.10240.0/ucrt /path/to/win10SDK/Include/10.0.10240.0/um /path/to/win10SDK/Include/10.0.10240.0/shared /path/to/VSC15/VC/include path: /path/to/win10SDK/Lib/10.0.10240.0/um/x64 /path/to/win10SDK/Lib/10.0.10240.0/ucrt/x64 /path/to/VSC15/VC/lib/amd64 env: - name: PATH mode: prepend value: ~/wine/64:/path/to/VSC15/VC/bin/amd64 - name: WINEPREFIX mode: replace value: /home/<user>/.wine64 - name: WINEDEBUG mode: replace value: -all file: - type: cpp:c compiler: wine64 wait4 cl archiver: wine64 wait4 lib linker: wine64 wait4 link

Wine passes the execution string to wineserver and the process exits, so we use an intermediary process to wait for child processes to finish.

wait4 cd ~/tmp mkdir -p wine32 wine64 cd wine32 wget https://github.com/Dekken/wait4/raw/master/bin/win_x86/wait4.exe mv wait4.exe ~/.wine/drive_c/windows/system32 cd ../wine64 wget https://github.com/Dekken/wait4/raw/master/bin/win_x64/wait4.exe mv wait4.exe ~/.wine64/drive_c/windows/system32

Get required dlls for x86/x64 listed in the registry file below. If you have MSVC2015 installed you should have them locally. Copy them to to their respective system32 directories.

x86: ~/.wine/drive_c/windows/system32

x64: ~/.wine64/drive_c/windows/system32

File: wine.reg REGEDIT4 [HKEY_CURRENT_USER\Software\Wine\DllOverrides] "api-ms-win-crt-locale-l1-1-0"="native" "api-ms-win-crt-runtime-l1-1-0"="native" "api-ms-win-crt-stdio-l1-1-0"="native" "api-ms-win-crt-heap-l1-1-0"="native" "api-ms-win-crt-conio-l1-1-0"="native" "msvcp140"="native" "vcruntime140"="native" "ucrtbase"="native"

Then run the registry file as follows:

~/wine/64/wine regedit wine.reg WINEPREFIX=/home/<user>/.wine64 ~/wine/64/wine64 regedit wine.reg

We could use the same WINEPREFIX for both x86 and x64, but we need separate PATH variables so we split them. Configuring your windows PATH can be done directly editing the file user.reg.

File: ~/.wine/user.reg [Environment] 1451517826 #time=1d143592182f07e "PATH"="/path/to/VSC15U1/VC/bin"

File: ~/.wine64/user.reg [Environment] 1451517826 #time=1d143592182f07e "PATH"="/path/to/VSC15U1/VC/bin/amd64

Or running regedit for each version and editing the HKEY_CURRENT_USER → Environment → New String value

32 ~/wine/64/wine regedit 64 WINEPREFIX=/home/<user>/.wine64 ~/wine/64/wine64 regedit

Now you should be able to build a Windows maiken binary on linux

cd ~/tmp/maiken/ KLOG=3 ./mkn_nix2win clean -dx win32 cd ~/.maiken/repos/win/google/sparsehash/2.0.3 ~/wine/64/wine cmd mkn.bat cd ~/tmp/maiken KLOG=3 ./mkn_nix2win clean build -dtKa -EHsc -x win32

64bit works sometimes, but doesn’t for maiken, a bug has been created on WineHQ.

To see for yourself run