[Primecoin] How to build the client from source on Linux (Ubuntu 12.04)

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 :slight_smile:

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

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 … <— ok that doesn’t work…

APkVyn9uJ8LvkGgkQeyamUig4h2bFew8AD

Are you doing a statically linked binary?

erm my terminology letting me down here but i think i know what u mean,

the two links in the second post are binaries that I have compiled and then uploaded to a server which point out on the web so you can get the compiled source code without having to compile yourself. These binaries are not going to move or be updated with latest source code compiled when changes made, I will build again and post a new link should sunnyking change source code.

Is that a staticly linked binary as opposed to a dynamic linked one??

Any tips on how to build for Centos? I tried on Centos 6.4 last night but the build appears to be looking for the includes in the wrong places. I have yum installed all the depenencies.

My C dev skills are weak so I don’t know to to fix the include lookup.

Would anyone mind posting a quick guide on how to build for windows? I need binaries that will work on Core 2’s and all the latest ones only seem to work for newer processors. They crash on my Core 2 windows machines but work on my i7s and i5.

You guessed right, I actually don’t know what is a proper expression in this case.

Anyway I was trying to create a more recent compilation, so I can use it on the other machine (I have an older version of suse distribution there, so I’m actually unable to compile it there properly…), but wasn’t successful so far. Have you used statically linked libraries?

erm my terminology letting me down here but i think i know what u mean,

the two links in the second post are binaries that I have compiled and then uploaded to a server which point out on the web so you can get the compiled source code without having to compile yourself. These binaries are not going to move or be updated with latest source code compiled when changes made, I will build again and post a new link should sunnyking change source code.

Is that a staticly linked binary as opposed to a dynamic linked one??[/quote]

Great post FuzzyBear! Thanks!

Now how would I go about setting up several servers to mine and have the coins end up in my wallet on my PC?

I decided to just install Ubuntu on my Centos boxes instead of spending an unknown amount of time learning how to migrate the make file between the two. Easy to build on Ubuntu and now my linux boxes are pulling down some nice pps :slight_smile:

For the windows boxes I decided to just install ubuntu in virtualbox vms. Had to turn on the vt-x virtualization in the bios to get it to work but it was pretty easy overall. The vms get similar pps as the native ubuntu boxes.

Will be doing some experimenting with building on windows tomorrow. May write up a guide if I get it working.

Is there a way to compile the qt of the actual improved version for linux?

[code]sudo apt-get install qt4-qmake libqt4-dev build-essential libboost-dev libboost-system-dev
libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev
libssl-dev libdb+±dev libminiupnpc-dev -y

qmake
make[/code]

On a newer version of ubuntu should work. Have not tried it as I only run a command prompt.

May need to add “USE_UPNP=-” to the qmake command:

qmake “USE_UPNP=-”

Has anyone managed to build a binary for Linux out of the latest 0.1.1 version o mikaelh’s update? I’m working on one including dynamic libraries, but no success so far :-\

Hi there, thanks for the great guide.

Having some trouble setting up my linux miner.
Using ubuntu 12.04 server, console only…only 256mb of ram though.
I created a 1gb swap file btw.

This happens when doing sudo apt-get install libcurl4-openssl-dev:

And this when compiling:

I managed to compile the client succesfully in digital ocean’s vps instances before, not sure what’s wrong with this rig.
Thanks in advance!

ps: it’s a fresh ubuntu install btw

Ok, this seems to be the problem but I’m too much of a noob to know how to solve it.

First off, excellent guide, thank you very much.

While I’m quite familiar with compiling for linux, I’d like to put my Mac to work as well, but have never compiled anything for it (mainly use it for my web dev work). Could someone point me in the right direction on compiling for mac? My Google Fu seems to be weak on this search :o

EDIT: I actually found that there are a few small differences, but using mac ports, you can install all needed dependencies, and simply compile using makefile.osx

I am currently running it now, I didn’t need to install anything extra beyond what is needed for the default client, what are the errors you’re seeing?

(oh and sorry for the double post, just trying to be helpful)

I needed to add this dependency in order for me to make it work for linux and the mikaelh’s source code.

apt-get install libgmp-dev

You need to do it by setting CXXFLAGS, because -O3 and -march are g++ flags, not make flags.

make CXXFLAGS="-O3 -march=native" -f makefile.unix primecoind

Thanks for the guide. Can you write up something for EC2 or do you already have one? I am not sure if it follows the same principles?

I would like to ask again for help on building universal linux build (like the one posted on sourceforge). Is it only using statically linked libraries or also anything else?

Thank you to anyone kind enough to respond!