Homestead_7 – Details

Documentos Visualizados » Colabora Traduciendo » Homestead_7 – Details

cpp-ethereum

../../_images/cpp_35k9.png ../../_images/ETHEREUM-ICON_Black.png

Quick Start

Details

Current status

We blog about the codebase periodically on the Official Ethereum blog and elsewhere. Here are some recent articles from the development team:

We simplified the project naming at Homestead (March 2016), although some naming shadows of the past still linger. With the homecoming we have another name to retire – webthree-umbrella.

At the time of writing (August 2016), we are just completing our “Homecoming”, where the code has been reconsolidated into the ethereum/cpp-ethereum repository. From October 2015 until August 2016 it was split across multiple repositories under ethereum/webthree-umbrella

The re-licensing plan is the culmination of a very long-term plan to liberalize the core. An effort was begun in 2015 to re-license the cpp-ethereum core as MIT, but it was never completed.

This is a revival of that effort, especially with a view towards the potential for collaboration with theLinux Foundation‘s Hyperledger project, and with other corporations outside of Hyperledger who wish to build Ethereum private/consortium chain solutions similar to HydraChain. The Rubix by Deloitte project is an example of that approach.

Building from source

Overview

The cpp-ethereum codebase lives on Github.com in the cpp-ethereum repository.

Between October 2015 and August 2016 it was split into various repositories which were grouped as sub-modules under the webthree-umbrella repository, and you will likely see many references to webthree-umbrella online. Those all refer to the cpp-ethereum codebase during that period of its development.

We use a common CMake build system to generate platform-specific build files, meaning that the workflow is very similar whatever operating system you use:

  • Install build tools and external packages (these are platform dependent)
  • Clone the source code from the webthree-umbrella git repository
  • Run CMake to generate a build file (makefile, Visual Studio solution, etc)
  • Build it

Platform-specific instructions

Building for Linux

Clone the repository

To clone the source code, execute the following commands:

git clone --recursive https://github.com/ethereum/cpp-ethereum.git
cd cpp-ethereum

Installing dependencies

Linux has a horror-show of fragmentation when it comes to packaging systems.

We support a “one-button” bash script which attempts to make this minefield more navigable for users of common distros. It identifies your distro and installs the external packages which you will need, using whatever combination of package servers and build-from-source is required for your specific distro version. This is a non-trivial task, but by that token is also something which we don’t want anybody to have to replicate themselves.

./scripts/install_deps.sh

We use the same script within our Appveyor and TravisCI automated builds and automated runs, so it is continuously tested, which is especially important on macOS, where Homebrew is a constantly moving target.

The script is known to support the following distros and versions:

  • Mac (OS X Mavericks, OS X Yosemite, OS X El Capitan, macOS Sierra)
  • Arch Linux
  • Alpine Linux (partial)
  • Debian (Jesse and Stretch)
  • Fedora (partial)
  • Mint Linux (Qiana, Rebecca, Rafaela, Rosa, Sarah)
  • Ubuntu (Trusty, Vivid, Utopic, Xenial, work-in-progress on Yakkety)

If you try it, and it doesn’t work for you, please report the problem with details of your distro, your version number and any other important details and we can work together to get it working for your use-case.

We have manual instructions for Fedora, openSUSE and Arch Linux (see below). If you using some other distro then please contact us and we’ll see if we can get you going.

Build on the command-line

When you have installed your dependencies you can build.

mkdir build                                              Make a directory for the build output
cd build                                                 Switch into that directory

cmake ..                                                 To generate a makefile.
make                                                     To build that makefile on the command-line
make -j<number>                                          (or) Execute makefile with multiple cores in parallel

32-bit Linux builds

We have cpp-ethereum building and running successfully on many 32-bit Linux distros, with the main constraint being the availability of external dependencies in 32-bit variants. Probably the most active demand here is for single-board computers like the Raspberry Pi family.

You will need to disable the JIT and the heavy-weight LLVM dependency which comes with that. EVMJIT only supports x86_64. Other than that, cpp-ethereum should “just work” on 32-bit platforms. To disable JIT, you will need to use the following command for the Makefile generation phase:

cmake .. -DEVMJIT=Off

Installing dependencies for Fedora

Fedora 20

Steps:

yum install git automake autoconf libtool cmake gcc gcc-c++ xkeyboard-config 
        leveldb-devel boost-devel gmp-devel cryptopp-devel miniupnpc-devel 
        qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtquick1-devel qt5-qtwebkit-devel 
        mesa-dri-drivers snappy-devel ncurses-devel readline-devel curl-devel 
        python-devel

Fedora 21

Steps:

yum install git automake autoconf libtool cmake gcc gcc-c++ xkeyboard-config 
        leveldb-devel boost-devel gmp-devel cryptopp-devel miniupnpc-devel 
        qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtquick1-devel qt5-qtwebkit-devel 
        mesa-dri-drivers snappy-devel ncurses-devel readline-devel curl-devel 
        python-devel jsoncpp-devel argtable-devel

Build json-rpc from github as per https://github.com/ethereum/cpp-ethereum/issues/617:

git clone https://github.com/cinemast/libjson-rpc-cpp
cd libjson-rpc-cpp
git checkout tags/v0.3.2
mkdir -p build
cd build
cmake .. && make
sudo make install
sudo ldconfig

Fedora 22

Fedora 22 dependencies there may be more depends what you have already installed:

dnf install git automake autoconf libtool cmake gcc gcc-c++ xkeyboard-config 
leveldb-devel boost-devel gmp-devel cryptopp-devel miniupnpc-devel 
mesa-dri-drivers snappy-devel ncurses-devel readline-devel curl-devel 
python-devel jsoncpp-devel argtable-devel

Install gcc version 4.9! Fedora 22 comes with a different compiler (CC v5.3). This one wont compile webthree-umbrella 4 me so i installed gcc version 4.9 from SRC!

Check that you have a working gcc4.9 install in /usr/local i installed it in /home/app/gcc49 its your choice read manual how to compile gcc in google! After that you have to compile everything you need 4 webthree-umbrella with gcc4.9 so before every cmake:

export CXX=/home/app/gcc49/bin/g++
    export CC=/home/app/gcc49/bin/gcc

With this you use gcc4.9 to compile instead of the one that comes with the distro F22. Its not recommended to uninstall the compiler that comes with your distro! You can also work with symlinking.

Install from Fedora COPR REPO LLVM3.7 with:

dnf copr enable alonid/llvm-3.7
dnf install llvm-3.7 llvm-3.7-devel llvm-3.7-static llvm-3.7-libs

I had to do this because Fedora 22 comes with llvm-3.5 from stock repos! There may be other solutions but this one worked 4 me

Install CryptoPP from SRC https://github.com/weidai11/cryptopp CRYPTOPP_5_6_2:

git clone https://github.com/weidai11/cryptopp
cd cryptopp
git checkout release/CRYPTOPP_5_6_2
mkdir build
cd build
export CXX=/home/app/gcc49/bin/g++ <- be sure to compile with gcc4.9
export CC=/home/app/gcc49/bin/gcc <- be sure to compile with gcc4.9
cmake ..
make
make install

Install QT5 from COPR “dnf copr enable @kdesig/Qt5” newer QT5 version:

dnf install qt5-*

this should install QT5 version 5.6.0 in COPR repo are other QT5. Packages from other users i didnt test them

Install qtwebengine from https://github.com/qtproject/qtwebengine i installed version 5.6.0 others may also work find it out 😀

git clone https://github.com/qtproject/qtwebengine
cd qtwebengine
git checkout release/v5.6.0
qmake-qt5 <- in other distros its just called qmake in fedora 22 qmake-qt5
make
make install

Install json-rpc from github https://github.com/ethereum/cpp-ethereum/issues/617:

git clone https://github.com/cinemast/libjson-rpc-cpp
cd libjson-rpc-cpp
git checkout tags/v0.4.2
mkdir -p build
cd build
export CXX=/home/app/gcc49/bin/g++ <- be sure to compile with gcc4.9
export CC=/home/app/gcc49/bin/gcc <- be sure to compile with gcc4.9
cmake .. && make
sudo make install
sudo ldconfig

Be sure to check if jsonrpcstub works in console enter “jsonrpcstub” and look if its responding. If it answers No Argument or s-l-t it works but if you get no such file to blabla.so you have to symlinking the missing ones to your libs dir /usr/local/lib64 or usr/local/lib depends where the file blabla.so is try to find it with “updatedb” and than “locate blabla.so”

Try to compile now it should work if not there a missing symlinks cause of no such file easyfix or there are some missing Packages try to find them with dnf like this “dnf search packname*” or “dnf list packname*” all i can say its not a 5 min compile of webthree-umbrella enjoy Tflux99.

Installing dependencies for openSUSE

Here is how to get the dependencies needed to build the latest webthree-umbrella on OpenSUSE. This was done on Leap 42.1, but there should be equivalent packages available for Tumbleweed and 13.x.

First install dependencies provided by the main repos:

zypper in git automake autoconf libtool cmake gcc gcc-c++ 
    xkeyboard-config leveldb-devel boost-devel gmp-devel 
    cryptopp-devel libminiupnpc-devel libqt5-qtbase-common-devel 
    libqt5-qtdeclarative-devel libQTWebKit-devel libqt5-qtwebengine-devel 
    libQt5Concurrent-devel Mesa ncurses-devel readline-devel libcurl-devel 
    llvm llvm-clang llvm-clang-devel llvm-devel libLLVM binutils 
    libmicrohttp-devel jsoncpp-devel opencl-headers-1.2 zlib-devel

It may be possible to use the generic libOpenCL1, but I have only tested with the AMD proprietary package from the AMD drivers repo fglrx64_opencl_SUSE421

These packages are not in the standard repos but can be found using the OpenSUSE build service package search and YaST 1-Click Install:

  • libargtable2-devel
  • libv8-3
  • v8-devel

If you also have v8 from the chromium repo installed the devel package will default to the 4.x branch which will not work. Use YaST or zypper to downgrade this package to 3.x

Installing dependencies for Arch Linux

Compiling webthree-umbrella on Arch Linux requires dependencies from both the official repositories and the Arch User Repository (AUR). To install packages from the official repositories pacman is used. For installation of packages from the AUR, a number of AUR helpers is available. For this guide, yaourt AUR helper is used.

Installing dependencies

# from official repositories sudo pacman -Sy git base-devel cmake boost crypto++ leveldb llvm miniupnpc libcl opencl-headers libmicrohttpd qt5-base qt5-webengine

# from AUR yaourt -Sy libjson-rpc-cpp

Compiling the source code

During this step, an installation folder for the Ethereum can be specified. Specification of the folder is optional though. If not given, the binary files will be located in the build folder. However, for this guide, it is assumed that the Ethereum files will be installed under /opt/eth. The reason for using /optis that it makes much easier to delete the Ethereum files later on, as compared to having them installed under, e.g., /usr. Also /opt is commonly used to install software that is not managed by packaging systems, such as manually compiled programs.

# enter webthree-umbrella folder after cloning its github repository
cd webthree-umbrella

# make a build folder and enter into it
mkdir -p build && cd build

# create build files and specify Ethereum installation folder
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/eth

# compile the source code
make

# alternatively it is possible to specify number of compilation threads
# for example to use 4 threads execute make as follows:
# make -j 4

# install the resulting binaries, shared libraries and header files into /opt
sudo make install

After successful compilation and installation, Ethereum binaries can be found in /opt/eth/bin, shared libraries in /opt/eth/lib, and header files in /opt/eth/include.

Specifying Ethereum libraries path

Since Ethereum was installed in /opt/eth, executing its binaries can result in linker error due to not being able to find the Ethereum shared libraries. To rectify this issue, it is needed to add the folder containing Ethereum shared libraries into LD_LIBRARY_PATH environmental variable:

# update ~/.bashrc
echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/eth/lib" >> ~/.bashrc

# reload ~/.bashrc
source ~/.bashrc

Building for Windows

We support only 64-bit builds and only for the following versions of Windows:

It may be possible to get the client working for Windows 32-bit, by disabling EVMJIT and maybe other features too. We might accept pull-requests to add such support, but we will not put any of our own development time into supporting Windows 32-bit builds.

Pre-requisites

You will need to install the following dependencies

Software Notes
Git for Windows Command-line tool for retrieving source from Github.
CMake Cross-platform build file generator.
Visual Studio 2015 C++ compiler and dev environment.

Get the source

Clone the git repository containing all the source code by executing the following command:

git clone --recursive https://github.com/ethereum/cpp-ethereum.git
cd cpp-ethereum

Get the external dependencies

Execute the CMake script that downloads and unpacks pre-built external libraries needed to build the project:

scriptsinstall_deps.bat

Generate Visual Studio project files

Then execute the following commands, which will generate a Visual Studio solution file using CMake:

mkdir build
cd build
cmake -G "Visual Studio 14 2015 Win64" ..

Which should result in the creation of cpp-ethereum.sln in that build directory.

NOTE: We only support Visual Studio 2015 as of cpp-ethereum-v.1.3.0.

Double-clicking on that file should result in Visual Studio firing up. We suggest building RelWithDebugInfo configuration, but all others work.

Build on the command-line

Alternatively, you can build the project on the command-line, like so:

cmake --build . --config RelWithDebInfo

Building for OS X

Overview – Here be dragons!

It is impossible for us to avoid OS X build breaks because Homebrew is a “rolling release” package manager which means that the ground will forever be moving underneath us unless we add all external dependencies to our Homebrew tap, or add them as git sub-modules. End-user results vary depending on when they are build the project. Building yesterday may have worked for you, but that doesn’t guarantee that your friend will have the same result today on their machine. Needless to say, this isn’t a happy situation.

If you hit build breaks for OS X please look through the Github issues to see whether the issue you are experiencing has already been reported. If so, please comment on that existing issue. If you don’t see anything which looks similar, please create a new issue, detailing your OS X version, cpp-ethereum version, hardware and any other details you think might be relevant. Please add verbose log files via gist.github.com or a similar service.

The cpp-ethereum-development gitter channel is where we hang out, and try to work together to get known issues resolved.

We only support the following OS X versions:

The cpp-ethereum code base does not build on older OS X versions and this is not something which we will ever support. If you are using an older OS X version, we recommend that you update to the latest release, not just so that you can build cpp-ethereum, but for your own security.

Clone the repository

To clone the source code, execute the following command:

git clone --recursive https://github.com/ethereum/cpp-ethereum.git
cd cpp-ethereum

Pre-requisites and external dependencies

Ensure that you have the latest version of xcode installed. This contains the Clang C++ compiler, thexcode IDE and other Apple development tools which are required for building C++ applications on OS X. If you are installing xcode for the first time, or have just installed a new version then you will need to agree to the license before you can do command-line builds:

sudo xcodebuild -license accept

Our OS X builds require you to install the Homebrew package manager for installing external dependencies. Here’s how to uninstall Homebrew, if you ever want to start again from scratch.

We now have a “one button” script which installs all required external dependencies on macOS and on numerous Linux distros. This used to a multi-step manual process:

./scripts/install_deps.sh

Command-line build

From the project root:

mkdir build
cd build
cmake ..
make -j4             (or different value, depending on your number of CPU cores)

Install your own build

You can also use the same Makefile to install your own build globally on your machine:

make install

This will install binaries into /usr/local/ and /usr/bin/.

Generate xcode project

From the project root:

mkdir build_xc
cd build_xc
cmake -G Xcode ..

This will generate an Xcode project file called cpp-ethereum.xcodeproj, which you can then open with xcode and build/debug/run.

Building for FreeBSD

NOTE – Once the packages are in the FreeBSD main ports this guide should be changed to something much more simple

Install the ports manually

For some of this steps you must require a root access to modify the ports directory.

The webthree-umbrella depends on [libjson-rpc-cpp.shar](https://raw.githubusercontent.com/enriquefynn/webthree-umbrella-port/master/libjson-rpc-cpp.shar) that is also not in the ports system.

First you need to download the shar file and place it on your ports directory under the “devel” session, usually /usr/ports/devel

curl https://raw.githubusercontent.com/enriquefynn/webthree-umbrella-port/master/libjson-rpc-cpp.shar > /usr/ports/devel/libjson-rpc-cpp.shar

Now we execute the script with:

cd /usr/ports/devel
sh libjson-rpc-cpp.shar

This will create the libjson-rpc-cpp port. Now you should do the same for the webthree-umbrella port, we should get the [webthree-umbrella](https://raw.githubusercontent.com/enriquefynn/webthree-umbrella-port/master/webthree-umbrella.shar) file and create the port under “net-p2p” directory.

curl https://raw.githubusercontent.com/enriquefynn/webthree-umbrella-port/master/webthree-umbrella.shar> /usr/ports/net-p2p/webthree-umbrella.shar
cd /usr/ports/net-p2p
sh webthree-umbrella.shar

Build and Install

Now you can navigate to the webthree-umbrella directory and install the port:

cd /usr/ports/net-p2p/webthree-umbrella
make install clean

Building for Android

We don’t currently have a working Android build, though that is on the roadmap for doublethinkco. Android uses the Linux kernel, but has a different API than the ARM Linux cross-builds, meaning that specific binaries will be required.

ARM Linux distros use the GLIBC runtime library, where Android uses bionic.

Building for iOS

We don’t currently have a working iOS build, though that is on the roadmap for doublethinkco. iOS is a UNIX-like operating system based on Darwin (BSD) using ARM chips. This is a different API than the ARM Linux cross-builds, meaning that specific binaries will be required.

Building for Raspberry Pi Model A, B+, Zero, 2 and 3

EthEmbedded maintain build scripts for all Raspberry Mi models. They are on Github in the Raspi-Eth-Install repository. It is also possible to cross-build for these platforms.

Building for Odroid XU3/XU4

EthEmbedded maintain build scripts for both of these Odroid models. Support for a broader range of Odroid devices is likely in the future. They are on Github in the OdroidXU3-Eth-Install repository. It is also possible to cross-build for these platforms.

Building for BeagleBone Black

EthEmbedded maintain build scripts for BBB on Github in the BBB-Eth-Install repository. It is also possible to cross-build for this platform.

Building for WandBoard

EthEmbedded maintain build scripts for the WandBoard on Github in the WandBoard-Eth-Installrepository. It is also possible to cross-build for this platform.

Building for Linux for ARM (cross builds)

doublethinkco maintain a Docker-based cross-build infrastructure which is hosted on Github in thecpp-ethereum-cross repository.

At the time of writing, these cross-built binaries have been successfully used on the following devices:

  • Jolla Phone (Sailfish OS)
  • Nexus 5 (Sailfish OS)
  • Meizu MX4 Ubuntu Edition (Ubuntu Phone)
  • Raspberry Pi Model B+, Rpi2 (Raspbian)
  • Odroid XU3 (Ubuntu MATE)
  • BeagleBone Black (Debian)
  • Wandboard Quad (Debian)
  • C.H.I.P. (Debian)

Still TODO:

  • Tizen
  • Android
  • iOS

 

You must be logged in to take the quiz.

Deja un comentario