
These instructions may be out of date, see the Wiki for the latest...
https://github.com/JayDDee/cpuminer-opt/wiki/Compiling-from-source

1. Requirements:
---------------

Intel Core2 or newer, or AMD Steamroller or newer CPU. ARM CPUs are not
supported.
64 bit Linux operating system. Apple is not supported.

2. Building on linux prerequisites:
-----------------------------------

It is assumed users know how to install packages on their system and
be able to compile standard source packages. This is basic Linux and
beyond the scope of cpuminer-opt. Regardless compiling is trivial if you
follow the instructions.

Make sure you have the basic development packages installed.
Here is a good start:

http://askubuntu.com/questions/457526/how-to-install-cpuminer-in-ubuntu

Install any additional dependencies needed by cpuminer-opt. The list below
are some of the ones that may not be in the default install and need to
be installed manually. There may be others, read the compiler error messages,
they will give a clue as to the missing package.

The following command should install everything you need on Debian based
distributions such as Ubuntu. Fedora and other distributions may have similar
but different package names. 

$ sudo apt-get install build-essential automake libssl-dev libcurl4-openssl-dev libjansson-dev libgmp-dev zlib1g-dev git

SHA support on AMD Ryzen CPUs requires gcc version 5 or higher and
openssl 1.1.0e or higher.

znver1 and znver2 should be recognized on most recent version of GCC and
znver3 is available with GCC 11. GCC 11 also includes rocketlake support.
In the meantime here are some suggestions to compile with new CPUs:

"-march=native" is usually the best choice, used by build.sh.

"-march=znver2 -mvaes" can be used for Ryzen 5000 if znver3 is not recongized.

"-mcascadelake -msha" or
"-mcometlake -mavx512 -msha" can be used for Rocket Lake.

Features can also be added individually:

"-msha" adds support for HW accelerated sha256.

"-mavx512" adds support for 512 bit vectors

"-mvaes" add support for parallel AES

Additional instructions for static compilalation can be found here:
https://lxadm.com/Static_compilation_of_cpuminer
Static builds should only considered in a homogeneous HW and SW environment.
Local builds will always have the best performance and compatibility.

3. Download cpuminer-opt
------------------------

Download the source code for the latest realease from the official repository.

https://github.com/JayDDee/cpuminer-opt/releases

Extract the source code.

$ tar xvzf cpuminer-opt-x.y.z.tar.gz


Alternatively it can be cloned from git.

$ git clone https://github.com/JayDDee/cpuminer-opt.git
 
4. Build cpuminer-opt
---------------------

It is recomended to Build with default options, this will usuallly
produce the best results.

$ ./build.sh to build on Linux or execute the following commands.

or 

$ ./autogen.sh
$ CFLAGS="-O3 -march=native -Wall" ./configure --with-curl
$ make -j n

n is the number of threads.

5. Start mining.
----------------

$ ./cpuminer -a algo -o url -u username -p password


Windows
-------

See also INSTAL_WINDOWS

The following procedure is obsolete and uses an old compiler.

Precompiled Windows binaries are built on a Linux host using Mingw
with a more recent compiler than the following Windows hosted procedure.

Building on Windows prerequisites:

msys
mingw_w64
Visual C++ redistributable 2008 X64
openssl

Install msys and mingw_w64, only needed once.

Unpack msys into C:\msys or your preferred directory.

Install mingw_w64 from win-builds.
Follow instructions, check "msys or cygwin" and "x86_64" and accept default
existing msys instalation.

Open a msys shell by double clicking on msys.bat.
Note that msys shell uses linux syntax for file specifications, "C:\" is
mounted at "/c/".

Add mingw bin directory to PATH variable
PATH="/c/msys/opt/windows_64/bin/:$PATH"

Instalation complete, compile cpuminer-opt.

Unpack cpuminer-opt source files using tar from msys shell, or using 7zip
or similar Windows program.

In msys shell cd to miner directory.
cd /c/path/to/cpuminer-opt

Run build.sh to build on Windows or execute the following commands.

./autogen.sh
CFLAGS="-O3 -march=native -Wall" ./configure --with-curl
make

Start mining

cpuminer.exe -a algo -o url -u user -p password

The following tips may be useful for older AMD CPUs.

AMD CPUs older than Steamroller, including Athlon x2 and Phenom II x4, are
not supported by cpuminer-opt due to an incompatible implementation of SSE2
on these CPUs. Some algos may crash the miner with an invalid instruction.
Users are recommended to use an unoptimized miner such as cpuminer-multi.

Some users with AMD CPUs without AES_NI have reported problems compiling
with build.sh or "-march=native". Problems have included compile errors
and poor performance. These users are recommended to compile manually
specifying "-march=btver1" on the configure command line.

Support for even older x86_64 without AES_NI or SSE2 is not availble.

