Skip to content

Commit

Permalink
Merge pull request MultiChain#85 from MultiChain/2.0-dev
Browse files Browse the repository at this point in the history
2.0 beta 2
  • Loading branch information
mike31 authored Feb 11, 2019
2 parents e4c61e1 + ae14a41 commit f3d4287
Show file tree
Hide file tree
Showing 280 changed files with 5,222 additions and 876 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,10 @@ v8build
*.creator
*.files
*.includes

.idea/
cmake-build-debug
x86_64-w64-mingw32
*.dll

!depends/clang_fix.config
95 changes: 24 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ MultiChain

[MultiChain](http://www.multichain.com/) is an open source platform for private blockchains, which offers a rich set of features including extensive configurability, rapid deployment, permissions management, native assets and data streams. Although it is designed to enable private blockchains, MultiChain provides maximal compatibility with the bitcoin ecosystem, including the peer-to-peer protocol, transaction/block formats and [Bitcoin Core](https://bitcoin.org/en/bitcoin-core/) APIs/runtime parameters.

Copyright (c) 2014-2017 Coin Sciences Ltd
Copyright (c) 2014-2019 Coin Sciences Ltd
License: GNU General Public License version 3, see COPYING

Portions copyright (c) 2009-2016 The Bitcoin Core developers
Expand All @@ -24,22 +24,35 @@ Install dependencies
--------------------

sudo apt-get update
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils
sudo apt-get install libboost-all-dev
sudo apt-get install git
sudo apt-get install software-properties-common
sudo apt-get install -y software-properties-common
sudo apt-get install -y build-essential libtool autotools-dev automake pkg-config libssl-dev git python python-pip
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev
sudo apt-get install -y libdb4.8-dev libdb4.8++-dev
sudo pip install pathlib2

MultiChain requires Boost version no later than 1.65.

sudo apt-get install -y libboost1.65-all-dev

Clone MultiChain
----------------

Build Google's V8 JavaScript engine locally
-------------------------
git clone https://github.com/MultiChain/multichain.git

Please use the instructions in [V8.md](/V8.md/) to build and install V8 for use by MultiChain.
Prepare to download or build V8
-------------------

cd multichain
set MULTICHAIN_HOME=$(pwd)
mkdir v8build
cd v8build

You can use pre-built headers and binaries of Google's V8 JavaScript engine by downloading and expanding [linux-v8.tar.gz](https://github.com/MultiChain/multichain-binaries/raw/master/linux-v8.tar.gz) in the current directory. If, on the other hand, you prefer to build the V8 component yourself, please follow the instructions in [V8.md](/V8.md/).

Compile MultiChain for Ubuntu (64-bit)
-----------------------------

cd $MULTICHAIN_HOME
./autogen.sh
./configure
make
Expand All @@ -61,64 +74,4 @@ Please see the instructions in [win.md](/win.md/) to build MultiChain for use wi
Mac Build Notes (on MacOS Sierra)
================

Install dependencies
--------------------

Install XCode and XCode command line tools
Install git from git-scm
Install brew (follow instructions on brew.sh)
brew install autoconf automake berkeley-db4 libtool boost openssl pkg-config rename

on MacOS High Sierra

brew uninstall boost
brew install [email protected]
brew link [email protected] --force

Prepare for static linking
--------------------------
Apple does not support statically linked binaries as [documented here](https://developer.apple.com/library/content/qa/qa1118/_index.html), however, it is convenient for end-users to launch a binary without having to first install brew, a third-party system designed for developers.

To create a statically linked MultiChain which only depends on default MacOS dylibs, the following steps are taken:

1. Hide the brew boost dylibs from the build system:
rename -e 's/.dylib/.dylib.hidden/' /usr/local/opt/boost/lib/*.dylib

2. Hide the brew berekley-db dylibs from the build system:
rename -e 's/.dylib/.dylib.hidden/' /usr/local/opt/berkeley-db\@4/lib/*.dylib

3. Hide the brew openssl dylibs from the build system:
rename -e 's/.dylib/.dylib.hidden/' /usr/local/opt/openssl/lib/*.dylib

The default brew cookbook for berkeley-db and boost builds static libraries, but the default cookbook for openssl only builds dylibs.

3. Tell brew to build openssl static libraries:
brew edit openssl
In 'def configure_args' change 'shared' to 'no-shared'
brew install openssl --force



Compile MultiChain for Mac (64-bit)
--------------------------

export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include
./autogen.sh
./configure --with-gui=no --with-libs=no --with-miniupnpc=no
make

Clean up
--------

rename -e 's/.dylib.hidden/.dylib/' /usr/local/opt/berkeley-db\@4/lib/*.dylib.hidden
rename -e 's/.dylib.hidden/.dylib/' /usr/local/opt/boost/lib/*.dylib.hidden
rename -e 's/.dylib.hidden/.dylib/' /usr/local/opt/openssl/lib/*.dylib.hidden
brew edit openssl
In 'def configure_args' change 'no-shared' to 'shared'

Notes
-----

* This will build `multichaind`, `multichain-cli` and `multichain-util` in the `src` directory.

Please see the instructions in [mac.md](/mac.md/) to build MultiChain for use with MacOS.
69 changes: 36 additions & 33 deletions V8.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@


# Fetching, Building and Installing V8 (On Ubuntu 16.04 x64 or later)

The following instructions fetch the Google V8 JavaScript engine to your local machine, configure it to create static libraries, and install the resulting artifacts to the location where the MultiChain build system expects to find them.
The following instructions fetch the Google V8 JavaScript engine to your local machine and configure it to create static libraries in the location where the MultiChain build system expects to find them.

MultiChain uses V8 version 6.8, and requires at least 4 GB of RAM to build in a reasonable time. It will not build at all with less than 2 GB RAM.

## Install dependencies

sudo apt-get update
sudo apt-get -y install git python pkg-config build-essential

## Clone Google's depot_tools

Google's [depot_tools](http://dev.chromium.org/developers/how-tos/install-depot-tools) are used by the Google build system to manage Git checkouts.

git clone --depth=1 https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=${PATH}:$(pwd)/depot_tools

## Fetch V8

The following commands check out V8 and select the branch used by MultiChain. Please note that this step downloads about 2 GB of data, and can take a long time (30 minutes or more).

gclient
fetch v8
cd v8
git checkout 6.8-lkgr
git checkout 6.8.290

## Configure V8
## Configure and build V8

The V8 build system currently uses a proprietary version of the Ninja build system, called GN. It is part of the `depot_tools` installed earlier.

Expand All @@ -42,34 +40,39 @@ The V8 build system currently uses a proprietary version of the Ninja build syst
use_custom_libcxx = false
use_custom_libcxx_for_host = false
END


The selected release of the V8 sources requires relaxing two compiler checks to prevent compilation errors.

- Open the file `build/config/compiler/BUILD.gn` in your favorite editor.
- Locate the folllowing lines (currently at **1464**):

if (is_clang) {
cflags += [
- Add the following two lines to **the end** of the block and save the file:

"-Wno-defaulted-function-deleted",
"-Wno-null-pointer-arithmetic",

Build the V8 libraries:

gn gen $RELEASE
ninja -C $RELEASE v8 d8

## Build and install V8
Create an additional library embedding the V8 initial snapshot blobs:

The Ninja command builds the V8 libraries and data files. The installation location (`${HOME}/local/v8`) is currently hard-coded into the MultiChain build system. This will change soon in a future Alpha release.
sudo easy_install pip
pip install pathlib2
cd $RELEASE
python $MULTICHAIN_HOME/depends/v8_data_lib.py

ninja -C $RELEASE

LIB_DIR=${RELEASE}/obj
PREFIX=${HOME}/local/v8

pushd ${LIB_DIR}
mkdir full
for lib in libv8*.a;
do ar -t $lib | xargs ar rvs $lib.new && mv -v $lib.new full/$lib;
done
cd third_party/icu
mkdir full
for lib in *.a;
do ar -t $lib | xargs ar rvs $lib.new && mv -v $lib.new full/$lib;
<!--
cd $RELEASE
objs=()
for f in *.bin *.dat; do
objcopy -B i386 -I binary -O elf64-x86-64 $f obj/${f%.*}.o
objs+=("${f%.*}.o")
done
popd

rm -rf $PREFIX
mkdir -p $PREFIX/include/libplatform $PREFIX/lib $PREFIX/data
install -m 644 -vt $PREFIX/include include/*.h
install -m 644 -vt $PREFIX/include/libplatform include/libplatform/*.h
install -m 644 -vt $PREFIX/lib $LIB_DIR/full/libv8*.a $LIB_DIR/third_party/icu/full/*.a
install -vt $PREFIX/data $RELEASE/*.bin $RELEASE/icudtl.dat

cd obj
ar rvs libv8_data.a ${objs[@]}
-->
61 changes: 61 additions & 0 deletions V8_mac.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Fetching, Building and Installing V8 (on MacOS Sierra)

The following instructions fetch the Google V8 JavaScript engine to your local machine and configure it to create static libraries in the location where the MultiChain build system expects to find them.

MultiChain uses V8 version 6.8, and requires at least 4 GB of RAM to build in a reasonable time. It will not build at all with less than 2 GB RAM.

## Clone Google's depot_tools

Google's [depot_tools](http://dev.chromium.org/developers/how-tos/install-depot-tools) are used by the Google build system to manage Git checkouts.

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
cd depot_tools
git checkout af2ffd933d0e6d8b5bd8c48be7a2b2d568a5eea2
cd ..
export PATH=${PATH}:$(pwd)/depot_tools

## Fetch V8

The following commands check out V8 and select the branch used by MultiChain. Please note that this step downloads about 2 GB of data, and can take a long time (30 minutes or more).

gclient
fetch v8
cd v8
git checkout 6.8.290

## Configure and build V8

The V8 build system currently uses a proprietary version of the Ninja build system, called GN. It is part of the `depot_tools` installed earlier.

find . -name BUILD.gn -exec sed -i bak '/exe_and_shlib_deps/d' {} \;
pushd base/trace_event/common
git checkout 211b3ed9d0481b4caddbee1322321b86a483ca1f
popd
RELEASE=out.gn/x64.release
gn gen $RELEASE --args='is_debug=false target_cpu="x64" v8_static_library=true is_component_build=false use_custom_libcxx=false use_custom_libcxx_for_host=false'

The selected release of the V8 sources requires relaxing two compiler checks to prevent compilation errors.

- Open the file `build/config/compiler/BUILD.gn` in your favorite editor.

- Locate the folllowing lines (currently at **1464**):

if (is_clang) {
cflags += [
- Add the following two lines to **the end** of the block and save the file:

"-Wno-defaulted-function-deleted",
"-Wno-null-pointer-arithmetic",

Build the V8 libraries:

gn gen $RELEASE
ninja -C $RELEASE v8 d8

Create an additional library embedding the V8 initial snapshot blobs:

brew install python
pip install pathlib2
cd $RELEASE
python $MULTICHAIN_HOME/depends/v8_data_lib.py
59 changes: 36 additions & 23 deletions V8_win.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,66 @@ Building Google's V8 on Windows can only be done inside a Windows command prompt

It requires the following software:

- Visual Studio 2017 - the community edition is fine
- Python 2.7
- Git
- [Visual Studio 2017](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=15) (community edition acceptable)
- [Python 2.7](https://www.python.org/ftp/python/2.7.15/python-2.7.15.amd64.msi)
- [Git](https://github.com/git-for-windows/git/releases/download/v2.19.1.windows.1/Git-2.19.1-64-bit.exe)

- Add the Debugging Tools For Windows:

- Control Panel → Programs → Programs and Features → Select the "Windows Software Development Kit" → Change → Change → Check "Debugging Tools For Windows" → Change

The steps described in this document have to be executed in a shell configured for Visual Studio 64 bit (<u>Start</u> / <u>Visual Studio 2017</u> / <u>x64 Native Tools Command Prompt</u>).

# Fetching, Building and Installing V8

The following instructions fetch the Google V8 JavaScript engine to your local machine, configure it to create static libraries, and builds them.

MultiChain uses V8 version 6.8, and requires at least 4 GB of RAM to build in a reasonable time. It will not build at all with less than 2 GB RAM.
MultiChain uses V8 version 6.8.290, and requires at least 4 GB of RAM to build in a reasonable time. It will not build at all with less than 2 GB RAM.

## Get Google's `depot_tools`

Google's [`depot_tools`](http://dev.chromium.org/developers/how-tos/install-depot-tools) are used to manage Git checkouts and the build system.

- Download [https://storage.googleapis.com/chrome-infra/depot\_tools.zip]() and expand the archive to the current directory.
- Edit the PATH environment variable and insert the full path of `depot_tools` **before** the installed `python.exe`.
- Execute `where python` to make sure that `depot_tools\python.bat` indeed comes *before* `python.exe`.
- Download https://storage.googleapis.com/chrome-infra/depot_tools.zip and expand the archive to the current directory.
- Edit the PATH environment variable and insert the full path of `depot_tools` **before** the installed `python.exe` and `git.exe`.
- Set the environment variable `DEPOT_TOOLS_WIN_TOOLCHAIN=0`.

## Fetch V8

The following commands check out V8 and select the branch used by MultiChain. Please note that this step downloads about 2 GB of data, and can take a long time (30 minutes or more).

gclient

Execute `where python` to ensure that `depot_tools\python.bat` indeed comes *before* `python.exe`

fetch v8
cd v8
git checkout 6.8.290
pushd base\trace_event\common
git checkout 211b3ed9d0481b4caddbee1322321b86a483ca1f
popd

## Configure and build V8

The V8 build system currently uses a proprietary version of the Ninja build system, called GN. It is part of the `depot_tools` installed earlier.

- Edit the file `BUILD.gn` and remove all lines containing `exe_and_shlib_deps`
- Execute `python tools\dev\v8gen.py x64.release`
- Edit the file `BUILD.gn` and remove all lines containing `exe_and_shlib_deps` (8 occurrences)
- Edit the following files and remove all lines containing `exe_and_shlib_deps`:
- BUILD.gn (8 occurrences)
- test\cctest\BUILD.gn (2 occurrences)
- test\inspector\BUILD.gn (1 occurrence)
- test\mkgrokdump\BUILD.gn (1 occurrence)
- test\unittests\BUILD.gn (2 occurrences)

- Execute `set RELEASE=out.gn\x64.release`
- Edit the file `%RELEASE%\args.gn` to have the following content:

`args.gn`:

is_debug = false
target_cpu = "x64"
v8_static_library = true
is_component_build = false
is_clang = false
v8_enable_object_print = true
treat_warnings_as_errors = false
- Execute `gn args %RELEASE%`, insert the following content, save and exit Notepad:

The folowing steps have to be executed in a shell configured for Visual Studio 64 bit (<u>Start</u> / <u>Visual Studio 2017</u> / <u>x64 Native Tools Command Prompt</u>). There is no harm in performing all the instructions in this document inside such a command shell.
is_debug = false
target_cpu = "x64"
v8_static_library = true
is_component_build = false
is_clang = false
v8_enable_object_print = true
treat_warnings_as_errors = false

- Execute `gn gen %RELEASE%`
- Execute `ninja -C %RELEASE% v8`
- Execute `ninja -C %RELEASE% v8 d8`
10 changes: 10 additions & 0 deletions depends/clang_fix.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"file": "build/config/compiler/BUILD.gn",
"config": "default_warnings",
"flags": [
"-Wno-defaulted-function-deleted",
"-Wno-null-pointer-arithmetic"
]
}
]
Loading

0 comments on commit f3d4287

Please sign in to comment.