Even if they could, doesn't mean anyone should have to compile a wallet to mine on a system that is not their native choice.
Cryptocurrencies will only gain widespread acceptance and prosper when they are available to the widest audience possible. This does not mean making a coin only mineable on the smallest minority of computer users (linux).
Not "savvy" enough to set up a most basic linux instance, dear lord.
So you want everyone to go and buy/download virtualization software so they can install linux, just so they can mine this coin?
Hi all, I recently went through the process of building bitcoind on windows.
I found the official build-msw.txt to be a bit lacking, so I thought that documenting the steps here on the forums could save some time to people wanting to compile their own windows binary.
Please note this is mostly for testing purposes. Always use official executables on production environments.
The following instructions are intended for use with the latest 0.9.1. See additional notes if compiling an older 0.8.6 version.
1. Prepare your build system.I strongly suggest setting up a clean windows virtual machine via Virtualbox or similar.
1.1 Install msys shell:
http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/downloadFrom MinGW installation manager -> All packages -> MSYS
mark the following for installation:
msys-base-bin
msys-autoconf-bin
msys-automake-bin
msys-libtool-binthen click on Installation -> Apply changes
Make sure no mingw packages are checked for installation or present from a previous install. Only the above msys packages should be installed. Also make sure that msys-gcc and msys-w32api packages are not installed.
1.2 Install a toolchain from MinGW-builds project:
Download and unpack i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z to C:\
http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.8.2/threads-posix/dwarf/i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z/download1.3. Ensure that mingw-builds bin folder is set in your PATH environment variable. On Windows 7 your path should look something like:
C:\mingw32\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
1.4 Additional checks:
C:\MinGW\bin should contain nothing but mingw-get.exe.
Your gcc -v output should be:
$ 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)
2. Download, unpack and build required dependencies.I'll save them in c:\deps folder.
2.1 OpenSSL:
http://www.openssl.org/source/openssl-1.0.1g.tar.gzFrom a MinGw shell (C:\MinGW\msys\1.0\msys.bat), unpack the source archive with tar (this will avoid symlink issues) then configure and make:
cd /c/deps/
tar xvfz openssl-1.0.1g.tar.gz
cd openssl-1.0.1g
Configure no-shared no-dso mingw
make
2.2 Berkeley DB:
http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gzWe'll use version 4.8 to preserve binary wallet compatibility.
From a MinGW shell unpack the source archive, configure and make:
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:
http://sourceforge.net/projects/boost/files/boost/1.55.0/Download either the zip or the 7z archive, unpack boost inside your C:\deps folder, then bootstrap and compile from a Windows command prompt:
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
This will compile the required boost libraries and put them into the stage folder (C:\deps\boost_1_55_0\stage).
Note: make sure you don't use tarballs, as unix EOL markers can break batch files.
2.4 Miniupnpc:
http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.9.tar.gzUnpack Miniupnpc to C:\deps, rename containing folder from "miniupnpc-1.9" to "miniupnpc" then from a Windows command prompt:
cd C:\deps\miniupnpc
mingw32-make -f Makefile.mingw init upnpc-static
2.5 protoc and libprotobuf:
Download and unpack
http://protobuf.googlecode.com/files/protobuf-2.5.0.zipThen from msys shell
cd /c/deps/protobuf-2.5.0
configure --disable-shared
make
2.6 qrencode:
Download and unpack
http://prdownloads.sourceforge.net/libpng/libpng-1.6.10.tar.gz?download inside your deps folder then configure and make:
cd /c/deps/libpng-1.6.10
configure --disable-shared
make
Download and unpack
http://fukuchi.org/works/qrencode/qrencode-3.4.3.tar.gz inside your deps folder then configure and make:
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 libraries:
Qt must be configured with ssl and zlib support.
Download and unpack Qt base and tools sources:
http://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qtbase-opensource-src-5.2.1.7zhttp://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qttools-opensource-src-5.2.1.7zThen from a windows command prompt (note that the following supposes qtbase is unpacked into C:\Qt\5.2.1 and qttools are unpacked into C:\Qt\qttools-opensource-src-5.2.1):
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
Note: consider using -j switch with mingw32-make to speed up compilation process. On a quad core -j4 or -j5 should give the best results.
3. Download and unpack Bitcoin 0.9.1 from git https://github.com/bitcoin/bitcoin/archive/v0.9.1.zipPatch makefile to avoid being asked for permission during compile process (replace relevant rm with rm -f)
--- Makefile.include Sun Mar 16 12:05:28 2014
+++ Makefile.include Wed Mar 26 03:05:58 2014
@@ -40,18 +40,18 @@
ui_%.h: %.ui
@test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D)
@test -f $(UIC) && QT_SELECT=$(QT_SELECT) $(UIC) -o $(abs_builddir)/$@ $(abs_srcdir)/$< || echo error: could not build $(abs_builddir)/$@
- $(SED) -i.bak -e '/^\*\*.*Created:/d' $(abs_builddir)/$@ && rm $(abs_builddir)/$@.bak
- $(SED) -i.bak -e '/^\*\*.*by:/d' $(abs_builddir)/$@ && rm $(abs_builddir)/$@.bak
+ $(SED) -i.bak -e '/^\*\*.*Created:/d' $(abs_builddir)/$@ && rm -f $(abs_builddir)/$@.bak
+ $(SED) -i.bak -e '/^\*\*.*by:/d' $(abs_builddir)/$@ && rm -f $(abs_builddir)/$@.bak
%.moc: %.cpp
QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $<
- $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak
- $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak
+ $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm -f $@.bak
+ $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm -f $@.bak
moc_%.cpp: %.h
QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) -o $@ $<
- $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak
- $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak
+ $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm -f $@.bak
+ $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm -f $@.bak
%.qm: %.ts
@test -d $(abs_builddir)/$(@D) || $(MKDIR_P) $(abs_builddir)/$(@D)
--- qt/Makefile.am Sun Mar 16 12:05:28 2014
+++ qt/Makefile.am Wed Mar 26 03:06:21 2014
@@ -371,7 +371,7 @@
$(QT_QRC_CPP): $(QT_QRC) $(QT_QM) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES) $(PROTOBUF_H)
@cd $(abs_srcdir); test -f $(RCC) && QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin -o $(abs_builddir)/$@ $< || \
echo error: could not build $@
- $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm $@.bak
- $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm $@.bak
+ $(SED) -i.bak -e '/^\*\*.*Created:/d' $@ && rm -f $@.bak
+ $(SED) -i.bak -e '/^\*\*.*by:/d' $@ && rm -f $@.bak
CLEANFILES = $(BUILT_SOURCES) $(QT_QM) $(QT_FORMS_H) *.gcda *.gcno
from msys shell configure and make bitcoin:
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
64 bit binaries64 bit binaries can be compiled by using the following toolchain:
http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.8.2/threads-posix/seh/x86_64-4.8.2-release-posix-seh-rt_v3-rev3.7z/downloadAll dependencies must be rebuilt with the above toolchain.
Openssl should be configured with:
Additional notes for Bitcoin 0.8.6msys-autoconf, msys-automake and msys-libtool at step 1.1 are not needed. You can skip steps 2.5 and 2.7.
Compile bitcoind: https://github.com/bitcoin/bitcoin/archive/v0.8.6.zipWith a texteditor edit BOOST_SUFFIX, INCLUDEPATHS and LIBPATHS in your C:\bitcoin-0.8.6\src\makefile.mingw according to your dependencies location:
BOOST_SUFFIX?=-mgw48-mt-s-1_55
INCLUDEPATHS= \
-I"$(CURDIR)" \
-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"
LIBPATHS= \
-L"$(CURDIR)/leveldb" \
-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"
and add -static option to LDFLAGS in makefile.mingw to compile a statically linked executable.
LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -static
makefile.mingw patch:
--- makefile.mingw Thu Dec 05 14:11:26 2013
+++ makefile.mingw Sat Apr 05 12:30:43 2014
@@ -21,15 +21,19 @@
USE_IPV6:=1
DEPSDIR?=/usr/local
-BOOST_SUFFIX?=-mgw46-mt-sd-1_52
+BOOST_SUFFIX?=-mgw48-mt-s-1_55
INCLUDEPATHS= \
-I"$(CURDIR)" \
- -I"$(DEPSDIR)/include"
-
+ -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"
+
LIBPATHS= \
-L"$(CURDIR)/leveldb" \
- -L"$(DEPSDIR)/lib"
+ -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"
LIBS= \
-l leveldb \
@@ -47,7 +51,7 @@
DEBUGFLAGS=-g
CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS)
# enable: ASLR, DEP and large address aware
-LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware
+LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -static
TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
Upnp support is disabled by default. If you want to compile with upnp support set
and add miniupnpc path to INCLUDEPATHS and LIBPATHS:
INCLUDEPATHS= \
-I"$(CURDIR)" \
-I"/c/deps/boost_1_55_0" \
-I"/c/deps" \
-I"/c/deps/db-4.8.30.NC/build_unix" \
-I"/c/deps/openssl-1.0.1g/include"
LIBPATHS= \
-L"$(CURDIR)/leveldb" \
-L"/c/deps/boost_1_55_0/stage/lib" \
-L"/c/deps/miniupnpc" \
-L"/c/deps/db-4.8.30.NC/build_unix" \
-L"/c/deps/openssl-1.0.1g"
From Msys shell compile bitcoind:
cd /c/bitcoin-0.8.6/src
make -f makefile.mingw
strip bitcoind.exe
Compile bitcoin-qt 0.8.6 with Qt 4.8: Download and unpack
http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.zipAssuming qt sources are unpacked to C:\Qt\4.8.5, from a windows command prompt:
cd C:\Qt\4.8.5
configure -release -opensource -confirm-license -static -no-sql-sqlite -no-qt3support -no-opengl -qt-zlib -no-gif -qt-libpng -qt-libmng -no-libtiff -qt-libjpeg -no-dsp -no-vcproj -no-openssl -no-dbus -no-phonon -no-phonon-backend -no-multimedia -no-audio-backend -no-webkit -no-script -no-scripttools -no-declarative -no-declarative-debug -no-style-plastique -no-style-cleanlooks -no-style-motif -no-style-cde -nomake demos -nomake examples
mingw32-make
Note that if you skipped bitcoind compilation or if you have cleaned up your source folder you will need to compile libleveldb.a and libmemenv.a libraries before proceeding.
From msys shell:
cd /C/bitcoin-0.8.6/src/leveldb
TARGET_OS=NATIVE_WINDOWS make libleveldb.a libmemenv.a
Edit C:\bitcoin-0.8.6\bitcoin-qt.pro with your favourite text editor and add
dependency library locations:
# Dependency library locations can be customized with:
# BOOST_INCLUDE_PATH, BOOST_LIB_PATH, BDB_INCLUDE_PATH,
# BDB_LIB_PATH, OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively
BOOST_LIB_SUFFIX=-mgw48-mt-s-1_55
BOOST_INCLUDE_PATH=C:/deps/boost_1_55_0
BOOST_LIB_PATH=C:/deps/boost_1_55_0/stage/lib
BDB_INCLUDE_PATH=C:/deps/db-4.8.30.NC/build_unix
BDB_LIB_PATH=C:/deps/db-4.8.30.NC/build_unix
OPENSSL_INCLUDE_PATH=C:/deps/openssl-1.0.1g/include
OPENSSL_LIB_PATH=C:/deps/openssl-1.0.1g
MINIUPNPC_INCLUDE_PATH=C:/deps/
MINIUPNPC_LIB_PATH=C:/deps/miniupnpc
QRENCODE_INCLUDE_PATH=C:/deps/qrencode-3.4.3
QRENCODE_LIB_PATH=C:/deps/qrencode-3.4.3/.libs
Comment out genleveldb.commands for win32
LIBS += -lshlwapi
#genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a
}
flags for static build:
win32:QMAKE_LFLAGS *= -Wl,--large-address-aware -static
bitcoin-qt.pro patch:
--- bitcoin-qt.pro Thu Dec 05 14:11:26 2013
+++ bitcoin-qt.pro Sat Apr 05 14:51:31 2014
@@ -7,6 +7,7 @@
DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE
CONFIG += no_include_pwd
CONFIG += thread
+CONFIG += static
# for boost 1.37, add -mt to the boost libraries
# use: qmake BOOST_LIB_SUFFIX=-mt
@@ -17,6 +18,17 @@
# Dependency library locations can be customized with:
# BOOST_INCLUDE_PATH, BOOST_LIB_PATH, BDB_INCLUDE_PATH,
# BDB_LIB_PATH, OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively
+BOOST_LIB_SUFFIX=-mgw48-mt-s-1_55
+BOOST_INCLUDE_PATH=C:/deps/boost_1_55_0
+BOOST_LIB_PATH=C:/deps/boost_1_55_0/stage/lib
+BDB_INCLUDE_PATH=C:/deps/db-4.8.30.NC/build_unix
+BDB_LIB_PATH=C:/deps/db-4.8.30.NC/build_unix
+OPENSSL_INCLUDE_PATH=C:/deps/openssl-1.0.1g/include
+OPENSSL_LIB_PATH=C:/deps/openssl-1.0.1g
+MINIUPNPC_INCLUDE_PATH=C:/deps/
+MINIUPNPC_LIB_PATH=C:/deps/miniupnpc
+QRENCODE_INCLUDE_PATH=C:/deps/qrencode-3.4.3
+QRENCODE_LIB_PATH=C:/deps/qrencode-3.4.3/.libs
OBJECTS_DIR = build
MOC_DIR = build
@@ -47,7 +59,7 @@
# for extra security on Windows: enable ASLR and DEP via GCC linker flags
win32:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat
# on Windows: enable GCC large address aware linker flag
-win32:QMAKE_LFLAGS *= -Wl,--large-address-aware
+win32:QMAKE_LFLAGS *= -Wl,--large-address-aware -static
# use: qmake "USE_QRCODE=1"
# libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support
@@ -109,7 +121,7 @@
QMAKE_RANLIB = $$replace(QMAKE_STRIP, strip, ranlib)
}
LIBS += -lshlwapi
- genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a
+ #genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a
}
genleveldb.target = $$PWD/src/leveldb/libleveldb.a
genleveldb.depends = FORCE
From a windows command prompt configure and make:
set PATH=%PATH%;C:\Qt\4.8.5\bin
cd C:\bitcoin-0.8.6\
qmake "USE_QRCODE=1" "USE_UPNP=1" "USE_IPV6=1" bitcoin-qt.pro
mingw32-make -f Makefile.Release
Additional notes for Bitcoin-qt 0.8.6 with qt5Download and unpack Qt base and tools sources:
http://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qtbase-opensource-src-5.2.1.7zhttp://download.qt-project.org/official_releases/qt/5.2/5.2.1/submodules/qttools-opensource-src-5.2.1.7zFrom a windows command prompt configure and make:
cd C:\Qt\5.2.1
configure.bat -release -opensource -confirm-license -static -make libs -no-sql-sqlite -no-opengl -qt-zlib -qt-pcre -no-icu -no-gif -qt-libpng -qt-libjpeg -no-angle -no-vcproj -no-openssl -no-dbus -no-audio-backend -no-wmf-backend -no-qml-debug
mingw32-make
then
set PATH=%PATH%;C:\Qt\5.2.1\bin
cd C:\Qt\qttools-opensource-src-5.2.1
qmake qttools.pro
mingw32-make
Edit C:\bitcoin-0.8.6\bitcoin-qt.pro with your favourite text editor and add qt widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
dependency library locations:
# Dependency library locations can be customized with:
# BOOST_INCLUDE_PATH, BOOST_LIB_PATH, BDB_INCLUDE_PATH,
# BDB_LIB_PATH, OPENSSL_INCLUDE_PATH and OPENSSL_LIB_PATH respectively
BOOST_LIB_SUFFIX=-mgw48-mt-s-1_55
BOOST_INCLUDE_PATH=C:/deps/boost_1_55_0
BOOST_LIB_PATH=C:/deps/boost_1_55_0/stage/lib
BDB_INCLUDE_PATH=C:/deps/db-4.8.30.NC/build_unix
BDB_LIB_PATH=C:/deps/db-4.8.30.NC/build_unix
OPENSSL_INCLUDE_PATH=C:/deps/openssl-1.0.1g/include
OPENSSL_LIB_PATH=C:/deps/openssl-1.0.1g
MINIUPNPC_INCLUDE_PATH=C:/deps/
MINIUPNPC_LIB_PATH=C:/deps/miniupnpc
QRENCODE_INCLUDE_PATH=C:/deps/qrencode-3.4.3
QRENCODE_LIB_PATH=C:/deps/qrencode-3.4.3/.libs
Comment out genleveldb.commands for win32
LIBS += -lshlwapi
#genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX TARGET_OS=OS_WINDOWS_CROSSCOMPILE $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libleveldb.a && $$QMAKE_RANLIB $$PWD/src/leveldb/libmemenv.a
}
flags for static build:
win32:QMAKE_LFLAGS *= -Wl,--large-address-aware -static
Bitcoin 0.8.6 will need some patches in order to compile with Qt5:
Remove #define loop from util.h and replace
loop with
while (true) in
src/bitcoinrpc.cpp
src/main.cpp
src/net.cpp
src/script.cpp
src/util.cpp
src/wallet.cpp
src/walletdb.cpp
see:
https://github.com/bitcoin/bitcoin/commit/8351d55cd3955c95c5e3fe065a456db08cc8a559Qt5 compatibility.
#if QT_VERSION < 0x050000 ... in
src/qt/addressbookpage.cpp
src/qt/bitcoin.cpp
src/qt/bitcoingui.cpp
src/qt/guiutil.cpp
src/qt/paymentserver.cpp
src/qt/qrcodedialog.cpp
src/qt/rpcconsole.cpp
src/qt/sendcoinsdialog.cpp
src/qt/transactionview.cpp
src/qt/walletview.cpp
see:
https://github.com/bitcoin/bitcoin/commit/25c0cce7fb494fcb871d134e28b26504d30e34d3http://qt-project.org/doc/qt-5.0/qtdoc/sourcebreaks.htmlhttp://qt-project.org/wiki/Transition_from_Qt_4.x_to_Qt5Qt5 compatibility patch:
--- bitcoinrpc.cpp Thu Dec 05 13:11:26 2013
+++ bitcoinrpc.cpp Tue Dec 31 02:25:11 2013
@@ -417,7 +417,7 @@
int ReadHTTPHeaders(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet)
{
int nLen = 0;
- loop
+ while (true)
{
string str;
std::getline(stream, str);
--- main.cpp Thu Dec 05 13:11:26 2013
+++ main.cpp Tue Dec 31 02:25:11 2013
@@ -4551,7 +4551,7 @@
CReserveKey reservekey(pwallet);
unsigned int nExtraNonce = 0;
- try { loop {
+ try { while (true) {
while (vNodes.empty())
MilliSleep(1000);
@@ -4591,7 +4591,7 @@
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
uint256 hashbuf[2];
uint256& hash = *alignup<16>(hashbuf);
- loop
+ while (true)
{
unsigned int nHashesDone = 0;
unsigned int nNonceFound;
--- net.cpp Thu Dec 05 13:11:26 2013
+++ net.cpp Tue Dec 31 02:25:11 2013
@@ -135,7 +135,7 @@
bool RecvLine(SOCKET hSocket, string& strLine)
{
strLine = "";
- loop
+ while (true)
{
char c;
int nBytes = recv(hSocket, &c, 1, 0);
@@ -307,7 +307,7 @@
{
if (strLine.empty()) // HTTP response is separated from headers by blank line
{
- loop
+ while (true)
{
if (!RecvLine(hSocket, strLine))
{
@@ -750,7 +750,7 @@
void ThreadSocketHandler()
{
unsigned int nPrevNodeCount = 0;
- loop
+ while (true)
{
//
// Disconnect nodes
@@ -1114,7 +1114,7 @@
string strDesc = "Bitcoin " + FormatFullVersion();
try {
- loop {
+ while (true) {
#ifndef UPNPDISCOVER_SUCCESS
/* miniupnpc 1.5 */
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
@@ -1378,7 +1378,7 @@
// Initiate network connections
int64 nStart = GetTime();
- loop
+ while (true)
{
ProcessOneShot();
@@ -1429,7 +1429,7 @@
int64 nANow = GetAdjustedTime();
int nTries = 0;
- loop
+ while (true)
{
// use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections)
CAddress addr = addrman.Select(10 + min(nOutbound,8)*10);
--- script.cpp Thu Dec 05 13:11:26 2013
+++ script.cpp Tue Dec 31 02:25:11 2013
@@ -1163,7 +1163,7 @@
// Compare
CScript::const_iterator pc1 = script1.begin();
CScript::const_iterator pc2 = script2.begin();
- loop
+ while (true)
{
if (pc1 == script1.end() && pc2 == script2.end())
{
--- util.cpp Thu Dec 05 13:11:26 2013
+++ util.cpp Tue Dec 31 02:25:11 2013
@@ -311,7 +311,7 @@
char* p = buffer;
int limit = sizeof(buffer);
int ret;
- loop
+ while (true)
{
va_list arg_ptr;
va_copy(arg_ptr, ap);
@@ -371,7 +371,7 @@
return;
string::size_type i1 = 0;
string::size_type i2;
- loop
+ while (true)
{
i2 = str.find(c, i1);
if (i2 == str.npos)
@@ -500,7 +500,7 @@
{
// convert hex dump to vector
vector<unsigned char> vch;
- loop
+ while (true)
{
while (isspace(*psz))
psz++;
@@ -954,7 +954,7 @@
bool WildcardMatch(const char* psz, const char* mask)
{
- loop
+ while (true)
{
switch (*mask)
{
--- util.h Thu Dec 05 13:11:26 2013
+++ util.h Tue Dec 31 02:25:11 2013
@@ -37,7 +37,6 @@
static const int64 COIN = 100000000;
static const int64 CENT = 1000000;
-#define loop for (;;)
#define BEGIN(a) ((char*)&(a))
#define END(a) ((char*)&((&(a))[1]))
#define UBEGIN(a) ((unsigned char*)&(a))
--- wallet.cpp Thu Dec 05 13:11:26 2013
+++ wallet.cpp Tue Dec 31 02:25:11 2013
@@ -1173,7 +1173,7 @@
LOCK2(cs_main, cs_wallet);
{
nFeeRet = nTransactionFee;
- loop
+ while (true)
{
wtxNew.vin.clear();
wtxNew.vout.clear();
--- walletdb.cpp Thu Dec 05 13:11:26 2013
+++ walletdb.cpp Tue Dec 31 02:25:11 2013
@@ -73,7 +73,7 @@
if (!pcursor)
throw runtime_error("CWalletDB::ListAccountCreditDebit() : cannot create DB cursor");
unsigned int fFlags = DB_SET_RANGE;
- loop
+ while (true)
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
@@ -415,7 +415,7 @@
return DB_CORRUPT;
}
- loop
+ while (true)
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
--- qt/addressbookpage.cpp Thu Dec 05 13:11:26 2013
+++ qt/addressbookpage.cpp Tue Dec 31 02:25:11 2013
@@ -143,8 +143,13 @@
ui->tableView->sortByColumn(0, Qt::AscendingOrder);
// Set column widths
+#if QT_VERSION < 0x050000
ui->tableView->horizontalHeader()->setResizeMode(AddressTableModel::Label, QHeaderView::Stretch);
ui->tableView->horizontalHeader()->setResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents);
+#else
+ ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Label, QHeaderView::Stretch);
+ ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents);
+#endif
connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(selectionChanged()));
--- qt/bitcoin.cpp Thu Dec 05 13:11:26 2013
+++ qt/bitcoin.cpp Tue Dec 31 02:25:11 2013
@@ -17,7 +17,9 @@
#include "splashscreen.h"
#include <QMessageBox>
+#if QT_VERSION < 0x050000
#include <QTextCodec>
+#endif
#include <QLocale>
#include <QTimer>
#include <QTranslator>
@@ -118,9 +120,11 @@
// Command-line options take precedence:
ParseParameters(argc, argv);
+#if QT_VERSION < 0x050000
// Internal string conversion is all UTF-8
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForTr());
+#endif
Q_INIT_RESOURCE(bitcoin);
QApplication app(argc, argv);
--- qt/bitcoingui.cpp Thu Dec 05 13:11:26 2013
+++ qt/bitcoingui.cpp Tue Dec 31 02:25:11 2013
@@ -44,7 +44,9 @@
#include <QMovie>
#include <QTimer>
#include <QDragEnterEvent>
+#if QT_VERSION < 0x050000
#include <QUrl>
+#endif
#include <QMimeData>
#include <QStyle>
#include <QSettings>
--- qt/guiutil.cpp Thu Dec 05 13:11:26 2013
+++ qt/guiutil.cpp Tue Dec 31 02:25:11 2013
@@ -13,8 +13,12 @@
#include <QDoubleValidator>
#include <QFont>
#include <QLineEdit>
+#if QT_VERSION >= 0x050000
+#include <QUrlQuery>
+#else
#include <QUrl>
-#include <QTextDocument> // For Qt::escape
+#endif
+#include <QTextDocument> // for Qt::mightBeRichText
#include <QAbstractItemView>
#include <QClipboard>
#include <QFileDialog>
@@ -86,7 +90,13 @@
SendCoinsRecipient rv;
rv.address = uri.path();
rv.amount = 0;
+
+#if QT_VERSION < 0x050000
QList<QPair<QString, QString> > items = uri.queryItems();
+#else
+ QUrlQuery uriQuery(uri);
+ QList<QPair<QString, QString> > items = uriQuery.queryItems();
+#endif
for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
{
bool fShouldReturnFalse = false;
@@ -139,7 +149,11 @@
QString HtmlEscape(const QString& str, bool fMultiLine)
{
+#if QT_VERSION < 0x050000
QString escaped = Qt::escape(str);
+#else
+ QString escaped = str.toHtmlEscaped();
+#endif
if(fMultiLine)
{
escaped = escaped.replace("\n", "<br>\n");
@@ -176,7 +190,11 @@
QString myDir;
if(dir.isEmpty()) // Default to user documents location
{
+#if QT_VERSION < 0x050000
myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
+#else
+ myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
+#endif
}
else
{
--- qt/paymentserver.cpp Thu Dec 05 13:11:26 2013
+++ qt/paymentserver.cpp Tue Dec 31 02:25:11 2013
@@ -18,7 +18,9 @@
#include <QLocalServer>
#include <QLocalSocket>
#include <QStringList>
+#if QT_VERSION < 0x050000
#include <QUrl>
+#endif
using namespace boost;
--- qt/qrcodedialog.cpp Thu Dec 05 13:11:26 2013
+++ qt/qrcodedialog.cpp Tue Dec 31 02:25:11 2013
@@ -7,7 +7,9 @@
#include "optionsmodel.h"
#include <QPixmap>
+#if QT_VERSION < 0x050000
#include <QUrl>
+#endif
#include <qrencode.h>
--- qt/rpcconsole.cpp Thu Dec 05 13:11:26 2013
+++ qt/rpcconsole.cpp Tue Dec 31 02:25:11 2013
@@ -8,7 +8,9 @@
#include <QTime>
#include <QThread>
#include <QKeyEvent>
+#if QT_VERSION < 0x050000
#include <QUrl>
+#endif
#include <QScrollBar>
#include <openssl/crypto.h>
--- qt/sendcoinsdialog.cpp Thu Dec 05 13:11:26 2013
+++ qt/sendcoinsdialog.cpp Tue Dec 31 02:25:11 2013
@@ -93,7 +93,11 @@
QStringList formatted;
foreach(const SendCoinsRecipient &rcp, recipients)
{
+#if QT_VERSION < 0x050000
formatted.append(tr("<b>%1</b> to %2 (%3)").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount), Qt::escape(rcp.label), rcp.address));
+#else
+ formatted.append(tr("<b>%1</b> to %2 (%3)").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount), rcp.label.toHtmlEscaped(), rcp.address));
+#endif
}
fNewRecipientAllowed = false;
--- qt/transactionview.cpp Thu Dec 05 13:11:26 2013
+++ qt/transactionview.cpp Tue Dec 31 02:25:11 2013
@@ -176,7 +176,11 @@
transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Status, 23);
transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Date, 120);
transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Type, 120);
+#if QT_VERSION < 0x050000
transactionView->horizontalHeader()->setResizeMode(TransactionTableModel::ToAddress, QHeaderView::Stretch);
+#else
+ transactionView->horizontalHeader()->setSectionResizeMode(TransactionTableModel::ToAddress, QHeaderView::Stretch);
+#endif
transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Amount, 100);
}
}
--- qt/walletview.cpp Thu Dec 05 13:11:26 2013
+++ qt/walletview.cpp Tue Dec 31 02:25:11 2013
@@ -21,7 +21,11 @@
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QAction>
+#if QT_VERSION < 0x050000
#include <QDesktopServices>
+#else
+#include <QStandardPaths>
+#endif
#include <QFileDialog>
#include <QPushButton>
@@ -233,7 +237,11 @@
void WalletView::backupWallet()
{
+#if QT_VERSION < 0x050000
QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
+#else
+ QString saveDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
+#endif
QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)"));
if (!filename.isEmpty()) {
if (!walletModel->backupWallet(filename)) {
From a windows command prompt configure and make:
set PATH=%PATH%;C:\Qt\5.2.1\bin
cd C:\bitcoin-0.8.6\
qmake "USE_QRCODE=1" "USE_UPNP=1" "USE_IPV6=1" bitcoin-qt.pro
mingw32-make -f Makefile.Release
Last updated on 23/4/2014:
removed python and activestate perl as they are not needed with current qt config options,
use -openssl-linked instead of -openssl (see src\network\ssl\qsslsocket_openssl_symbols.cpp for more info),
do not compile shared libraries when building dependencies,
libpng 1.6.10.