tar -xvf db-4.8.30.NC.tar.gz cd db-4.8.30.NC/build_unix mkdir -p build BDB_PREFIX=$(pwd)/build ../dist/configure --disable-shared --enable-cxx --with-pic --prefix=$BDB_PREFIX make make install cd ../..
compile primecoind
cd src/ BDB_INCLUDE_PATH=${BDB_PREFIX}/include BDB_LIB_PATH=${BDB_PREFIX}/lib make -f makefile.unix STATIC=1 # 清除编译产生的可执行文件及目标文件(object file,*.o) make -f makefile.unix clean
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.
下面使用 32bit 操作,如果需要64bit 对应换一下mingw64 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\
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.9.2/lto-wrapper.exe Target: i686-w64-mingw32 ... Thread model: posix gcc version 4.9.2 (i686-posix-dwarf-rev1, Built by MinGW-W64 project)
Download, unpack and build required dependencies. I’ll save them in c:\deps folder.
depends
Warning: you need clean before build 64/32 separately
download 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:
32bit
cd /c/deps/ tar xvfz openssl-1.0.1g.tar.gz cd openssl-1.0.1g ./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
64bit
cd /c/deps/ tar xvfz openssl-1.0.1g.tar.gz cd openssl-1.0.1g ./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 mingw64 make
Berkeley DB
download 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
Boost
download Download either the zip or the 7z archive, unpack boost inside your C:\deps folder, then bootstrap and compile 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.
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 Upnp support is disabled by default. If you want to compile with upnp support set USE_UPNP:=1
and add miniupnpc path to INCLUDEPATHS and LIBPATHS:
// for mingw64 compile #if !defined(__MINGW32__) || !defined(_PID_T_) || defined(_NO_OLDNAMES) typedef int pid_t; /* define for Windows compatibility */ #endif
unrecognized option '--large-address-aware' solution: remove -Wl,--large-address-aware, this is only for x86 target
Note that if you skipped primecoind 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/primecoin-0.8.6/src/leveldb TARGET_OS=NATIVE_WINDOWS make libleveldb.a libmemenv.a
Edit C:\primecoin-0.8.6\primecoin-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