Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: FuzzyBear on July 10, 2013, 06:44:53 PM



Title: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: FuzzyBear on July 10, 2013, 06:44:53 PM
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 :)

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


Title: Re: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: FuzzyBear on July 10, 2013, 06:53:18 PM
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!!


Title: Re: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: craslovell on July 10, 2013, 07:40:56 PM
Great guide Fuzzy. I'm getting owned by our proxy though, can't even get the dependencies I need downloaded  :(


Title: Re: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: kendog77 on July 10, 2013, 08:33:37 PM
That you FuzzyBear!

Did you notice much of an improvement running with the latest code here?
https://bitcointalk.org/index.php?topic=253662.0

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?


Title: Re: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: tacotime on July 10, 2013, 09:01:13 PM
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 (https://mega.co.nz/#!B5UwWQCD!SbVF2Tz8AkRZlk1XZRB-K3NKYKll8C2KaqYeygCcd1A)


Title: Re: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: eule on July 10, 2013, 09:55:14 PM
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...   :D


Title: Re: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: 96redformula on July 10, 2013, 10:01:51 PM
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 (https://mega.co.nz/#!B5UwWQCD!SbVF2Tz8AkRZlk1XZRB-K3NKYKll8C2KaqYeygCcd1A)

Can somebody get this up on a direct link :).


Title: Re: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: FuzzyBear on July 10, 2013, 11:55:27 PM
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


Title: Re: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: Zalfrin on July 11, 2013, 12:16:05 AM
I also needed to install make.  ;D

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 <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
make: *** [obj/init.o] Error 4


Title: Re: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: shinkicker on July 11, 2013, 07:55:38 AM
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


Title: Re: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: FuzzyBear on July 11, 2013, 12:58:21 PM
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 :(


Title: Re: [Primecoin] How to build the client from source on Linux (Ubuntu 12.04)
Post by: Zalfrin on July 11, 2013, 01:51:24 PM
I did an apt-get make install I believe, but ultimately I just ended up following this thread: https://bitcointalk.org/index.php?topic=252944.0

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.