Building MultiChain for Windows requires working with two separate development environments:
- Visual Studio 2017 on Native Windows
- GCC MinGW cross compiler on Linux
In different stages of the build, build artifacts from one environment need to be available to the other environment. If possible, sharing a single physical file system is most helpful. Otherwise, files need to be copied between the two file systems (e.g. scp on Linux, pscp from Putty or WinSCP on Windows).
In the reminder of these instructions we assume that the the following variables have the associated meaning:
Variable | Meaning |
---|---|
MULTICHAIN_HOME |
Root folder of MultiChain |
LINUX_FS |
Location in Linux where Windows files can be copied to |
Variables on Windows are referenced by %VAR%
, and on Linux by $VAR
or ${VAR}
.
- Visual Studio 2017 (community edition acceptable)
- Python 2.7
- Git
- CMake
- Boost, with binaries for release,multithreading,static (suffix is -mt-s)
sudo apt update
sudo apt install -y libtool autotools-dev automake pkg-config git
sudo apt install -y g++-mingw-w64-x86-64 mingw-w64-x86-64-dev
On Linux:
-
In the location where you want to build MultiChain:
git clone https://github.com/MultiChain/multichain.git cd multichain export MULTICHAIN_HOME=$(pwd)
###Prepare a build area on the Windows machine
On Windows:
-
In the location where you want to build MultiChain:
git clone https://github.com/MultiChain/multichain.git cd multichain set MULTICHAIN_HOME=%CD%
On Windows:
cd %MULTICHAIN_HOME%
mkdir v8build
cd v8build
-
Follow the instructions in v8_win.md to fetch, configure and build Google's V8 JavaScript engine.
-
To build an additional library required by MultiChain, copy the following files to
$LINUX_FS
on Linux:%MULTICHAIN_HOME%\v8build\v8\out.gn\x64.release\*.bin %MULTICHAIN_HOME%\v8build\v8\out.gn\x64.release\*.dat
On Linux:
cd $LINUX_FS
objs=()
for f in *.bin *.dat; do
objcopy -B i386 -I binary -O elf64-x86-64 $f ${f%.*}.obj
objs+=("${f%.*}.obj")
done
x86_64-w64-mingw32-ar rvs v8_data.lib ${objs[@]}
- Copy
v8_data.lib
to%MULTICHAIN_HOME%\v8build\v8\out.gn\x64.release\obj
on Windows.
On Windows:
cd %MULTICHAIN_HOME%\src\v8_win
mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" ..
cmake --build . --config Release --target spdlog
cmake --build . --config Release
- Copy
%MULTICHAIN_HOME%\src\v8_win\build\Release\multichain_v8.lib
to$MULTICHAIN_HOME/src/v8_win/build/Release
on Linux. - Copy
%MULTICHAIN_HOME%\src\v8_win\build\Release\multichain_v8.dll
to%MULTICHAIN_HOME%\src
(on local Windows).
On Linux:
cd $MULTICHAIN_HOME
./autogen.sh
cd depends
make HOST=x86_64-w64-mingw32
cd ..
./configure --prefix=$(pwd)/depends/x86_64-w64-mingw32 --enable-cxx --disable-shared --enable-static --with-pic
make
- This will build
multichaind.exe
,multichain-cli.exe
andmultitchain-util.exe
in thesrc
directory1. - Copy
src/multichaind.exe
,src/multichain-cli.exe
andsrc/multitchain-util.exe
to%MULTICHAIN_HOME%\src
on Windows.
On Windows:
cd %MULTICHAIN_HOME%
src\multichaind.exe --help
- If all went well, you should see the expected help text from the program.
Footnotes
-
If you have more than one CPU on your machine, you can add the
-j #
flag to the last command (make
). ↩