Weight: 2
Description: Candidates should be able to build and install an executable program from source. This objective includes being able to unpack a file of sources.
Key Knowledge Areas:
Unpack source code using common compression and archive utilities
Understand basics of invoking make to compile programs
Apply parameters to a configure script
Know where sources are stored by default
Terms and Utilities:
/usr/src/
gunzip
gzip
bzip2
xz
tar
configure
make
uname
install
patch
As you know any modern linux distribution has its own repository, where we can easily search for a program , get info and install from it. Although installing a program from repository is easy and make kind of security, but it limits that program source to a specific distribution. So many developers prefer to publish a program source code it self, and let other people to configure and compile it base on their distribution and needs.
3 basic steps to install a program from source code are:
before beginning We need to install some developers tool. in redhat useyum groupinstall "Development Tools"
and in debian based and ubuntu run apt-get install build-essentia
:
[email protected]:~# apt install build-essentialReading package lists... DoneBuilding dependency treeReading state information... Donebuild-essential is already the newest version (12.1ubuntu2).0 upgraded, 0 newly installed, 0 to remove and 172 not upgraded.
For demonstration lets have fun and mine bitcoin with cpuminer. First download the source:
[email protected]:~# wget https://sourceforge.net/projects/cpuminer/files/pooler-cpuminer-2.5.0.tar.gz--2018-02-04 02:37:14-- https://sourceforge.net/projects/cpuminer/files/pooler-cpuminer-2.5.0.tar.gzResolving sourceforge.net (sourceforge.net)... 216.34.181.60Connecting to sourceforge.net (sourceforge.net)|216.34.181.60|:443... connected.HTTP request sent, awaiting response... 302 FoundLocation: https://sourceforge.net/projects/cpuminer/files/pooler-cpuminer-2.5.0.tar.gz/download [following]--2018-02-04 02:37:19-- https://sourceforge.net/projects/cpuminer/files/pooler-cpuminer-2.5.0.tar.gz/downloadConnecting to sourceforge.net (sourceforge.net)|216.34.181.60|:443... connected.HTTP request sent, awaiting response... 302 FoundLocation: https://downloads.sourceforge.net/project/cpuminer/pooler-cpuminer-2.5.0.tar.gz?r=&ts=1517740642&use_mirror=jaist [following]--2018-02-04 02:37:22-- https://downloads.sourceforge.net/project/cpuminer/pooler-cpuminer-2.5.0.tar.gz?r=&ts=1517740642&use_mirror=jaistResolving downloads.sourceforge.net (downloads.sourceforge.net)... 216.34.181.59Connecting to downloads.sourceforge.net (downloads.sourceforge.net)|216.34.181.59|:443... connected.HTTP request sent, awaiting response... 302 FoundLocation: https://jaist.dl.sourceforge.net/project/cpuminer/pooler-cpuminer-2.5.0.tar.gz [following]--2018-02-04 02:37:28-- https://jaist.dl.sourceforge.net/project/cpuminer/pooler-cpuminer-2.5.0.tar.gzResolving jaist.dl.sourceforge.net (jaist.dl.sourceforge.net)... 150.65.7.130, 2001:df0:2ed:feed::feedConnecting to jaist.dl.sourceforge.net (jaist.dl.sourceforge.net)|150.65.7.130|:443... connected.HTTP request sent, awaiting response... 200 OKLength: 257872 (252K) [application/x-gzip]Saving to: ‘pooler-cpuminer-2.5.0.tar.gz’​pooler-cpuminer-2.5 100%[===================>] 251.83K 21.3KB/s in 12s​2018-02-04 02:37:43 (21.3 KB/s) - ‘pooler-cpuminer-2.5.0.tar.gz’ saved [257872/257872]​[email protected]:~# ls -ltotal 252drwxr-xr-x 2 root root 0 Feb 3 23:53 mynfs-rw-r--r-- 1 root root 257872 Jun 22 2017 pooler-cpuminer-2.5.0.tar.gz
and now lets uncompress the source, as a quick review:
uncompress commands | Description |
tar -xvf filename.tar | uncompress tar file |
tar -xvf filename.tar.gz | uncompress gzip file |
tar -xvf filename.tar.bz2 | uncompress bzip2 file |
gunzip filename.gz | uncompress gzip file |
okey:
[email protected]:~# mkdir cpuminer[email protected]:~# cd cpuminer/[email protected]:~/cpuminer# tar -zxvf ../pooler-cpuminer-2.5.0.tar.gzcpuminer-2.5.0/cpuminer-2.5.0/compat.hcpuminer-2.5.0/ChangeLogcpuminer-2.5.0/INSTALLcpuminer-2.5.0/compat/cpuminer-2.5.0/compat/jansson/cpuminer-2.5.0/compat/jansson/hashtable.ccpuminer-2.5.0/compat/jansson/strbuffer.hcpuminer-2.5.0/compat/jansson/jansson_private.hcpuminer-2.5.0/compat/jansson/hashtable.hcpuminer-2.5.0/compat/jansson/Makefile.incpuminer-2.5.0/compat/jansson/dump.ccpuminer-2.5.0/compat/jansson/jansson.hcpuminer-2.5.0/compat/jansson/utf.hcpuminer-2.5.0/compat/jansson/Makefile.amcpuminer-2.5.0/compat/jansson/strbuffer.ccpuminer-2.5.0/compat/jansson/config.hcpuminer-2.5.0/compat/jansson/load.ccpuminer-2.5.0/compat/jansson/util.hcpuminer-2.5.0/compat/jansson/value.ccpuminer-2.5.0/compat/jansson/utf.ccpuminer-2.5.0/compat/Makefile.incpuminer-2.5.0/compat/Makefile.amcpuminer-2.5.0/config.subcpuminer-2.5.0/miner.hcpuminer-2.5.0/sha2.ccpuminer-2.5.0/minerd.1cpuminer-2.5.0/aclocal.m4cpuminer-2.5.0/cpu-miner.ccpuminer-2.5.0/Makefile.incpuminer-2.5.0/missingcpuminer-2.5.0/depcompcpuminer-2.5.0/example-cfg.jsoncpuminer-2.5.0/util.ccpuminer-2.5.0/scrypt-x64.Scpuminer-2.5.0/AUTHORScpuminer-2.5.0/compilecpuminer-2.5.0/elist.hcpuminer-2.5.0/READMEcpuminer-2.5.0/sha2-x64.Scpuminer-2.5.0/configurecpuminer-2.5.0/Makefile.amcpuminer-2.5.0/configure.accpuminer-2.5.0/cpuminer-config.h.incpuminer-2.5.0/NEWScpuminer-2.5.0/install-shcpuminer-2.5.0/scrypt-x86.Scpuminer-2.5.0/sha2-arm.Scpuminer-2.5.0/config.guesscpuminer-2.5.0/sha2-x86.Scpuminer-2.5.0/COPYINGcpuminer-2.5.0/nomacro.plcpuminer-2.5.0/scrypt-ppc.Scpuminer-2.5.0/scrypt.ccpuminer-2.5.0/scrypt-arm.Scpuminer-2.5.0/sha2-ppc.S
Before being able to compile our source code, we need to prepare all its requirements and dependencies. To do that use configure command. The configure command is NOT a standard Linux command. configure is a script that is generally provided with the source of most standardized type Linux packages.
[email protected]:~/cpuminer# lscpuminer-2.5.0[email protected]:~/cpuminer# cd cpuminer-2.5.0/[email protected]:~/cpuminer/cpuminer-2.5.0# lsaclocal.m4 configure INSTALL nomacro.pl sha2.cAUTHORS configure.ac install-sh README sha2-ppc.SChangeLog COPYING Makefile.am scrypt-arm.S sha2-x64.Scompat cpu-miner.c Makefile.in scrypt.c sha2-x86.Scompat.h cpuminer-config.h.in minerd.1 scrypt-ppc.S util.ccompile depcomp miner.h scrypt-x64.Sconfig.guess elist.h missing scrypt-x86.Sconfig.sub example-cfg.json NEWS sha2-arm.S​[email protected]:~/cpuminer/cpuminer-2.5.0# ./configurechecking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking target system type... x86_64-unknown-linux-gnuchecking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking for a thread-safe mkdir -p... /bin/mkdir -pchecking for gawk... nochecking for mawk... mawkchecking whether make sets $(MAKE)... yeschecking whether make supports nested variables... yeschecking whether to enable maintainer-specific portions of Makefiles... nochecking for style of include used by make... GNUchecking for gcc... gccchecking whether the C compiler works... yeschecking for C compiler default output file name... a.outchecking for suffix of executables...checking whether we are cross compiling... nochecking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether gcc accepts -g... yeschecking for gcc option to accept ISO C89... none neededchecking whether gcc understands -c and -o together... yeschecking dependency style of gcc... gcc3checking for gcc option to accept ISO C99... none neededchecking how to run the C preprocessor... gcc -Echecking for grep that handles long lines and -e... /bin/grepchecking for egrep... /bin/grep -Echecking whether gcc needs -traditional... nochecking dependency style of gcc... gcc3checking for ranlib... ranlibchecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking sys/endian.h usability... nochecking sys/endian.h presence... nochecking for sys/endian.h... nochecking sys/param.h usability... yeschecking sys/param.h presence... yeschecking for sys/param.h... yeschecking syslog.h usability... yeschecking syslog.h presence... yeschecking for syslog.h... yeschecking for sys/sysctl.h... yeschecking whether be32dec is declared... nochecking whether le32dec is declared... nochecking whether be32enc is declared... nochecking whether le32enc is declared... nochecking for size_t... yeschecking for working alloca.h... yeschecking for alloca... yeschecking for getopt_long... yeschecking whether we can compile AVX code... yeschecking whether we can compile XOP code... yeschecking whether we can compile AVX2 code... yeschecking for json_loads in -ljansson... nochecking for pthread_create in -lpthread... yeschecking for gawk... (cached) mawkchecking for curl-config... nochecking whether libcurl is usable... noconfigure: error: Missing required libcurl >= 7.15.2
Well obviously it needs libcurl, but if we have had read README file it was mentioned there:
Dependencies:libcurl http://curl.haxx.se/libcurl/jansson http://www.digip.org/jansson/(jansson is included in-tree)
so its recommended to read README file, any how lets try to search and install libcurl:
[email protected]:~/cpuminer/cpuminer-2.5.0# apt search libcurlSorting... DoneFull Text Search... Donefp-units-net/xenial 3.0.0+dfsg-2 amd64Free Pascal - networking units dependency package​fp-units-net-3.0.0/xenial 3.0.0+dfsg-2 amd64Free Pascal - networking units​gnupg/xenial-updates,xenial-security,now 1.4.20-1ubuntu3.1 amd64 [installed]GNU privacy guard - a free PGP replacement​gnupg-curl/xenial-updates,xenial-security 1.4.20-1ubuntu3.1 amd64GNU privacy guard - a free PGP replacement (cURL)​libcupt4-1-downloadmethod-curl/xenial 2.9.4ubuntu1 amd64flexible package manager -- libcurl download method​libcurl-ocaml/xenial 0.5.3-2build5 amd64OCaml curl bindings (Runtime Library)​libcurl-ocaml-dev/xenial 0.5.3-2build5 amd64OCaml libcurl bindings (Development package)​libcurl3/xenial-updates,xenial-security 7.47.0-1ubuntu2.6 amd64 [upgradable from: 7.47.0-1ubuntu2.5]easy-to-use client-side URL transfer library (OpenSSL flavour)​libcurl3-dbg/xenial-updates,xenial-security 7.47.0-1ubuntu2.6 amd64debugging symbols for libcurl (OpenSSL, GnuTLS and NSS flavours)​libcurl3-gnutls/xenial-updates,xenial-security 7.47.0-1ubuntu2.6 amd64 [upgradable from: 7.47.0-1ubuntu2.5]easy-to-use client-side URL transfer library (GnuTLS flavour)​libcurl3-nss/xenial-updates,xenial-security 7.47.0-1ubuntu2.6 amd64easy-to-use client-side URL transfer library (NSS flavour)​libcurl4-doc/xenial-updates,xenial-updates,xenial-security,xenial-security 7.47.0-1ubuntu2.6 alldocumentation for libcurl​libcurl4-gnutls-dev/xenial-updates,xenial-security 7.47.0-1ubuntu2.6 amd64development files and documentation for libcurl (GnuTLS flavour)​libcurl4-nss-dev/xenial-updates,xenial-security 7.47.0-1ubuntu2.6 amd64development files and documentation for libcurl (NSS flavour)​libcurl4-openssl-dev/xenial-updates,xenial-security 7.47.0-1ubuntu2.6 amd64development files and documentation for libcurl (OpenSSL flavour)​libcurlpp-dev/xenial 0.7.3-6 amd64c++ wrapper for libcurl (development files)​libcurlpp0/xenial 0.7.3-6 amd64c++ wrapper for libcurl​libghc-curl-dev/xenial 1.3.8-7 amd64GHC libraries for the libcurl Haskell bindings​libghc-curl-doc/xenial,xenial 1.3.8-7 allDocumentation for the libcurl Haskell bindings; documentation​libghc-curl-prof/xenial 1.3.8-7 amd64Profiling libraries for the libcurl Haskell bindings; profiling libraries​libghc-hxt-curl-dev/xenial 9.1.1.1-4build1 amd64LibCurl interface for HXT​libghc-hxt-curl-doc/xenial,xenial 9.1.1.1-4build1 allLibCurl interface for HXT; documentation​libghc-hxt-curl-prof/xenial 9.1.1.1-4build1 amd64LibCurl interface for HXT; profiling libraries​libjsonrpccpp-client0/xenial 0.6.0-2build1 amd64library implementing json-rpc C++ clients​libjsonrpccpp-client0-dbg/xenial 0.6.0-2build1 amd64debugging symbols for libjsonrpccpp-client0​libresource-retriever-dev/xenial 1.11.6-2 amd64Robot OS resource_retriever library - development files​libresource-retriever0d/xenial 1.11.6-2 amd64Robot OS resource_retriever library​libstrongswan-extra-plugins/xenial-updates 5.3.5-1ubuntu3.5 amd64strongSwan utility and crypto library (extra plugins)​libwww-curl-perl/xenial 4.17-2build1 amd64Perl bindings to libcurl​lua-curl/xenial 0.3.0-9 amd64libcURL bindings for the Lua language​lua-curl-dev/xenial 0.3.0-9 amd64libcURL development files for the Lua language​python-pycurl/xenial 7.43.0-1ubuntu1 amd64Python bindings to libcurl​python-pycurl-dbg/xenial 7.43.0-1ubuntu1 amd64Python bindings to libcurl (debug extension)​python-pycurl-doc/xenial,xenial 7.43.0-1ubuntu1 allPython bindings to libcurl (documentation)​python-resource-retriever/xenial,xenial 1.11.6-2 allRobot OS resource_retriever library - Python​python3-pycurl/xenial,now 7.43.0-1ubuntu1 amd64 [installed]Python bindings to libcurl (Python 3)​python3-pycurl-dbg/xenial 7.43.0-1ubuntu1 amd64Python bindings to libcurl (debug extension, Python 3)​ruby-curb/xenial 0.8.8-1build5 amd64Ruby libcurl bindings​ruby-ethon/xenial,xenial 0.8.0-1 alllibcurl wrapper using ffi​ruby-typhoeus/xenial,xenial 0.8.0-2 allparallel HTTP library on top of ethon​strongswan-plugin-curl/xenial-updates,xenial-updates 5.3.5-1ubuntu3.5 allstrongSwan plugin for the libcurl based HTTP/FTP fetcher​tclcurl/xenial 7.22.0+hg20151017-1 amd64Tcl bindings to libcurl​wmget/xenial 0.6.1-1 amd64Background download manager in a Window Maker dock app
Wow. That is a long list , Usually libraries with "-dev" on their tails are what we want, so we chose one and try:
[email protected]:~/cpuminer/cpuminer-2.5.0# apt search libcurl | grep dev​WARNING: apt does not have a stable CLI interface. Use with caution in scripts.​libcurl-ocaml-dev/xenial 0.5.3-2build5 amd64libcurl4-gnutls-dev/xenial-updates,xenial-security 7.47.0-1ubuntu2.6 amd64development files and documentation for libcurl (GnuTLS flavour)libcurl4-nss-dev/xenial-updates,xenial-security 7.47.0-1ubuntu2.6 amd64development files and documentation for libcurl (NSS flavour)libcurl4-openssl-dev/xenial-updates,xenial-security 7.47.0-1ubuntu2.6 amd64development files and documentation for libcurl (OpenSSL flavour)libcurlpp-dev/xenial 0.7.3-6 amd64c++ wrapper for libcurl (development files)libghc-curl-dev/xenial 1.3.8-7 amd64libghc-hxt-curl-dev/xenial 9.1.1.1-4build1 amd64libresource-retriever-dev/xenial 1.11.6-2 amd64Robot OS resource_retriever library - development fileslua-curl-dev/xenial 0.3.0-9 amd64libcURL development files for the Lua language​[email protected]:~/cpuminer/cpuminer-2.5.0# apt install libcurl4-openssl-dev
Now run configure again and watch for any problems:
[email protected]:~/cpuminer/cpuminer-2.5.0# ./configurechecking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking target system type... x86_64-unknown-linux-gnuchecking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking for a thread-safe mkdir -p... /bin/mkdir -pchecking for gawk... nochecking for mawk... mawkchecking whether make sets $(MAKE)... yeschecking whether make supports nested variables... yeschecking whether to enable maintainer-specific portions of Makefiles... nochecking for style of include used by make... GNUchecking for gcc... gccchecking whether the C compiler works... yeschecking for C compiler default output file name... a.outchecking for suffix of executables...checking whether we are cross compiling... nochecking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether gcc accepts -g... yeschecking for gcc option to accept ISO C89... none neededchecking whether gcc understands -c and -o together... yeschecking dependency style of gcc... gcc3checking for gcc option to accept ISO C99... none neededchecking how to run the C preprocessor... gcc -Echecking for grep that handles long lines and -e... /bin/grepchecking for egrep... /bin/grep -Echecking whether gcc needs -traditional... nochecking dependency style of gcc... gcc3checking for ranlib... ranlibchecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking sys/endian.h usability... nochecking sys/endian.h presence... nochecking for sys/endian.h... nochecking sys/param.h usability... yeschecking sys/param.h presence... yeschecking for sys/param.h... yeschecking syslog.h usability... yeschecking syslog.h presence... yeschecking for syslog.h... yeschecking for sys/sysctl.h... yeschecking whether be32dec is declared... nochecking whether le32dec is declared... nochecking whether be32enc is declared... nochecking whether le32enc is declared... nochecking for size_t... yeschecking for working alloca.h... yeschecking for alloca... yeschecking for getopt_long... yeschecking whether we can compile AVX code... yeschecking whether we can compile XOP code... yeschecking whether we can compile AVX2 code... yeschecking for json_loads in -ljansson... nochecking for pthread_create in -lpthread... yeschecking for gawk... (cached) mawkchecking for curl-config... /usr/bin/curl-configchecking for the version of libcurl... 7.47.0checking for libcurl >= version 7.15.2... yeschecking whether libcurl is usable... yeschecking for curl_free... yeschecking that generated files are newer than configure... doneconfigure: creating ./config.statusconfig.status: creating Makefileconfig.status: creating compat/Makefileconfig.status: creating compat/jansson/Makefileconfig.status: creating cpuminer-config.hconfig.status: executing depfiles commands
it seems every thing is okey, and it generates some file for compiling :
-rwxr-xr-x 1 root root 35K Feb 4 04:08 config.status-rw-r--r-- 1 root root 52K Feb 4 04:08 Makefiledrwxr-xr-x 3 payam payam 4.0K Feb 4 04:08 compat-rw-r--r-- 1 root root 5.3K Feb 4 04:08 cpuminer-config.h-rw-r--r-- 1 root root 32 Feb 4 04:08 stamp-h1-rw-r--r-- 1 root root 33K Feb 4 04:08 config.log
time to compile:
[email protected]:~/cpuminer/cpuminer-2.5.0# makemake all-recursivemake[1]: Entering directory '/root/cpuminer/cpuminer-2.5.0'Making all in compatmake[2]: Entering directory '/root/cpuminer/cpuminer-2.5.0/compat'Making all in janssonmake[3]: Entering directory '/root/cpuminer/cpuminer-2.5.0/compat/jansson'gcc -DHAVE_CONFIG_H -I. -I../.. -g -O2 -MT dump.o -MD -MP -MF .deps/dump.Tpo -c -o dump.o dump.cmv -f .deps/dump.Tpo .deps/dump.Pogcc -DHAVE_CONFIG_H -I. -I../.. -g -O2 -MT hashtable.o -MD -MP -MF .deps/hashtable.Tpo -c -o hashtable.o hashtable.cmv -f .deps/hashtable.Tpo .deps/hashtable.Pogcc -DHAVE_CONFIG_H -I. -I../.. -g -O2 -MT load.o -MD -MP -MF .deps/load.Tpo -c -o load.o load.cmv -f .deps/load.Tpo .deps/load.Pogcc -DHAVE_CONFIG_H -I. -I../.. -g -O2 -MT strbuffer.o -MD -MP -MF .deps/strbuffer.Tpo -c -o strbuffer.o strbuffer.cmv -f .deps/strbuffer.Tpo .deps/strbuffer.Pogcc -DHAVE_CONFIG_H -I. -I../.. -g -O2 -MT utf.o -MD -MP -MF .deps/utf.Tpo -c -o utf.o utf.cmv -f .deps/utf.Tpo .deps/utf.Pogcc -DHAVE_CONFIG_H -I. -I../.. -g -O2 -MT value.o -MD -MP -MF .deps/value.Tpo -c -o value.o value.cmv -f .deps/value.Tpo .deps/value.Porm -f libjansson.aar cru libjansson.a dump.o hashtable.o load.o strbuffer.o utf.o value.oar: `u' modifier ignored since `D' is the default (see `U')ranlib libjansson.amake[3]: Leaving directory '/root/cpuminer/cpuminer-2.5.0/compat/jansson'make[3]: Entering directory '/root/cpuminer/cpuminer-2.5.0/compat'make[3]: Nothing to be done for 'all-am'.make[3]: Leaving directory '/root/cpuminer/cpuminer-2.5.0/compat'make[2]: Leaving directory '/root/cpuminer/cpuminer-2.5.0/compat'make[2]: Entering directory '/root/cpuminer/cpuminer-2.5.0'gcc -DHAVE_CONFIG_H -I. -I./compat/jansson -pthread -fno-strict-aliasing -g -O2 -MT minerd-cpu-miner.o -MD -MP -MF .deps/minerd-cpu-miner.Tpo -c -o minerd-cpu-miner.o `test -f 'cpu-miner.c' || echo './'`cpu-miner.cmv -f .deps/minerd-cpu-miner.Tpo .deps/minerd-cpu-miner.Pogcc -DHAVE_CONFIG_H -I. -I./compat/jansson -pthread -fno-strict-aliasing -g -O2 -MT minerd-util.o -MD -MP -MF .deps/minerd-util.Tpo -c -o minerd-util.o `test -f 'util.c' || echo './'`util.cmv -f .deps/minerd-util.Tpo .deps/minerd-util.Pogcc -DHAVE_CONFIG_H -I. -I./compat/jansson -pthread -fno-strict-aliasing -g -O2 -MT minerd-sha2.o -MD -MP -MF .deps/minerd-sha2.Tpo -c -o minerd-sha2.o `test -f 'sha2.c' || echo './'`sha2.cmv -f .deps/minerd-sha2.Tpo .deps/minerd-sha2.Pogcc -DHAVE_CONFIG_H -I. -I./compat/jansson -pthread -fno-strict-aliasing -g -O2 -MT minerd-scrypt.o -MD -MP -MF .deps/minerd-scrypt.Tpo -c -o minerd-scrypt.o `test -f 'scrypt.c' || echo './'`scrypt.cmv -f .deps/minerd-scrypt.Tpo .deps/minerd-scrypt.Pogcc -DHAVE_CONFIG_H -I. -I./compat/jansson -pthread -g -O2 -MT minerd-sha2-x64.o -MD -MP -MF .deps/minerd-sha2-x64.Tpo -c -o minerd-sha2-x64.o `test -f 'sha2-x64.S' || echo './'`sha2-x64.Smv -f .deps/minerd-sha2-x64.Tpo .deps/minerd-sha2-x64.Pogcc -DHAVE_CONFIG_H -I. -I./compat/jansson -pthread -g -O2 -MT minerd-scrypt-x64.o -MD -MP -MF .deps/minerd-scrypt-x64.Tpo -c -o minerd-scrypt-x64.o `test -f 'scrypt-x64.S' || echo './'`scrypt-x64.Smv -f .deps/minerd-scrypt-x64.Tpo .deps/minerd-scrypt-x64.Pogcc -fno-strict-aliasing -g -O2 -pthread -o minerd minerd-cpu-miner.o minerd-util.o minerd-sha2.o minerd-scrypt.o minerd-sha2-x64.o minerd-scrypt-x64.o -L/usr/lib/x86_64-linux-gnu -lcurl compat/jansson/libjansson.a -lpthreadmake[2]: Leaving directory '/root/cpuminer/cpuminer-2.5.0'make[1]: Leaving directory '/root/cpuminer/cpuminer-2.5.0'
All required binary files have been created:
-rw-r--r-- 1 root root 261K Feb 4 04:18 minerd-cpu-miner.o-rw-r--r-- 1 root root 164K Feb 4 04:18 minerd-util.o-rw-r--r-- 1 root root 43K Feb 4 04:18 minerd-sha2.o-rw-r--r-- 1 root root 112K Feb 4 04:18 minerd-scrypt.o-rw-r--r-- 1 root root 138K Feb 4 04:18 minerd-sha2-x64.o-rw-r--r-- 1 root root 71K Feb 4 04:18 minerd-scrypt-x64.o-rwxr-xr-x 1 root root 664K Feb 4 04:18 minerd
see minerd, it works but its not in the path:
[email protected]:~/cpuminer/cpuminer-2.5.0# ./minerd./minerd: no URL suppliedTry `minerd --help' for more information.​[email protected]:~/cpuminer/cpuminer-2.5.0# minerdminerd: command not found
Next step is installing compiled program. In this step PATHis modified and generated files are placed in /usr/local/bin
[email protected]:~/cpuminer/cpuminer-2.5.0# make installMaking install in compatmake[1]: Entering directory '/root/cpuminer/cpuminer-2.5.0/compat'Making install in janssonmake[2]: Entering directory '/root/cpuminer/cpuminer-2.5.0/compat/jansson'make[3]: Entering directory '/root/cpuminer/cpuminer-2.5.0/compat/jansson'make[3]: Nothing to be done for 'install-exec-am'.make[3]: Nothing to be done for 'install-data-am'.make[3]: Leaving directory '/root/cpuminer/cpuminer-2.5.0/compat/jansson'make[2]: Leaving directory '/root/cpuminer/cpuminer-2.5.0/compat/jansson'make[2]: Entering directory '/root/cpuminer/cpuminer-2.5.0/compat'make[3]: Entering directory '/root/cpuminer/cpuminer-2.5.0/compat'make[3]: Nothing to be done for 'install-exec-am'.make[3]: Nothing to be done for 'install-data-am'.make[3]: Leaving directory '/root/cpuminer/cpuminer-2.5.0/compat'make[2]: Leaving directory '/root/cpuminer/cpuminer-2.5.0/compat'make[1]: Leaving directory '/root/cpuminer/cpuminer-2.5.0/compat'make[1]: Entering directory '/root/cpuminer/cpuminer-2.5.0'make[2]: Entering directory '/root/cpuminer/cpuminer-2.5.0'/bin/mkdir -p '/usr/local/bin'/usr/bin/install -c minerd '/usr/local/bin'/bin/mkdir -p '/usr/local/share/man/man1'/usr/bin/install -c -m 644 minerd.1 '/usr/local/share/man/man1'make[2]: Leaving directory '/root/cpuminer/cpuminer-2.5.0'make[1]: Leaving directory '/root/cpuminer/cpuminer-2.5.0'​[email protected]:~/cpuminer/cpuminer-2.5.0# minerdminerd: no URL suppliedTry `minerd --help' for more information.
Okey lets start bitcoin mining:
[email protected]:~/cpuminer/cpuminer-2.5.0# minerd -a sha256d -o stratum+tcp://stratum.antpool.com:3333 -u MyName.1 -p 123[2018-02-04 04:44:03] Starting Stratum on stratum+tcp://stratum.antpool.com:3333[2018-02-04 04:44:03] Binding thread 0 to cpu 0[2018-02-04 04:44:03] 4 miner threads started, using 'sha256d' algorithm.[2018-02-04 04:44:03] Binding thread 1 to cpu 1[2018-02-04 04:44:03] Binding thread 3 to cpu 3[2018-02-04 04:44:03] Binding thread 2 to cpu 2