Author

Topic: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04) (Read 2147 times)

sr. member
Activity: 401
Merit: 250
I did an apt-get make install I believe, but ultimately I just ended up following this thread: https://bitcointalksearch.org/topic/xpm-pool-mining-primecoin-using-digitalocean-vps-252944

For out-of-memory errors on small server instances, there are instructions in that thread for setting up a temporary swap space so the compiler can use the disk space as additional memory.
legendary
Activity: 1420
Merit: 1010
Nice guide. Two small points, maybe add 'make' to the RPM list. EC2's do not come with make as does the 'server' release of ubuntu. With that small addition it all went through for me.

Also its better to run as a daemon

Code:
./primecoind --daemon

Also if anyone is using headless this will set up your conf:

Code:
cat << 'EOF' > ~/.primecoin/primecoin.conf
# bitcoin.conf configuration file. Lines beginning with # are comments.
# server=1 tells Bitcoin to accept JSON-RPC commands.
server=1

# You must set rpcuser and rpcpassword to secure the JSON-RPC api
rpcuser=USERNAME
rpcpassword=PASSWORD

# Listen for RPC connections on this TCP port:
rpcport=9000

# You can use Bitcoin or bitcoind to send commands to Bitcoin/bitcoind
# running on another host using this option:
rpcconnect=127.0.0.1

# Set gen=1 to attempt to generate bitcoins
gen=1
EOF

Save the above as conf.sh and then do

$ chmod u+x  conf.sh

and finally..

./conf.sh

EDIT:

You can't compile on a EC2 micro instance:

[652846.409725] Out of memory: Kill process 14520 (cc1plus) score 921 or sacrifice child
[652846.409740] Killed process 14520 (cc1plus) total-vm:587212kB, anon-rss:555376kB, file-rss:124kB


Brilliant thank you for the feedback, added the run as daemon change to the doc, and what did you have to do to install make?? just run
Code:
sudo make install
if so i'll add that the the doc. Many thanks again for the feedback and hope you are getting lots of coins now.... I seem to have stopped getting them as my PC's are all very old Sad
full member
Activity: 140
Merit: 100
Nice guide. Two small points, maybe add 'make' to the RPM list. EC2's do not come with make as does the 'server' release of ubuntu. With that small addition it all went through for me.

Also its better to run as a daemon

Code:
./primecoind --daemon

Also if anyone is using headless this will set up your conf:

Code:
cat << 'EOF' > ~/.primecoin/primecoin.conf
# bitcoin.conf configuration file. Lines beginning with # are comments.
# server=1 tells Bitcoin to accept JSON-RPC commands.
server=1

# You must set rpcuser and rpcpassword to secure the JSON-RPC api
rpcuser=USERNAME
rpcpassword=PASSWORD

# Listen for RPC connections on this TCP port:
rpcport=9000

# You can use Bitcoin or bitcoind to send commands to Bitcoin/bitcoind
# running on another host using this option:
rpcconnect=127.0.0.1

# Set gen=1 to attempt to generate bitcoins
gen=1
EOF

Save the above as conf.sh and then do

$ chmod u+x  conf.sh

and finally..

./conf.sh

EDIT:

You can't compile on a EC2 micro instance:

[652846.409725] Out of memory: Kill process 14520 (cc1plus) score 921 or sacrifice child
[652846.409740] Killed process 14520 (cc1plus) total-vm:587212kB, anon-rss:555376kB, file-rss:124kB
sr. member
Activity: 401
Merit: 250
I also needed to install make.  Grin

Anyhow, on my DO droplet I'm getting an error, maybe the installed version of g++ is wrong?

g++ -c -O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -g -DBOOST_SPIRIT_THREADSAFE -D_FILE_OFFSET_BITS=64 -I/root/primecoin/src -I/root/primecoin/src/obj -DUSE_UPNP=0 -DUSE_IPV6=1 -I/root/primecoin/src/leveldb/include -I/root/primecoin/src/leveldb/helpers -DHAVE_BUILD_INFO -fno-stack-protector -fstack-protector-all -Wstack-protector -D_FORTIFY_SOURCE=2  -MMD -MF obj/init.d -o obj/init.o init.cpp
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See for instructions.
make: *** [obj/init.o] Error 4
legendary
Activity: 1420
Merit: 1010
Ok i'll post a few builds I have here so people can test for themselves.... I'm on the 2nd  build and i gone from 10-20 PPS to 210 and still rising!!

http://donate.ppcointalk.org/primecoind.zip - code with first fix and compiled under make -f makefile.unix
http://donate.ppcointalk.org/primecoind.tar.gz - latest code fix and compiled under make -f makefile.unix

building one now under  make -O3 -march=native -f makefile.unix
full member
Activity: 224
Merit: 100
You guys are welcome to my optimized ubuntu64 executable too, but I'll warn you that I have no idea if it's generating primes correctly (I altered a bunch of the code according to Mike's recommendations)

download here

Can somebody get this up on a direct link Smiley.
hero member
Activity: 756
Merit: 501
Nice guide, and very nice to post the binary tacotime! Too bad I'm on a 32 bit Mint and my server has no graphical UI.
Any chance of you or someone else uploading the three modified source files? I tried doing it myself but compiler ran into trouble, guess i made some mistakes...   Cheesy
legendary
Activity: 1484
Merit: 1005
You guys are welcome to my optimized ubuntu64 executable too, but I'll warn you that I have no idea if it's generating primes correctly (I altered a bunch of the code according to Mike's recommendations)

download here
hero member
Activity: 742
Merit: 500
That you FuzzyBear!

Did you notice much of an improvement running with the latest code here?
https://bitcointalksearch.org/topic/xpm-primecoin-built-in-miner-sieve-performance-issue-253662

I followed the guide, recompiled with Sunny's latest fix to prime.cpp / prime.h, compiled with the -O3 and -march=native flags and expected to see a performance improvement on an AMD A4 processor but the results seem to be about the same as the default primecoind linux build.

Do you have any tips for how to speed up performance?
legendary
Activity: 1470
Merit: 1021
Great guide Fuzzy. I'm getting owned by our proxy though, can't even get the dependencies I need downloaded  Sad
legendary
Activity: 1420
Merit: 1010
ok yeah so just running it now myself and my laptop gone from 10-20 PPS to 100-110 PPS so looks like this guide will hopefully let some non devs get some coins!!
legendary
Activity: 1420
Merit: 1010
Hey everyone,

Had a few requests from people for help in building Primecoin from source on a linux OS so I decided to write up this handy guide so that everyone could do it themselves Smiley

http://www.devtome.com/doku.php?id=install_primecoin_ubuntu

If you have any problems then please post in this thread and i'll look into them or update the post as needs be.

Guide was requested as apparently you can get 3x more PPS building from source (maybe needs further optimisation?) but hope this gets some people some more coins.

FuzzyBear
Jump to: