Bitcoin Forum
April 19, 2024, 02:46:24 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 ... 60 »
  Print  
Author Topic: Building headless Bitcoin and Bitcoin-qt on Windows  (Read 419322 times)
nitrogenetics (OP)
Full Member
***
Offline Offline

Activity: 131
Merit: 108



View Profile
March 05, 2013, 10:26:41 PM
Last edit: February 08, 2015, 09:46:59 PM by nitrogenetics
Merited by ABCbits (3), neiros (1), Husna QA (1), cinnamon_carter (1), fisheater (1), ItaCraft (1)
 #1

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. Wink

Please note this is mostly for testing purposes. Always use official executables on production environments.
The following instructions are intended for use with version 0.9.4. See additional notes if compiling 0.10rc4 or an older 0.8.6 branch.

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/download
From MinGW installation manager -> All packages -> MSYS
mark the following for installation:

msys-base-bin
msys-autoconf-bin
msys-automake-bin
msys-libtool-bin


then 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 MinGW-builds project toolchain:
Download http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/4.9.2/threads-posix/dwarf/i686-4.9.2-release-posix-dwarf-rt_v3-rev1.7z/download
and unpack it to C:\

1.3. Ensure that mingw-builds bin folder is set in your PATH environment variable. On Windows 7 your path should look something like:
Code:
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:
Code:
$ 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.9.2/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-4.9.2/configure --host=i686-w64-mingw32 --build=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c/mingw492/i686-492-posix-dwarf-rt_v3-rev1/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/mingw492/prerequisites/i686-w64-mingw32-static --with-mpfr=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-mpc=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-isl=/c/mingw492/prerequisites/i686-w64-mingw32-static --with-cloog=/c/mingw492/prerequisites/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='i686-posix-dwarf-rev1, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw492/i686-492-posix-dwarf-rt_v3-rev1/mingw32/opt/include -I/c/mingw492/prerequisites/i686-zlib-static/include -I/c/mingw492/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw492/i686-492-posix-dwarf-rt_v3-rev1/mingw32/opt/include -I/c/mingw492/prerequisites/i686-zlib-static/include -I/c/mingw492/prerequisites/i686-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw492/i686-492-posix-dwarf-rt_v3-rev1/mingw32/opt/lib -L/c/mingw492/prerequisites/i686-zlib-static/lib -L/c/mingw492/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
Thread model: posix
gcc version 4.9.2 (i686-posix-dwarf-rev1, 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.1l.tar.gz
From 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:
Code:
cd /c/deps/
tar xvfz openssl-1.0.1l.tar.gz
cd openssl-1.0.1l
./Configure no-zlib no-shared no-dso no-krb5 no-camellia no-capieng no-cast no-cms no-dtls1 no-gost no-gmp no-heartbeats no-idea no-jpake no-md2 no-mdc2 no-rc5 no-rdrand no-rfc3779 no-rsax no-sctp no-seed no-sha0 no-static_engine no-whirlpool no-rc2 no-rc4 no-ssl2 no-ssl3 mingw
make

2.2 Berkeley DB: http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
We'll use version 4.8 to preserve binary wallet compatibility.
From a MinGW shell unpack the source archive, configure and make:
Code:
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.57.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:
Code:
cd C:\deps\boost_1_57_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_57_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.20150206.tar.gz
Unpack Miniupnpc to C:\deps, rename containing folder from "miniupnpc-1.9.20150206" to "miniupnpc" then from a Windows command prompt:
Code:
cd C:\deps\miniupnpc
mingw32-make -f Makefile.mingw init upnpc-static

2.5 protoc and libprotobuf:
Download https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
Then from msys shell
Code:
tar xvfz protobuf-2.6.1.tar.gz
cd /c/deps/protobuf-2.6.1
configure --disable-shared
make

2.6 qrencode:
Download and unpack http://download.sourceforge.net/libpng/libpng-1.6.16.tar.gz inside your deps folder then configure and make:
Code:
cd /c/deps/libpng-1.6.16
configure --disable-shared
make
cp .libs/libpng16.a .libs/libpng.a

Download and unpack http://fukuchi.org/works/qrencode/qrencode-3.4.4.tar.gz inside your deps folder then configure and make:
Code:
cd /c/deps/qrencode-3.4.4

LIBS="../libpng-1.6.16/.libs/libpng.a ../../mingw32/i686-w64-mingw32/lib/libz.a" \
png_CFLAGS="-I../libpng-1.6.16" \
png_LIBS="-L../libpng-1.6.16/.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.3/5.3.2/submodules/qtbase-opensource-src-5.3.2.7z
http://download.qt-project.org/official_releases/qt/5.3/5.3.2/submodules/qttools-opensource-src-5.3.2.7z
Then from a windows command prompt (note that the following assumes qtbase has been unpacked to C:\Qt\5.3.2 and qttools have been unpacked to C:\Qt\qttools-opensource-src-5.3.2):
Code:
set INCLUDE=C:\deps\libpng-1.6.16;C:\deps\openssl-1.0.1l\include
set LIB=C:\deps\libpng-1.6.16\.libs;C:\deps\openssl-1.0.1l

cd C:\Qt\5.3.2
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 -no-dbus -no-audio-backend -no-wmf-backend -no-qml-debug

mingw32-make

set PATH=%PATH%;C:\Qt\5.3.2\bin

cd C:\Qt\qttools-opensource-src-5.3.2
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.4 from git https://github.com/bitcoin/bitcoin/archive/v0.9.4.zip

From msys shell configure and make bitcoin:
Code:
cd /c/bitcoin-0.9.4

./autogen.sh

CPPFLAGS="-I/c/deps/db-4.8.30.NC/build_unix \
-I/c/deps/openssl-1.0.1l/include \
-I/c/deps \
-I/c/deps/protobuf-2.6.1/src \
-I/c/deps/libpng-1.6.16 \
-I/c/deps/qrencode-3.4.4" \
LDFLAGS="-L/c/deps/db-4.8.30.NC/build_unix \
-L/c/deps/openssl-1.0.1l \
-L/c/deps/miniupnpc \
-L/c/deps/protobuf-2.6.1/src/.libs \
-L/c/deps/libpng-1.6.16/.libs \
-L/c/deps/qrencode-3.4.4/.libs" \
BOOST_ROOT=/c/deps/boost_1_57_0 \
./configure \
--disable-upnp-default \
--disable-tests \
--with-qt-incdir=/c/Qt/5.3.2/include \
--with-qt-libdir=/c/Qt/5.3.2/lib \
--with-qt-plugindir=/c/Qt/5.3.2/plugins \
--with-qt-bindir=/c/Qt/5.3.2/bin \
--with-protoc-bindir=/c/deps/protobuf-2.6.1/src

make

strip src/bitcoin-cli.exe
strip src/bitcoind.exe
strip src/qt/bitcoin-qt.exe



Additional notes:
64 bit binaries
64 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.9.2/threads-posix/seh/x86_64-4.9.2-release-posix-seh-rt_v3-rev1.7z/download

All dependencies must be rebuilt with the above toolchain.
Openssl should be configured for:
Code:
mingw64
instead of:
Code:
mingw


Bitcoin v0.10rc4
Since v0.10 Bitcoin depends on gmp: https://gmplib.org/download/gmp/gmp-6.0.0a.tar.xz
Compile it in a msys shell
Code:
tar xvf gmp-6.0.0a.tar.xz
cd /c/deps/gmp-6.0.0
./configure --disable-shared
make

Then add relevant CPPFLAGS and LDFLAGS when configuring Bitcoin:
Code:
CPPFLAGS="-I/c/deps/db-4.8.30.NC/build_unix \
-I/c/deps/openssl-1.0.1l/include \
-I/c/deps \
-I/c/deps/protobuf-2.6.1/src \
-I/c/deps/libpng-1.6.16 \
-I/c/deps/qrencode-3.4.4 \
-I/c/deps/gmp-6.0.0" \
LDFLAGS="-L/c/deps/db-4.8.30.NC/build_unix \
-L/c/deps/openssl-1.0.1l \
-L/c/deps/miniupnpc \
-L/c/deps/protobuf-2.6.1/src/.libs \
-L/c/deps/libpng-1.6.16/.libs \
-L/c/deps/qrencode-3.4.4/.libs \
-L/c/deps/gmp-6.0.0/.libs" \
BOOST_ROOT=/c/deps/boost_1_57_0 \
./configure \
--disable-upnp-default \
--disable-tests \
--with-qt-incdir=/c/Qt/5.3.2/include \
--with-qt-libdir=/c/Qt/5.3.2/lib \
--with-qt-plugindir=/c/Qt/5.3.2/plugins \
--with-qt-bindir=/c/Qt/5.3.2/bin \
--with-protoc-bindir=/c/deps/protobuf-2.6.1/src


Compiling with unit tests
In order to build unit tests you will need the following:
-boost
Boost must be configured with --with-test option also.

-hexdump
To generate test data an hexdump like program is needed.
Download and unpack https://github.com/wahern/hexdump then compile hexdump.exe by running:
Code:
gcc -std=gnu99 -g -O2 -Wall -Wextra -Werror -Wno-unused-variable -Wno-unused-parameter hexdump.c -DHEXDUMP_MAIN -o hexdump.exe
Do not forget to add hexdump folder to your PATH environment variable.

-bitcoin
In order to work with the previously compiled hexdump version Makefile must be patched (src/Makefile.test.include if v0.10, src/Makefile.include if v0.9):
Code:
--- src/Makefile.test.include	Tue Dec 23 20:14:37 2014
+++ src/Makefile.test.include Sat Jan 10 16:53:56 2015
@@ -111,7 +111,7 @@
  @$(MKDIR_P) $(@D)
  @echo "namespace json_tests{" > $@
  @echo "static unsigned const char $(*F)[] = {" >> $@
- @$(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x  ,//g' >> $@
+ @$(HEXDUMP) -e '8/1 "0x%02x, "' $< | $(SED) -e 's/0x  ,//g' >> $@
  @echo "};};" >> $@
  @echo "Generated $@"
 
@@ -119,6 +119,6 @@
  @$(MKDIR_P) $(@D)
  @echo "namespace alert_tests{" > $@
  @echo "static unsigned const char $(*F)[] = {" >> $@
- @$(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x  ,//g' >> $@
+ @$(HEXDUMP) -e '8/1 "0x%02x, "' $< | $(SED) -e 's/0x  ,//g' >> $@
  @echo "};};" >> $@
  @echo "Generated $@"

bitcoin must be configured without --disable-tests option.






Additional notes for older Bitcoin 0.8.6 (may be useful for Bitcoin based altcoins)
msys-autoconf, msys-automake and msys-libtool at step 1.1 are not needed. You can skip steps 2.5 and 2.7.
Note that openssl v1.0.1k and later may lead to consesus forks:
http://sourceforge.net/p/bitcoin/mailman/message/33221963/

Compile bitcoind 0.8.6: https://github.com/bitcoin/bitcoin/archive/v0.8.6.zip

With a texteditor edit BOOST_SUFFIX, INCLUDEPATHS and LIBPATHS in your C:\bitcoin-0.8.6\src\makefile.mingw according to your dependencies location:
Code:
BOOST_SUFFIX?=-mgw49-mt-s-1_57

INCLUDEPATHS= \
 -I"$(CURDIR)" \
 -I"/c/deps/boost_1_57_0" \
 -I"/c/deps/db-4.8.30.NC/build_unix" \
 -I"/c/deps/openssl-1.0.1j/include"
 
LIBPATHS= \
 -L"$(CURDIR)/leveldb" \
 -L"/c/deps/boost_1_57_0/stage/lib" \
 -L"/c/deps/db-4.8.30.NC/build_unix" \
 -L"/c/deps/openssl-1.0.1j"

and add -static option to LDFLAGS in makefile.mingw to compile a statically linked executable.
Code:
LDFLAGS=-Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -static

makefile.mingw patch:
Code:
--- makefile.mingw	Thu Dec 05 14:11:26 2013
+++ makefile.mingw Thu Jun 19 20:00:00 2014
@@ -21,15 +21,19 @@
 USE_IPV6:=1
 
 DEPSDIR?=/usr/local
-BOOST_SUFFIX?=-mgw46-mt-sd-1_52
+BOOST_SUFFIX?=-mgw49-mt-s-1_57
 
 INCLUDEPATHS= \
  -I"$(CURDIR)" \
- -I"$(DEPSDIR)/include"
-
+ -I"/c/deps/boost_1_57_0" \
+ -I"/c/deps/db-4.8.30.NC/build_unix" \
+ -I"/c/deps/openssl-1.0.1j/include"
+
 LIBPATHS= \
  -L"$(CURDIR)/leveldb" \
- -L"$(DEPSDIR)/lib"
+ -L"/c/deps/boost_1_57_0/stage/lib" \
+ -L"/c/deps/db-4.8.30.NC/build_unix" \
+ -L"/c/deps/openssl-1.0.1j"
 
 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
Code:
USE_UPNP:=1
and add miniupnpc path to INCLUDEPATHS and LIBPATHS:
Code:
INCLUDEPATHS= \
 -I"$(CURDIR)" \
 -I"/c/deps/boost_1_57_0" \
 -I"/c/deps" \
 -I"/c/deps/db-4.8.30.NC/build_unix" \
 -I"/c/deps/openssl-1.0.1j/include"
 
LIBPATHS= \
 -L"$(CURDIR)/leveldb" \
 -L"/c/deps/boost_1_57_0/stage/lib" \
 -L"/c/deps/miniupnpc" \
 -L"/c/deps/db-4.8.30.NC/build_unix" \
 -L"/c/deps/openssl-1.0.1j"

From Msys shell compile bitcoind:
Code:
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.6/qt-everywhere-opensource-src-4.8.6.zip
Note that due to a bug in qt 4.8.6 you will need to explicitly enable windows styles: https://bugreports.qt-project.org/browse/QTBUG-38706
Assuming qt sources have been unpacked to C:\Qt\4.8.6, from a windows command prompt:
Code:
cd C:\Qt\4.8.6
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 -qt-style-windows -qt-style-windowsxp -qt-style-windowsvista -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:
Code:
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:
Code:
# 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=-mgw49-mt-s-1_57
BOOST_INCLUDE_PATH=C:/deps/boost_1_57_0
BOOST_LIB_PATH=C:/deps/boost_1_57_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.1j/include
OPENSSL_LIB_PATH=C:/deps/openssl-1.0.1j
MINIUPNPC_INCLUDE_PATH=C:/deps/
MINIUPNPC_LIB_PATH=C:/deps/miniupnpc
QRENCODE_INCLUDE_PATH=C:/deps/qrencode-3.4.4
QRENCODE_LIB_PATH=C:/deps/qrencode-3.4.4/.libs

Comment out genleveldb.commands for win32
Code:
    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:
Code:
CONFIG += static

Code:
win32:QMAKE_LFLAGS *= -Wl,--large-address-aware -static

bitcoin-qt.pro patch:
Code:
--- bitcoin-qt.pro	Thu Dec 05 14:11:26 2013
+++ bitcoin-qt.pro Thu Jun 19 20:00:00 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=-mgw49-mt-s-1_57
+BOOST_INCLUDE_PATH=C:/deps/boost_1_57_0
+BOOST_LIB_PATH=C:/deps/boost_1_57_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.1j/include
+OPENSSL_LIB_PATH=C:/deps/openssl-1.0.1j
+MINIUPNPC_INCLUDE_PATH=C:/deps/
+MINIUPNPC_LIB_PATH=C:/deps/miniupnpc
+QRENCODE_INCLUDE_PATH=C:/deps/qrencode-3.4.4
+QRENCODE_LIB_PATH=C:/deps/qrencode-3.4.4/.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:
Code:
set PATH=%PATH%;C:\Qt\4.8.6\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 08/02/2015
bitcoin 0.9.4
toolchain: i686-4.9.2-release-posix-dwarf-rt_v3-rev1
openssl-1.0.1l
libpng-1.6.16
miniupnpc-1.9.20150206.tar.gz

10/01/2015
compiling unit tests

30/11/2014
toolchain: i686-4.9.2-release-posix-dwarf-rt_v3-rev0
boost_1_57_0
protobuf-2.6.1
libpng-1.6.15
miniupnpc-1.9.20141128
gmp-6.0.0a for current master

28/10/2014
openssl-1.0.1j
libpng-1.6.14
do not build unnecessary openssl ciphers and protocols
use BOOST_ROOT when configuring bitcoin

28/09/2014
toolchain: i686-4.9.1-release-posix-dwarf-rt_v3-rev1
bitcoin 0.9.3
miniupnpc-1.9.20140911 https://github.com/bitcoin/bitcoin/commit/9f7f504efca27c7d390f121410846b45c1732761
qt5.3.2

10/08/2014
update toolchain i686-4.9.1-release-posix-dwarf-rt_v3-rev0
update dependencies openssl-1.0.1i qrencode-3.4.4 qt4.8.6

02/7/2014
qt5.3.1

20/6/2014
bitcoin 0.9.2.1
mingw-builds 4.9.0 rev2
openssl-1.0.1h
qt5.3
libpng-1.6.12
removed older instructions about bitcoin 0.8.6 with qt5

25/5/2014:
update toolchain
added makefile patch commit

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.

BTC: 1NWQ4TarCCC7j1XY26KRFFEtLYbPP6S3DH
XRP: rJkbeyRaUYDmcukEyLYVfn56QDM9VhybZG
The forum strives to allow free discussion of any ideas. All policies are built around this principle. This doesn't mean you can post garbage, though: posts should actually contain ideas, and these ideas should be argued reasonably.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
zeph97
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
April 08, 2013, 02:27:08 PM
 #2

It works... Thanks for writing this guide.
grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
April 12, 2013, 12:21:20 AM
 #3

Great guide. Now that you're not a newbie anymore, consider moving it to "Development & Technical Discussion" so it doesn't get buried with all the other newbie threads. Also, is it possible to expand your guide to include building the qt client?

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
nitrogenetics (OP)
Full Member
***
Offline Offline

Activity: 131
Merit: 108



View Profile
April 15, 2013, 09:47:17 PM
 #4

Unfortunately I never tried building the qt client, I'll see if I can have a look at it and report back if I manage to build it successfully Wink

BTC: 1NWQ4TarCCC7j1XY26KRFFEtLYbPP6S3DH
XRP: rJkbeyRaUYDmcukEyLYVfn56QDM9VhybZG
wumpus
Hero Member
*****
qt
Offline Offline

Activity: 812
Merit: 1022

No Maps for These Territories


View Profile
April 16, 2013, 04:14:11 PM
 #5

Please update the build-msw.txt Smiley

Bitcoin Core developer [PGP] Warning: For most, coin loss is a larger risk than coin theft. A disk can die any time. Regularly back up your wallet through FileBackup Wallet to an external storage or the (encrypted!) cloud. Use a separate offline wallet for storing larger amounts.
Remember remember the 5th of November
Legendary
*
Offline Offline

Activity: 1862
Merit: 1011

Reverse engineer from time to time


View Profile
April 16, 2013, 04:19:00 PM
 #6

It's possible to compile Bitcoin-Qt as well, done it already. Depending on your toolchain(GCC 4.7+), you may need to compile the Qt libraries from source, only takes about an hour or so. Then the rest is easy.

BTC:1AiCRMxgf1ptVQwx6hDuKMu4f7F27QmJC2
Garr255
Legendary
*
Offline Offline

Activity: 938
Merit: 1000


What's a GPU?


View Profile
April 17, 2013, 06:53:26 AM
 #7

Thanks for this. I sent you a tip Wink

“First they ignore you, then they laugh at you, then they fight you, then you win.”  -- Mahatma Gandhi

Average time between signing on to bitcointalk: Two weeks. Please don't expect responses any faster than that!
nitrogenetics (OP)
Full Member
***
Offline Offline

Activity: 131
Merit: 108



View Profile
April 18, 2013, 08:16:08 PM
 #8

Thanks for this. I sent you a tip Wink

Thanks, much appreciated  Wink

It's possible to compile Bitcoin-Qt as well, done it already. Depending on your toolchain(GCC 4.7+), you may need to compile the Qt libraries from source, only takes about an hour or so. Then the rest is easy.

Building a dinamically linked executable was almost straightforward (didn't have time to check if it actually works), however I was unable to get a statically linked executable (lots of undefined references from ld) after compiling static qt libs. Need to investigate further.
I will update the first post with the required steps in the next few days.


BTC: 1NWQ4TarCCC7j1XY26KRFFEtLYbPP6S3DH
XRP: rJkbeyRaUYDmcukEyLYVfn56QDM9VhybZG
nitrogenetics (OP)
Full Member
***
Offline Offline

Activity: 131
Merit: 108



View Profile
April 22, 2013, 11:16:34 PM
 #9

is it possible to expand your guide to include building the qt client?

Bitcoin-qt build instrunctions added Smiley

BTC: 1NWQ4TarCCC7j1XY26KRFFEtLYbPP6S3DH
XRP: rJkbeyRaUYDmcukEyLYVfn56QDM9VhybZG
AlexMerced
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 28, 2013, 11:18:06 PM
 #10

is it possible to do this from codeblocks?

grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
April 28, 2013, 11:50:02 PM
 #11

is it possible to do this from codeblocks?
not sure if trolling or just ignorant.

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
AlexMerced
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 29, 2013, 12:09:40 AM
 #12

Ignorant, sorry

grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
April 29, 2013, 12:19:50 AM
 #13

Ignorant, sorry
just edit whatever code you want to edit in your IDE, and follow the steps to compile it. And no, there's no easy 1click compile for windows.

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
AlexMerced
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 29, 2013, 12:55:51 PM
 #14

I figured out my confusion after some research

Apparently code block uses it's project files in lieu of make files, but there are ways to use make files when compiling in code blocks, go it.

My confusion was when I've compiled stuff using codeblocks I never needed a makefile, but now I see why. I just got my hands on VS12 so eventually I'll have to learn how to use that.

Apologize, I havn't done C++ in 10 years since college and back in those days I used a borland compiler on a unix server and never did anything that complex.

Right now I'm re-learning everything and getting a crash course in Programming, Cryptography and Bitcoin source code. Although I have learned a lot in a short period of time although this project will take awhile but my current goal is to successfully compile Litecoin so I can see how it's done, then understand the genesis block code which I conceptually am starting to get now it's just a matter of seeing how it translates in code.

(spent the weekend reading on the history and concept of proof of work, etc.)

CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
April 29, 2013, 01:05:38 PM
 #15

Apologize, I havn't done C++ in 10 years since college and back in those days I used a borland compiler on a unix server and never did anything that complex.

Borland *compiler* on unix?

Are you perhaps referring to the C++ BuilderX environment (which is *not* a compiler)?

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
AlexMerced
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 29, 2013, 01:41:15 PM
 #16

probably, again, ignorance

I'm trying to fix it though, once I start learning something I usually get obsessed until I know everything so give me a couple of months and we'll see what I'm at.

grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
April 29, 2013, 02:08:37 PM
 #17

My confusion was when I've compiled stuff using codeblocks I never needed a makefile, but now I see why. I just got my hands on VS12 so eventually I'll have to learn how to use that.
VC++ uses "project" files as well, but they have support for msbuild makefiles. keep in mind that the makefiles included with bitcoin are not msbuild compatible.

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
AlexMerced
Member
**
Offline Offline

Activity: 84
Merit: 10



View Profile WWW
April 29, 2013, 02:15:09 PM
 #18

thanks, I'll play with that, I want to get gitian builder setup in my VMbox but I'm not sure how to install it from the source (I assume you compile, but as you can see I'm learning about compiling at the moment making it hard for me to install gitian)

wiggi
Sr. Member
****
Offline Offline

Activity: 403
Merit: 251


View Profile
April 29, 2013, 02:19:35 PM
 #19

is it possible to do this from codeblocks?

The Qt Sdk from Nokia is actually a very good IDE (the best free-as-in-beer one, I think),
and because bitcoin code comes with the project file for it, you should use it for editing.
grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
April 29, 2013, 02:28:37 PM
 #20

thanks, I'll play with that, I want to get gitian builder setup in my VMbox but I'm not sure how to install it from the source (I assume you compile, but as you can see I'm learning about compiling at the moment making it hard for me to install gitian)
gitian is pretty easy. it sets up the vm, installs all the packages needed for compilation, and compiles it. It's all done inside a vm with scripts (included with bitcoin), so it's actually easier than compiling using your own tools.

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
Pages: [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 ... 60 »
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!