How to compile xolokram’s primeminer for Mac OS X Mavericks (using homebrew)
A lot of this I discovered while I was compiling primecoind, but the procedure is basically the same (and even more tedious!)
This assumes you have XCode with CLI tools installed
- Install Homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
- Install dependencies
brew install berkeley-db4 boost gmp miniupnpc openssl
- Modify path (for some reason openssl will not relink otherwise)
touch ~/.bash_profile
echo "export PATH=\"/usr/local/bin:\$PATH\"" >> ~/.bash_profile
- Link libraries
brew link openssl --force
brew link berkeley-db4 --force
- Download the git repository:
git clone https://github.com/thbaumbach/primecoin.git
- Switch to the source directory
cd ./primecoin/src
-
Modify the makefile.osx file
A. CHANGE the following line (should be very close to the top) from:
DEPSDIR=/opt/local
to:
DEPSDIR=/usr/local
B. CHANGE the following line from:
-L"$(DEPSDIR)/lib/db48"
to:
-L"$(DEPSDIR)/Cellar/berkeley-db4/4.8.30/lib"
C. REMOVE the following line:
obj/init.o \
D. CHANGE the following block from:
primecoind: $(OBJS:obj/%=obj/%)
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
to:
primeminer: $(OBJS:obj/%=obj/%) obj/main_poolminer.o
$(CXX) $(CFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
-
Modify the serial.h file
A. REMOVE the following lines (should be around line 900 or so):
void insert(iterator it, const_iterator first, const_iterator last)
{
assert(last - first >= 0);
if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
{
// special case for inserting at the front when there's room
nReadPos -= (last - first);
memcpy(&vch[nReadPos], &first[0], last - first);
}
else
vch.insert(it, first, last);
}
-
Modify the main_poolminer.cpp file
A. REMOVE the following lines:
#if defined(__MINGW32__) || defined(__MINGW64__)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
BOOL WINAPI ctrl_handler(DWORD dwCtrlType) {
//'special' cleanup for windows
switch(dwCtrlType) {
case CTRL_C_EVENT:
case CTRL_BREAK_EVENT: {
if (socket_to_server != NULL) {
socket_to_server->close();
socket_to_server = NULL;
}
stats_on_exit();
running = false;
} break;
default: break;
}
return FALSE;
}
#elif defined(__GNUG__)
static sighandler_t set_signal_handler (int signum, sighandler_t signalhandler) {
struct sigaction new_sig, old_sig;
new_sig.sa_handler = signalhandler;
sigemptyset (&new_sig.sa_mask);
new_sig.sa_flags = SA_RESTART;
if (sigaction (signum, &new_sig, &old_sig) < 0)
return SIG_ERR;
return old_sig.sa_handler;
}
void ctrl_handler(int signum) {
exit(1);
}
#endif //TODO: __APPLE__ ?
B. REMOVE the following lines:
#if defined(__MINGW32__) || defined(__MINGW64__)
SetConsoleCtrlHandler(ctrl_handler, TRUE);
#elif defined(__GNUG__)
set_signal_handler(SIGINT, ctrl_handler);
#endif //TODO: __APPLE__
- Compile primeminer
make -f makefile.osx primeminer
That should do it! To run primeminer, you can run the command (just an example):
./primeminer -pooluser=AY7fAWEsYbz1MisFfHdiJn2m61CSJNeywC -poolip=54.200.248.75 -poolport=1337 -genproclimit=4
My 2.8Ghz quad core nehalem is currently getting the following stats:
[STATS] 2013-12-13 23:05:19 | 519 primes/s, 8398 tests/s, 0 5-chains/h, 0.220 chains/d
[STATS] 2013-12-13 23:06:19 | 468 primes/s, 7398 tests/s, 180 5-chains/h, 0.216 chains/d
[STATS] 2013-12-13 23:07:19 | 486 primes/s, 7742 tests/s, 360 5-chains/h, 0.224 chains/d
Hope this helps!
Tips are always welcome
BTC: 1KQ7vnZ7yXDpYbVrGgsjqdaNQ1nku873w4
LTC: LRXQdhR8FevuNdS3xLZH3iHq7uGxymvASU
NMC: MxpAo3iT3gMN6wUR9rr8rWw8WoyKf1HcDo
PPC: P9c3KXPCeh1SLUAmL8FRgkwqBFdkaPEDcA
XPM: AY7fAWEsYbz1MisFfHdiJn2m61CSJNeywC