freebitcoinin如何在Ubuntu平台下编译比特币bitcoin客户端
今天给各位分享freebitcoin.in的知识,其中也会对如何在Ubuntu平台下编译比特币bitcoin客户端进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录
如何在windows平台下编译比特币bitcoin客户端如何在Ubuntu平台下编译比特币bitcoin客户端如何在windows平台下编译比特币bitcoin客户端第一步:安装变编译环境QT和MINGW,msys
1、msys是一个在windows平台模拟shell的程序。
访问http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download
下载安装程序之后,通过安装管理程序,按安装以下内容:
FromMinGWinstallationmanager->Allpackages->MSYS
选中以下安装包
msys-base-bin
msys-autoconf-bin
msys-automake-bin
msys-libtool-bin
点applychanges开始安装。他会自动下载安装好。
需要注意的是,确保不要安装msys-gcc和msys-w32api,因为这两个包和我们的编译系统发生冲突。
很多人出现一些莫名其妙的问题,就是因为这两个包。
2、安装MinGW-builds
访问
http://sourceforge.net/projects/mingw-w64/files/ToolchainstargettingWin32/PersonalBuilds/mingw-builds/4.8.2/threads-posix/dwarf/i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z/download
下载并解压缩i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z到C盘根目录C:\
注意我的目录结构。你尽量和我一样。
3、设置PATH环境变量,将C:\mingw32\bin;添加到第一个。
4、在命令行模式下输入gc-v会得到以下内容
c:\gcc-v
Usingbuilt-inspecs.
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
Configuredwith:../../../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,BuiltbyMinGW-W64project'--with-bugurl=http://sourceforge.net/projects/mingw-w64CFLAGS='-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'
Threadmodel:posix
gccversion4.8.2(i686-posix-dwarf-rev3,BuiltbyMinGW-W64project)
至此,你的开发环境已经搭建好了,很简单吧
第二部分:下载bitcoin引用的外部库
我们把它们全部放在C:\deps目录下
2.1安装OpenSSL下载:http://www.openssl.org/source/openssl-1.0.1g.tar.gz
进入启动MinGwshell比如目录:(C:\MinGW\msys\1.0\msys.bat)运行这个msys.bat,就会启动一个shell环境,提示符是$
输入命令
cd/c/deps/
tarxvfzopenssl-1.0.1g.tar.gz
cdopenssl-1.0.1g
Configureno-sharedno-dsomingw
make
等待几分钟后,就把openssl编译好了。
2.2下载BerkeleyDB访问:http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
我们推荐使用4.8版本
同样在msysshell环境下输入以下命令
cd/c/deps/
tarxvfzdb-4.8.30.NC.tar.gz
cddb-4.8.30.NC/build_unix
../dist/configure--enable-mingw--enable-cxx--disable-shared--disable-replication
make
等待编译
2.3安装Boost,下载地址:http://sourceforge.net/projects/boost/files/boost/1.55.0/
msys命令:
cdC:\deps\boost_1_55_0\
bootstrap.batmingw
b2--build-type=complete--with-chrono--with-filesystem--with-program_options--with-system--with-threadtoolset=gccvariant=releaselink=staticthreading=multiruntime-link=staticstage
2.4安装Miniupnpc下载地址:http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.9.tar.gz
cdC:\deps\miniupnpc
mingw32-make-fMakefile.mingwinitupnpc-static
2.5下载protoc和libprotobuf:
Downloadandunpackhttp://protobuf.googlecode.com/files/protobuf-2.5.0.zip
msysshell命令
cd/c/deps/protobuf-2.5.0
configure--disable-shared
make
2.6qrencode:
下载地址:http://prdownloads.sourceforge.net/libpng/libpng-1.6.10.tar.gz?download
命令
cd/c/deps/libpng-1.6.10
configure--disable-shared
make
下载http://fukuchi.org/works/qrencode/qrencode-3.4.3.tar.gzode:
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安装Qt5库
下载和解压缩
http://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qtbase-opensource-src-5.2.1.7z
http://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qttools-opensource-src-5.2.1.7z
在windows命令行输入:
setINCLUDE=C:\deps\libpng-1.6.10;C:\deps\openssl-1.0.1g\include
setLIB=C:\deps\libpng-1.6.10\.libs;C:\deps\openssl-1.0.1g
cdC:\Qt\5.2.1
configure.bat-release-opensource-confirm-license-static-makelibs-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
setPATH=%PATH%;C:\Qt\5.2.1\bin
cdC:\Qt\qttools-opensource-src-5.2.1
qmakeqttools.pro
mingw32-make
3.下载Bitcoin0.9.1地址:https://github.com/bitcoin/bitcoin/archive/v0.9.1.zip
在msysshell下输入以下命令行:
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
stripsrc/bitcoin-cli.exe
stripsrc/bitcoind.exe
stripsrc/qt/bitcoin-qt.exe
这样,你就得到了变异好的bitcoin-cli.exe和bitcoind.exe,bitcoin-qt.exe(windowsQT图形界面的钱包软件)
如何在Ubuntu平台下编译比特币bitcoin客户端很多朋友都知道如何在linux平台如何编译比特币程序,但是,到了windows平台,
就会感觉到无从下手.其实,比特币程序是跨平台的.
你要编译windows版的比特币程序,基本上有两种方法,一种是在linux平台
(推荐ubuntu13.10)通过交叉编译的方法来编译.另外一种,就是直接在windows平台编译.
我想,你既然要在windows平台使用,我就详细介绍一下如何在windwows平台编译比特币程序.
我的平台:windows7
第一步:安装变编译环境QT和MINGW,msys
1、msys是一个在windows平台模拟shell的程序。
下载安装程序之后,通过安装管理程序,按安装以下内容:
FromMinGWinstallationmanager->Allpackages->MSYS
选中以下安装包
msys-base-bin
msys-autoconf-bin
msys-automake-bin
msys-libtool-bin
点applychanges开始安装。他会自动下载安装好。
需要注意的是,确保不要安装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
Usingbuilt-inspecs.
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
Configuredwith:../../../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,BuiltbyMinGW-W64project'--with-bugurl=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'
Threadmodel:posix
gccversion4.8.2(i686-posix-dwarf-rev3,BuiltbyMinGW-W64project)
至此,你的开发环境已经搭建好了,很简单吧
第二部分:下载bitcoin引用的外部库
我们把它们全部放在C:\deps目录下
2.1安装OpenSSL
进入启动MinGwshell比如目录:(C:\MinGW\msys\1.0\msys.bat)运行这个msys.bat,就会启动一个shell环境,提示符是$
输入命令
cd/c/deps/
tarxvfzopenssl-1.0.1g.tar.gz
cdopenssl-1.0.1g
Configureno-sharedno-dsomingw
make
等待几分钟后,就把openssl编译好了。
2.2下载BerkeleyDB
我们推荐使用4.8版本
同样在msysshell环境下输入以下命令
cd/c/deps/
tarxvfzdb-4.8.30.NC.tar.gz
cddb-4.8.30.NC/build_unix
../dist/configure--enable-mingw--enable-cxx--disable-shared--disable-replication
make
等待编译
2.3安装Boost
msys命令:
cdC:\deps\boost_1_55_0\
bootstrap.batmingw
b2--build-type=complete--with-chrono--with-filesystem--with-program_options--with-system--with-threadtoolset=gccvariant=releaselink=staticthreading=multiruntime-link=staticstage
2.4安装Miniupnpc
cdC:\deps\miniupnpc
mingw32-make-fMakefile.mingwinitupnpc-static
msysshell命令
cd/c/deps/protobuf-2.5.0
configure--disable-shared
make
2.6qrencode:
命令
cd/c/deps/libpng-1.6.10
configure--disable-shared
make
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安装Qt5库
下载和解压缩
在windows命令行输入:
setINCLUDE=C:\deps\libpng-1.6.10;C:\deps\openssl-1.0.1g\include
setLIB=C:\deps\libpng-1.6.10\.libs;C:\deps\openssl-1.0.1g
cdC:\Qt\5.2.1
configure.bat-release-opensource-confirm-license-static-makelibs-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
setPATH=%PATH%;C:\Qt\5.2.1\bin
cdC:\Qt\qttools-opensource-src-5.2.1
qmakeqttools.pro
mingw32-make
3.下载Bitcoin0.9.1
在msysshell下输入以下命令行:
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
stripsrc/bitcoin-cli.exe
stripsrc/bitcoind.exe
stripsrc/qt/bitcoin-qt.exe
这样,你就得到了变异好的bitcoin-cli.exe和bitcoind.exe,bitcoin-qt.exe(windowsQT图形界面的钱包软件)
关于本次freebitcoin.in和如何在Ubuntu平台下编译比特币bitcoin客户端的问题分享到这里就结束了,如果解决了您的问题,我们非常高兴。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 931614094@qq.com 举报,一经查实,本站将立刻删除。