Position: Home page » Ethereum » Compiling under Ethereum windows

Compiling under Ethereum windows

Publish: 2021-04-26 08:41:20
1. My computer - & gt; Attribute - & gt; Advanced - & gt; Environment variables - & gt; Add the following environment variables to the system variables:
java_ The home value is: the directory where JDK is installed, and mine is C: &# 92; Program Files\ Java\ jdk1.6.0_ 34
the classpath value is:;% JAVA_ HOME%\ lib\ tools.jar;% JAVA_ HOME%\ lib\ dt.jar;% JAVA_ HOME%\ bin;( Pay attention to the & quot& quot; To add)
Path: append at the beginning.;% JAVA_ HOME%\ bin;% JAVA_ HOME%\ jre\ bin;( Pay attention to the & quot& quot; To add)

after the installation, you can check whether the JDK is installed successfully. Open the CMD window and enter Java – version to view the version information of JDK.
2.
  1. the concept of bitcoin was first proposed by Nakamoto in 2009. According to Nakamoto's idea, open source software was designed and released, and P2P network was built on it. Bitcoin is a kind of P2P digital currency. Point to point transmission means a decentralized payment system

    Unlike most currencies, bitcoin does not rely on specific currency institutions to issue. It is generated by a large number of calculations based on specific algorithms. Bitcoin economy uses a distributed database composed of many nodes in the whole P2P network to confirm and record all transactions, and uses cryptography design to ensure the security of all aspects of currency circulation. The decentralized nature and algorithm of P2P can ensure that it is impossible to artificially manipulate the value of bitcoin through mass proction. The design based on cryptography can make bitcoin only be transferred or paid by the real owner. This also ensures the anonymity of money ownership and circulation transactions. The biggest difference between bitcoin and other virtual currencies is that the total amount of bitcoin is very limited and it has a strong scarcity

3. 1. Preparation. Windows 64 bit system, C disk to reserve a certain space, download and install vs2015 (the official note only supports vs2015, to be verified), cmake I use 3.10.1, the system language to non Unicode language, such as English (U.S.), otherwise there will be errors in the final compilation
2. Project clone to local, project address:
3. Execute submole updata -- init
4. Install script in the directory_ Deps.bat is copied to the root directory and executed. This step will download hunter, boost, libjson, etc. to Disk C, which takes a long time. Please wait patiently
5. Go to the directory of the project and create the build subdirectory,
4. 很多朋友都知道如何在linux平台如何编译比特币程序,但是,到了windows平台,
就会感觉到无从下手. 其实, 比特币程序是跨平台的.
你要编译windows版的比特币程序,基本上有两种方法,一种是在linux平台
(推荐ubuntu 13.10)通过交叉编译的方法来编译.另外一种,就是直接在windows平台编译.
我想,你既然要在windows平台使用,我就详细介绍一下如何在windwows平台编译比特币程序.
我的平台:windows7
第一步:安装变编译环境QT和MINGW,msys
1、msys是一个在windows平台模拟shell的程序
下载安装程序之后,通过安装管理程序,按安装以下内容:
From MinGW installation manager -> All packages -> MSYS
选中以下安装包
msys-base-bin
msys-autoconf-bin
msys-automake-bin
msys-libtool-bin
点 apply changes开始安装他会自动下载安装好
需要注意的是,确保不要安装msys-gcc和msys-w32api ,因为这两个包和我们的编译系统发生冲突
很多人出现一些莫名其妙的问题,就是因为这两个包

2、安装 MinGW-builds
下载并解压缩 i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z 到C盘根目录 C:\
注意我的目录结构你尽量和我一样

3、设置PATH环境变量,将C:\mingw32\bin;添加到第一个

4、在命令行模式下输入 gc -v 会得到以下内容
c:\gcc -v
Using built-in specs.
COLLECT_GCC=c:\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw32/bin/../libexec/gcc/i686-w64-mingw32/4.8.2/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-4.8.2/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw482/i686-482-posix-dwarf-rt_v3-rev3/mingw32 --with-gxx-include-dir=/mingw32/i686-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check --disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tune=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw482/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw482/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw482/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw482/prerequisites/i686-w64-mingw32-static --with-cloog=/c/mingw482/prerequisites/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='i686-posix-dwarf-rev3, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw482/i686-482-posix-dwarf-rt_v3-rev3/mingw32/opt/include -I/c/mingw482/prerequisites/i686-zlib-static/include -I/c/mingw482/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw482/i686-482-posix-dwarf-rt_v3-rev3/mingw32/opt/include -I/c/mingw482/prerequisites/i686-zlib-static/include -I/c/mingw482/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw482/i686-482-posix-dwarf-rt_v3-rev3/mingw32/opt/lib -L/c/mingw482/prerequisites/i686-zlib-static/lib -L/c/mingw482/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
Thread model: posix
gcc version 4.8.2 (i686-posix-dwarf-rev3, Built by MinGW-W64 project)
至此,你的开发环境已经搭建好了,很简单吧

第二部分:下载bitcoin引用的外部库
我们把它们全部放在 C:\deps目录下

2.1 安装OpenSSL下载:
进入启动 MinGw shell 比如目录:(C:\MinGW\msys\1.0\msys.bat)运行这个msys.bat,就会启动一个shell环境,提示符是$
输入命令
cd /c/deps/
tar xvfz openssl-1.0.1g.tar.gz
cd openssl-1.0.1g
Configure no-shared no-dso mingw
make
等待几分钟后,就把openssl编译好了

2.2 下载Berkeley DB
我们推荐使用 4.8版本
同样在msys shell环境下输入以下命令
cd /c/deps/
tar xvfz db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
../dist/configure --enable-mingw --enable-cxx --disable-shared --disable-replication
make
等待编译

2.3 安装Boost

msys命令:
cd C:\deps\boost_1_55_0\
bootstrap.bat mingw
b2 --build-type=complete --with-chrono --with-filesystem --with-program_options --with-system --with-thread toolset=gcc variant=release link=static threading=multi runtime-link=static stage

2.4 安装Miniupnpc
cd C:\deps\miniupnpc
mingw32-make -f Makefile.mingw init upnpc-static

2.5下载 protoc 和 libprotobuf:
msys shell命令
cd /c/deps/protobuf-2.5.0
configure --disable-shared
make
2.6 qrencode:
命令
cd /c/deps/libpng-1.6.10
configure --disable-shared
make
ode:
cd /c/deps/qrencode-3.4.3
LIBS="../libpng-1.6.10/.libs/libpng16.a ../../mingw32/i686-w64-mingw32/lib/libz.a" \
png_CFLAGS="-I../libpng-1.6.10" \
png_LIBS="-L../libpng-1.6.10/.libs" \
configure --enable-static --disable-shared --without-tools
make

2.7 安装 Qt 5 库
在 windows命令行输入:
set INCLUDE=C:\deps\libpng-1.6.10;C:\deps\openssl-1.0.1g\include
set LIB=C:\deps\libpng-1.6.10\.libs;C:\deps\openssl-1.0.1g
cd C:\Qt\5.2.1
configure.bat -release -opensource -confirm-license -static -make libs -no-sql-sqlite -no-opengl -system-zlib -qt-pcre -no-icu -no-gif -system-libpng -no-libjpeg -no-freetype -no-angle -no-vcproj -openssl-linked -no-dbus -no-audio-backend -no-wmf-backend -no-qml-debug
mingw32-make
set PATH=%PATH%;C:\Qt\5.2.1\bin
cd C:\Qt\qttools-opensource-src-5.2.1
qmake qttools.pro
mingw32-make

3. 下载Bitcoin 0.9.1
在msys shell下输入以下命令行:
cp /c/deps/libpng-1.6.10/.libs/libpng16.a /c/deps/libpng-1.6.10/.libs/libpng.a
cd /c/bitcoin-0.9.1
./autogen.sh
CPPFLAGS="-I/c/deps/boost_1_55_0 \
-I/c/deps/db-4.8.30.NC/build_unix \
-I/c/deps/openssl-1.0.1g/include \
-I/c/deps \
-I/c/deps/protobuf-2.5.0/src \
-I/c/deps/libpng-1.6.10 \
-I/c/deps/qrencode-3.4.3" \
LDFLAGS="-L/c/deps/boost_1_55_0/stage/lib \
-L/c/deps/db-4.8.30.NC/build_unix \
-L/c/deps/openssl-1.0.1g \
-L/c/deps/miniupnpc \
-L/c/deps/protobuf-2.5.0/src/.libs \
-L/c/deps/libpng-1.6.10/.libs \
-L/c/deps/qrencode-3.4.3/.libs" \
./configure \
--disable-upnp-default \
--disable-tests \
--with-qt-incdir=/c/Qt/5.2.1/include \
--with-qt-libdir=/c/Qt/5.2.1/lib \
--with-qt-bindir=/c/Qt/5.2.1/bin \
--with-qt-plugindir=/c/Qt/5.2.1/plugins \
--with-boost-system=mgw48-mt-s-1_55 \
--with-boost-filesystem=mgw48-mt-s-1_55 \
--with-boost-program-options=mgw48-mt-s-1_55 \
--with-boost-thread=mgw48-mt-s-1_55 \
--with-boost-chrono=mgw48-mt-s-1_55 \
--with-protoc-bindir=/c/deps/protobuf-2.5.0/src
make
strip src/bitcoin-cli.exe
strip src/bitcoind.exe
strip src/qt/bitcoin-qt.exe

这样,你就得到了变异好的 bitcoin-cli.exe和bitcoind.exe ,bitcoin-qt.exewindows QT图形界面的钱包软件
5. Source code needs to be compiled in the corresponding development environment to generate executable files. You can use Notepad to open and view the source code, determine its development language, and then install the corresponding development software to compile. For reference!
6. In the source code of general open source projects, there will be readme after decompression. Just do it according to the method he said.
nmake is usually used on Windows platform, because it is mainly for VC platform or MinGW
so it involves configuring the compilation environment of namke and GNU make. If VC is used, start vs console directly, Then input nmake - f makefile in it
GNU make is the same

but I think the next binary package is OK. There's no need to recompile it yourself. It's time-consuming and laborious
open source projects. As long as they don't compile very large ones, they will release the latest version and add the download of binary package at the same time. Just download one, For example, NASM, I will directly download nasmxxx. Zip (XXX is the version number)
7.

The method is as follows:

  1. double click GCC installation package, mingw-get-setup.exe, and click Install to install

  2. click change to select the installation path, try not to have Chinese and spaces,

  3. add MinGW - * and mingw32 - * and msys - * * under the package. Check all of them and wait for download and installation until all of them turn to earth gray

  4. find the bin directory of the installation directory and right-click to the path

  5. find the computer, right-click, and click properties. Click Advanced system settings

  6. find the following environment variables and click

  7. find the path variable in the system variable, double-click to open the following input box, add the bin directory just copied at the end of the variable value, and add the semicolon (;) in English at the end. Click OK

  8. to test whether the installation is successful, enter GCC -- help enter in the CMD command prompt,

  9. after EDITPLUS 3 is installed, click New C / C + +

  10. under file to display the following test code, save it to the specified directory, and finally save it to E / my / test without spaces and Chinese. The file name is test. C

  11. in the command prompt window, enter E / mytest and use the dir command to display all the files in the current directory

  12. compile with GCC command. The command format is as follows: GCC test.c - O test enter key. The compilation is complete

  13. directly input test to run, output Hello, world

    The
  14. test is complete

8. 1、 Preparation before compiling
1) understand the code organization structure
chrome source is very large, and it also contains tools and components in its home directory. Any tool and component also comes with its source code. First of all, you should be familiar with the organization structure of the source code http://src.chromium.org/svn/ It contains the following subdirectory: releases, the official version of chrome source code that has been released; Trunk, the latest source code. Because the code in releases is relatively old, we will not explain it here, just the structure of trunk. There are three important directories under the trunk. DEPs contains the code of all the components needed to compile and run chrome. SRC contains the code of the main program of chrome, tools contains the compressed package and source code of the third-party tools needed to download and configure compilation, including SVN and python, which are two important tools, and will be introced in detail later. This is a brief introction for the time being, because its organizational structure is relatively responsible, which will be supplemented and corrected later

2) how to download and synchronize source code
first of all, let's talk about download:
1. The simplest way is to download the compressed source code package directly from the official website of chrome at http://build.chromium.org/buildbot/archives/chromium_ tarball.html

2, or SVN from http://src.chromium.org/svn/trunk/src This local heckout requires you to build a local source code home directory

3, another solution is to use a deployment tool depot provided by Google_ tools Although these methods can download the complete source code, the current situation is: Chrome is compiled based on Visual Studio 2005. If the compilation is completed successfully, the SLN file will be indispensable. The earlier source code contains the ready-made SLN and VCProject files, but these files are discarded after modification. Google has developed a script tool called gyp, This tool is written in Python. Gyp uses a set of custom rules to generate various engineering files. The key Python is contained in the depot_ Therefore, no matter what method is used to download the code, you have to download the depot_ Tools is a tool to get the necessary project files< br />depot_ Tools in http://src.chromium.org/svn/trunk/tools Next, a directory and a zip package are included

3) about compiler
it was mentioned earlier that chrome was compiled with visual stdio 2005 http://dev.chromium.org The following operations are required: compile normally
A, install Visual Studio 2005.
b, and install Visual Studio 2005 Service Pack 1.
C, Install visual studio hotfix 947315.
D. if it is a vista system, you also need to install Visual Studio 2005 Service Pack 1 update for Windows Vista.
E. install windows 2008 SDK. If it is a visual studio 2008 system, you do not need this step
F, configure the windows 2008 SDK to make it the preferred development library to obtain some new functions and features. The way is at the beginning - & gt; Procere - & gt; Microsoft Windows SDK v6.1 > Visual Studio Registration > Windows SDK configuration tool, select the make current button. You can also manually configure the include and libary paths in VS, and the effect is the same< Second, how to configure project file
1, if depot is used_ Tools, then downloading the code to generate the SLN file will be completed automatically. The steps are
(1) download the depot_ Tools to local storage, assuming that it is located in D / depot_ Tools.
(2) d / depot_ Tools is added to the system environment variable
(3) create a source code root directory, assuming that it is D / chrome, and the directory must not contain spaces
(4) switch the current directory to D / chrome on the command line
(5) execute the command gclient config http://src.chromium.org/svn/trunk/src The command will first download SVN and python to D / depot_ tools/svn_ Bin and D / Depot_ tools/python_ bin
(6) execute the command gclient sync, which will call SVN synchronization source code. It will be a long process. After all is completed, all the source code is saved in D / chrome. There are about four G's of uncompiled code, and the process will be very long. The source code obtained in this way already contains all the project files and can be opened directly

focus on gclient, which is actually a batch file. It mainly does the following things: first, set environment variables, such as code root directory, tool root directory, etc. Next, call win_ Tools. Bat downloads SVN and python from the server. Finally, call python.exe to parse Chrome.gyp to generate all engineering files.
in addition, it should be noted that the gclient sync process is very long. According to the command line prompt, a total of 67 projects (not projects) need to be synchronized. During this process, errors may be caused e to some reasons and you need to continue calling sync. For example, in case of network failure, SVN will enter the sleep state for many times and then try again. If it fails for many times, it will report an error and exit. In other cases, the properties of some subdirectories cannot be synchronized. You can operate according to the prompts. There is also a new problem. The following two directories are "Src / WebKit / data / layout"_ "Tests / layouttests" and "Src / third"_ The source code of "party / WebKit / layouttests" is checked out from src.webkit.org, but there is a problem in this website. We can't check out the code, so we need to block these two directories. Because they are test code, even if they are discarded, the compilation of the whole project will not be affected. The method is to open the. Gclient file under trunk and add the following content
& quot; custom_ deps" : {< br /> " src/webkit/data/layout_ tests/LayoutTests": None,
" src/third_ party/WebKit/LayoutTests": None,
},

so that SVN can complete the code synchronization. Finally, gclient calls depot_ tools/python_ Bin / python.exe vs Src / build / gyp_
chrome, so that all SLN and VCProject files are obtained

2. If the code package or checkout code is downloaded and there is no SLN file in the code directory, you need to call the command line to enter the source code root directory, and then execute the command gclient runhooks -- force. After the command is executed, chrome.gyp will be parsed directly to generate the SLN file

in the actual download process, I used TortoiseSVN to download from http://src.chromium.org/svn/trunk/src Check out source code, but the code is only a few hundred megabytes. After executing the gclient runhooks -- force command, the SLN file is not found. The specific reason is unknown, so this method is not recommended. However, we haven't tried to download the compressed code package directly, so we don't know whether it is feasible. So the safest way is to use depot_ Tools to deploy and process the source code

three compilation projects
start Visual Studio 2005, open Src / Chrome / Browser / chrome.sln, or open Src / build / all.sln. If you open chrome.sln, which contains 480 projects, and all.sln contains 507 projects, some 2009 compilation instructions mentioned about 300 projects, it can be seen that the code of chrome has changed a lot. It takes 2 hours to compile the whole solution. Depending on the hardware environment, the larger the memory, the faster it will be. 4G or more memory, core 2 or 4 cores are recommended. It is said that it will take up 30g of space after compiling. The compiled file is located in the D / chord / Chrome / debug directory or D / chord / Chrome / release directory< At present, chrome involves 25 open source codes:
1. Google breakpad
/ SRC / breakpad
open source cross platform program crash reporting system
2. Google URL
/ SRC / Google URL
Google's compact URL parsing and collation library< 3. Skia
/ SRC / skia
vector graphics engine
4. Google V8
/ SRC / V8
Google's open source JavaScript engine. V8 implements ECMAScript specification of ecma-262 third edition, which can run on IA-32 or arm based systems such as Windows XP and Vista, Mac OS X 10.5 (Leopard) and Linux. V8 can be run alone or embedded in any C + + program
5. WebKit
/ SRC / webki
open source browser engine
6. Netscape portable runtime (nspr)
/ SRC / base / third_ Party / nspr
Netscape portable runtime (nspr) provides system level platform independent API and functions similar to libc< br />7、Network Security Services (NSS)
/src/base/third_ Party / NSS
network security services (NSS) is a set of cross platform function library for supporting server-side and client-side security development. The program can support SSL V2 and V3, TLS, PKCs # 5, PKCs # 7, PKCs # 11, PKCs # 12, S / MIME, X.509 V3 authentication and other security standards through NSS< br />8、Hunspell
/src/chrome/third_ party/hunspell
Spell checker and morphological analyzer library and program designed for languages with rich morphology and complex word compounding or character encoding.
9、Windows Template Library
/src/chrome/third_ Party / WTL
C + + library for developing windows programs and UI components. WTL extends ATL (Active Template Library) and provides a set of classes for the development of controls, dialogues, frame windows, GDI objects, etc
10. Google C + + testing framework
/ SRC / testing / GTEST
the xUnit framework used by Google to write c + + testing can be used on a variety of platforms: Linux, Mac OS X, windows, Windows CE, and Symbian. It supports automatic test discovery and has a rich set of assertions for customizable assertions, such as death tests, fatal and non fatal failures, variable options for running the tests, and XML test report generation.
11, bsdiff and bspatch
/ SRC / third_ Party / bsdiff and / SRC / third_ Party / bspatch
bsdiff and bspatch are used to generate patches for binary files< br />12、bzip2
/src/third_ Party / bzip2
bzip2 uses burrows Wheeler block sorting text compression algorithm and Huffman coding to compress files< br />13、International Components for Unicode (ICU)
/src/third_ Party / icu38
ICU is a set of mature and widely used C / C + + and Java libraries, which can provide Unicode and global support for software< br />14、libjpeg
/src/third_ Party / libjpeg
a library for processing JPEG (JFIF) image formats< br />15、libpng
/src/third_ Party / libpng
PNG image format library. It supports most of the PNG features and is extensible. It has been widely used for more than 13 years< br />16、libxml
/src/third_ Party / libxml
C language XML parsing library< br />17、libxslt
/src/third_ Party / libxslt
C language XSLT library< br />18、LZMA
/src/third_ party/
9. Calligra is a lightweight office component designed to provide an excellent office software based on open standards for all platforms. In addition to the standard office software, this version adds the diagram and flowchart editor flow, and the note taking tool brainmp. Calligra is compatible with MS Office 2007 files, improves startup speed, performance and text layout, and provides two user interfaces, calligra active and calligra mobile, for tablet and smartphone.
10. The method is as follows:
double click GCC installation package, mingw-get-setup.exe, and click Install to install<
click change to select the installation path, try not to have Chinese and spaces,
change MinGW - * *, mingw32 - * *, msys - * * under the package. Check all of them and wait for download and installation until all of them turn to earth gray
find the bin directory of the installation directory and right-click to the path
find the computer, right-click and click properties. Click Advanced system settings
find the environment variables below and click
find the path variable in the system variable, double-click to open the following input box, add the bin directory just copied at the end of the variable value, and add the semicolon (;) in English at the end. Click OK
to test whether the installation is successful, enter GCC -- help enter in the CMD command prompt,
after the EDITPLUS 3 installation, click New C / C + +
the following test code will appear, save it to the specified directory, and finally save it to E / my / test without spaces and Chinese. The file name is test. C
in the command prompt window, enter E / mytest and use the dir command to display all the files in the current directory
use the GCC command to compile. The command format is as follows: GCC test.c - O test enter key. The compilation is complete
directly input test to run, output Hello, world
the test is complete.
Hot content
Inn digger Publish: 2021-05-29 20:04:36 Views: 341
Purchase of virtual currency in trust contract dispute Publish: 2021-05-29 20:04:33 Views: 942
Blockchain trust machine Publish: 2021-05-29 20:04:26 Views: 720
Brief introduction of ant mine Publish: 2021-05-29 20:04:25 Views: 848
Will digital currency open in November Publish: 2021-05-29 19:56:16 Views: 861
Global digital currency asset exchange Publish: 2021-05-29 19:54:29 Views: 603
Mining chip machine S11 Publish: 2021-05-29 19:54:26 Views: 945
Ethereum algorithm Sha3 Publish: 2021-05-29 19:52:40 Views: 643
Talking about blockchain is not reliable Publish: 2021-05-29 19:52:26 Views: 754
Mining machine node query Publish: 2021-05-29 19:36:37 Views: 750