Bitcoin Forum

Other => Beginners & Help => Topic started by: Joe Juneau on June 18, 2011, 01:26:34 AM



Title: Totally static compilation of jgarzic's CPU miner.
Post by: Joe Juneau on June 18, 2011, 01:26:34 AM
Hi there  :D

I've spent hours (days, actually) on something where I still get stuck: I cann't compile this (https://github.com/jgarzik/cpuminer) as fully static binary.

Here is how I do it:
- Got a
Code:
jgarzik-cpuminer-602e31b
directory where I expanded the archive.
- In this directory, I've downloaded source of curl, including libs,
- In curl directory, I've downloaded gnu-tls source, including libs.

Then I do:
Code:
remi@puddipuddi:~/Logiciels/jgarzik-cpuminer-602e31b/curl-7.21.0/gnutls26-2.8.6$ ./configure LDFLAGS=-static
I go into gnutls26-2.8.6/lib and give it a make:
Code:
gnutls26-2.8.6/lib$ make
Then back to curl, and I configure again:
Code:
remi@puddipuddi:~/Logiciels/jgarzik-cpuminer-602e31b/curl-7.21.0$./configure LDFLAGS=-static --disable-shared --with-gnutls LDFLAGS=-L/home/remiLogiciels/jgarzik-cpuminer-602e31b/gnutls26-2.8.6/lib
Then I make my lib curl:
Code:
curl-7.21.0/lib$ make
Then I autogen, and I configure the miner:
Code:
remi@puddipuddi:~/Logiciels/jgarzik-cpuminer-602e31b$ ./autogen
remi@puddipuddi:~/Logiciels/jgarzik-cpuminer-602e31b$ ./configure LDFLAGS=-static LDFLAGS=-L/home/remi/Logiciels/jgarzik-cpuminer-602e31b/curl-7.21.0/gnutls26-2.8.6/lib LDFLAGS=-L/home/remi/Logiciels/jgarzik-cpuminer-602e31b/curl-7.21.0/lib

Then I make it, and I get a "minerd" binary.

When I try this binary on another x86 system, this is what I get  :-[
Code:
./minerd: error while loading shared libraries: libcurl-gnutls.so.4: cannot open shared object file: No such file or directory

How can I statically compile the cpu miner so that I could use "anywhere"?


Title: Re: Totally static compilation of jgarzic's CPU miner.
Post by: BeeCee1 on June 18, 2011, 03:08:12 AM
I've never done this but take a look at: http://www.linuxquestions.org/questions/linux-software-2/gcc-compile-static-and-so-537575/

One of the answers suggests you need .a (archive) versions of the libraries.


Title: Re: Totally static compilation of jgarzic's CPU miner.
Post by: Joe Juneau on June 18, 2011, 06:14:14 AM
I've never done this but take a look at: http://www.linuxquestions.org/questions/linux-software-2/gcc-compile-static-and-so-537575/

One of the answers suggests you need .a (archive) versions of the libraries.
I have already seen this, and yes I do have .a versions of libs.

will do a try on a computer where there are none of the libs installed, with the hope that compilation will stop saying "this is missing"...  :-\


Title: Re: Totally static compilation of jgarzic's CPU miner.
Post by: Joe Juneau on June 18, 2011, 03:43:38 PM
up  :P


Title: Re: Totally static compilation of jgarzic's CPU miner.
Post by: gpa on June 18, 2011, 09:43:00 PM
I guess your minerd is not static - I would have at least used CFLAGS=-static somewhere

Anyway, try to take the last compine line and run it manually with gcc -static -Wl, -static to see if it works

I guess it won't because it will try to use the distribution curl (for some reason I don't want to spend time investigating) and mess up with the dependancies. You may want to install it in a path and remove the default one. See http://curl.haxx.se/mail/lib-2006-09/0128.html for a similar suggestion.

But all that is a waste of time. I've prepared a binary for you on :
https://rapidshare.com/files/515355188/minerd.linux.x86_64

Let me know your arch (i386.. ?) and  I will compile another static binary for you if that's not what you need.

Donations welcome :-)


Title: Re: Totally static compilation of jgarzic's CPU miner.
Post by: gpa on June 18, 2011, 10:26:23 PM
BTW I forgot - if you want to run it on a machine where you do not know the # of cores :
 -t `cat /proc/cpuinfo|grep processor|wc -l`


Title: Re: Totally static compilation of jgarzic's CPU miner.
Post by: anonymous_acc on January 23, 2013, 02:00:47 PM
Up!

I'm too looking for instruction to make static on x86_64 linux platform


Title: Re: Totally static compilation of jgarzic's CPU miner.
Post by: Gabi on January 23, 2013, 03:37:36 PM
There is a reason why the last reply is from June 2011, cpu mining is dead. And gpu mining will die very soon as ASIC arrives


Title: Re: Totally static compilation of jgarzic's CPU miner.
Post by: anonymous_acc on January 23, 2013, 03:55:39 PM
Gabi, you don't believe in chance.

There are still non-zero probability to find block, even on cpu.


Title: Re: Totally static compilation of jgarzic's CPU miner.
Post by: Gabi on January 23, 2013, 03:57:57 PM
At least if you win a lottery you win millions of $ but with cpu mining even if in 10 years you find 1 block you have only 25btc...


Title: Re: Totally static compilation of jgarzic's CPU miner.
Post by: mangoo on November 24, 2017, 06:31:17 PM
Here are well written instructions for a static compilation of cpuminer:

https://lxadm.com/Static_compilation_of_cpuminer