Bitcoin Forum
November 08, 2024, 01:40:16 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [XPM][WIN] Compiling beeeeer.org miner on Windows +5% Performance  (Read 1428 times)
kalup (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile WWW
December 10, 2013, 04:56:14 AM
Last edit: December 10, 2013, 05:23:29 AM by kalup
 #1

Ok, after hours of works i finally compiled primeminer under windows!!! You may ask why I'm spending 3 hours in compiling it when there are already binaries there around...well there are two reasons, the first is that i don't trust binaries w/o source code and the second is performance.
Yes, performance!!! Compiling my own primeminer i got a 5% performance improvement (tnx to gmp optimizations)!!

Anyway any donation is welcome!! (I may be persuaded to create an automatic installer Tongue)
 AGgPQKp7YAau1zUZqf6Pxqr3dnqoEqyBCm




1. Prepare your build system.


1.1 Install msys:
http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download
Leave default location (C:\MinGW)
move to C:\MinGW\bin and run mingw-get
Select "basic setup -> msys-base package"
and "All Packages -> msys-m4".
Then click on Installation -> Apply Changes.

1.2 Install Perl:
http://downloads.activestate.com/ActivePerl/releases/5.18.1.1800/ActivePerl-5.18.1.1800-MSWin32-x86-64int-297570.msi
Run installer and exclude Perl Script, PPM, documentation and examples if you don't need them for other purposes.

1.3 Install Python:
http://www.python.org/ftp/python/3.3.2/python-3.3.2.amd64.msi
Leave defaults values.

1.4 Install GCC from mingw-builds:
Download http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/32-bit/threads-posix/dwarf/x32-4.8.1-release-posix-dwarf-rev5.7z/download
Then unpack it in C: (you will obtain a C:\mingw32 folder)

1.5. Ensure that mingw-builds, Perl and Python bin folders are set in your PATH environment variable.
Open cmd and write
Code:
echo %path%
insert missing path using those commands (avoid those for wich path already exists)
Code:
SET PATH=%PATH%;"C:\Perl\site\bin"
SET PATH=%PATH%;"C:\Perl\bin"
SET PATH=%PATH%;"C:\mingw32\bin"
SET PATH=%PATH%;"C:\Pyton33"


2. Download, unpack and build required dependencies.

Create a new folder: C:\deps\
All file downloaded in that session have to be placed there.

2.1 OpenSSL: http://www.openssl.org/source/openssl-1.0.1c.tar.gz
From a MinGw shell (C:\MinGW\msys\1.0\msys.bat), unpack the source archive with tar then configure and make:
Code:
cd /c/deps/
tar xvfz openssl-1.0.1c.tar.gz
cd openssl-1.0.1c
./config
make

2.2 Berkeley DB: http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
From a MinGW shell unpack the source archive, configure, edit line 113 of db.h then make:
Code:
cd /c/deps/
tar xvfz db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
../dist/configure --disable-replication --enable-mingw --enable-cxx

after configuring make sure to edit your C:\deps\db-4.8.30.NC\build_unix\db.h by replacing line 113:
Code:
typedef pthread_t db_threadid_t;
with
Code:
typedef u_int32_t db_threadid_t;
Thanks to Icy, see: https://bitcointalk.org/index.php?topic=45507.0

now you can:
Code:
make
make install

2.3 Boost: http://sourceforge.net/projects/boost/files/boost/1.54.0/boost_1_54_0.tar.gz/download
From a MinGW shell unpack the source archive, then bootstrap and compile from a Windows command prompt:
Code:
cd /c/deps/
tar xvfz boost_1_54_0.tar.gz
Open a Windows command prompt (Start -> Run -> cmd.exe)
Code:
cd C:\deps\boost_1_54_0\
bootstrap.bat mingw
b2 --build-type=complete --with-chrono --with-filesystem --with-program_options --with-system --with-thread toolset=gcc stage

This will compile the required boost libraries and put them into the stage folder (C:\deps\boost_1_54_0\stage).

2.4 Miniupnpc: http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.8.tar.gz
From a MinGW shell unpack the source archive, then make
Code:
cd /c/deps/
tar xvfz miniupnpc-1.8.tar.gz
Move to C:\deps\miniupnpc-1.8 folder, double click on mingw32make.bat.

2.5 GMP: https://gmplib.org/download/gmp/gmp-5.1.2.tar.xz
From a MinGW shell unpack the source archive, configure, make and install
Code:
cd /c/deps/
tar xvfJ gmp-5.1.2.tar.xz
cd gmp-5.1.2
./configure --prefix=/c/deps/gmp/ --enable-cxx --with-gnu-ld
make
make install


3. Download Primecoin miner for beeeeer.org from git, compile leveldb then compile primeminer https://github.com/thbaumbach/primecoin/archive/master.zip (specific build version of that guide here, rename that zip into master.zip)
Leveldb libraries will not compile automatically so we'll need to compile them first.

3.1 Extract master.zip (for example to C:\) then start MinGW shell and change into leveldb folder:
Code:
cd /C/master/src/leveldb
TARGET_OS=NATIVE_WINDOWS make libleveldb.a libmemenv.a

3.2 Now with a texteditor edit BOOST_SUFFIX, INCLUDEPATHS and LIBPATHS in your C:\master\src\makefile.mingw according to your dependencies location and correct $(CURDIR) error:
Code:
BOOST_SUFFIX?=-mgw48-mt-s-1_54

INCLUDEPATHS= \
 -I"$(CURDIR)" \
 -I"c:/deps/boost_1_54_0" \
 -I"C:/deps/db-4.8.30.NC/build_unix" \
 -I"c:/deps/openssl-1.0.1c/include" \
 -I"c:/deps/gmp/include"
 
LIBPATHS= \
 -L"$(CURDIR)/leveldb" \
 -L"c:/deps/boost_1_54_0/stage/lib" \
 -L"C:/deps/db-4.8.30.NC/build_unix" \
 -L"c:/deps/openssl-1.0.1c"
 -L"c:/deps/gmp/lib"
If using a gcc version different from 4.8.x change appropriately
Code:
BOOST_SUFFIX?=-mgw##-mt-s-1_54

Then in the same file also add quotes as in the code
Code:
#
# LevelDB support
#
DEFS += $(addprefix -I,"$(CURDIR)/leveldb/include")
DEFS += $(addprefix -I,"$(CURDIR)/leveldb/helpers")

3.3 net.cpp will need to be patched in order to compile with gcc 4.8.1:
Fix invalid conversion error with MinGW 4.8.1 in net.cpp
Open C:\master\src\net.cpp and edit those lines
search for
Code:
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&nOne, sizeof(int));
and substitute with
Code:
#ifdef WIN32
        setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&nOne, sizeof(int));
#else
         setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&nOne, sizeof(int));
#endif
bug reference

3.4 Compile everything and create your .exe
From a Windows command prompt run:
Code:
cd C:\master\src
mingw32-make -f makefile.mingw
strip primeminer.exe

The program is ready to be used!!

4. Launch the program and profit!
Code:
primeminer -poolip=54.200.248.75 -poolport=1337 -pooluser=AGgPQKp7YAau1zUZqf6Pxqr3dnqoEqyBCm -poolpassword=PASSWORD -poolfee=1 -genproclimit=2
Obviously set it with your data!
Pages: [1]
  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!