Updated Compiling from source (markdown)

JayDDee
2022-01-15 13:29:42 -05:00
parent 88193189d3
commit 3fd7331c17

@@ -86,7 +86,8 @@ N is the number of threads for the compiler to use.
Windows compilation using Visual Studio is not supported. Mingw64 is used on a Linux Windows compilation using Visual Studio is not supported. Mingw64 is used on a Linux
system (bare metal or virtual machine) to cross-compile cpuminer-opt binaries package system (bare metal or virtual machine) to cross-compile cpuminer-opt binaries package
for Windows. That procedure follows this simpler one. Minimal knowledge of the Unix file for Windows. That procedure follows this simpler one. Minimal knowledge of the Unix file
system and bash shell are required. system and bash shell are required. Some steps in common with building for Linux may not be
explained in the same detail here, refer to the Linux procedure for more details details.
## Building for Windows, the easy way ## Building for Windows, the easy way
@@ -165,7 +166,7 @@ Refer to Linux compile instructions and install required packages.
Additionally, install mingw-w64. Additionally, install mingw-w64.
`sudo apt-get install mingw-w64 libz-mingw-w64-dev` `$ sudo apt-get install mingw-w64 libz-mingw-w64-dev`
#### Create a local library #### Create a local library
@@ -202,23 +203,23 @@ CPU threads you want to use.
openssl: openssl:
`./Configure mingw64 shared --cross-compile-prefix=x86_64-w64-mingw32-` `$ ./Configure mingw64 shared --cross-compile-prefix=x86_64-w64-mingw32-`
`make` `$ make`
Make may fail with an ld error, just ensure libcrypto-1_1-x64.dll is created. Make may fail with an ld error, just ensure libcrypto-1_1-x64.dll is created.
curl: curl:
`./configure --with-winssl --with-winidn --host=x86_64-w64-mingw32` `$ ./configure --with-winssl --with-winidn --host=x86_64-w64-mingw32`
`make` `$ make`
gmp: gmp:
`./configure --host=x86_64-w64-mingw32` `$ ./configure --host=x86_64-w64-mingw32`
`make` `$ make`
#### Tweak the environment. #### Tweak the environment.
@@ -228,15 +229,15 @@ This step is required everytime you login or the commands can be added to
Define some local variables to point to local library. Define some local variables to point to local library.
`export LOCAL_LIB="$HOME/usr/lib"` `$ export LOCAL_LIB="$HOME/usr/lib"`
`export LDFLAGS="-L$LOCAL_LIB/curl/lib/.libs -L$LOCAL_LIB/gmp/.libs -L$LOCAL_LIB/openssl"` `$ export LDFLAGS="-L$LOCAL_LIB/curl/lib/.libs -L$LOCAL_LIB/gmp/.libs -L$LOCAL_LIB/openssl"`
`export CONFIGURE_ARGS="--with-curl=$LOCAL_LIB/curl --with-crypto=$LOCAL_LIB/openssl --host=x86_64-w64-mingw32"` `$ export CONFIGURE_ARGS="--with-curl=$LOCAL_LIB/curl --with-crypto=$LOCAL_LIB/openssl --host=x86_64-w64-mingw32"`
Adjust for gcc version: Adjust for gcc version:
`export GCC_MINGW_LIB="/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32"` `$ export GCC_MINGW_LIB="/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32"`
Create a release directory and copy some dll files previously built. Create a release directory and copy some dll files previously built.
@@ -244,19 +245,19 @@ This can be done outside of cpuminer-opt and only needs to be done once.
If the release directory is in cpuminer-opt directory it needs to be If the release directory is in cpuminer-opt directory it needs to be
recreated every time a source package is decompressed. recreated every time a source package is decompressed.
`mkdir release` `$ mkdir release`
`cp /usr/x86_64-w64-mingw32/lib/zlib1.dll release/` `$ cp /usr/x86_64-w64-mingw32/lib/zlib1.dll release/`
`cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll release/` `$ cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll release/`
`cp $GCC_MINGW_LIB/libstdc++-6.dll release/` `$ cp $GCC_MINGW_LIB/libstdc++-6.dll release/`
`cp $GCC_MINGW_LIB/libgcc_s_seh-1.dll release/` `$ cp $GCC_MINGW_LIB/libgcc_s_seh-1.dll release/`
`cp $LOCAL_LIB/openssl/libcrypto-1_1-x64.dll release/` `$ cp $LOCAL_LIB/openssl/libcrypto-1_1-x64.dll release/`
`cp $LOCAL_LIB/curl/lib/.libs/libcurl-4.dll release/` `$ cp $LOCAL_LIB/curl/lib/.libs/libcurl-4.dll release/`
#### Download cpuminer-opt #### Download cpuminer-opt
@@ -276,24 +277,24 @@ Decompress and change to the cpuminer-opt directory.
Create a link to the locally compiled version of gmp.h Create a link to the locally compiled version of gmp.h
`ln -s $LOCAL_LIB/gmp-version/gmp.h ./gmp.h` `$ ln -s $LOCAL_LIB/gmp-version/gmp.h ./gmp.h`
`./autogen.sh` `$ ./autogen.sh`
Configure the compiler for the CPU architecture of the host machine: Configure the compiler for the CPU architecture of the host machine:
`CFLAGS="-O3 -march=native -Wall" ./configure $CONFIGURE_ARGS` `$ CFLAGS="-O3 -march=native -Wall" ./configure $CONFIGURE_ARGS`
or cross compile for a specific CPU architecture: or cross compile for a specific CPU architecture:
`CFLAGS="-O3 -march=znver1 -Wall" ./configure $CONFIGURE_ARGS` `$ CFLAGS="-O3 -march=znver1 -Wall" ./configure $CONFIGURE_ARGS`
This will compile for AMD Ryzen. This will compile for AMD Ryzen.
You can compile more generically for a set of specific CPU features You can compile more generically for a set of specific CPU features
if you know what features you want: if you know what features you want:
`CFLAGS="-O3 -maes -msse4.2 -Wall" ./configure $CONFIGURE_ARGS` `$ CFLAGS="-O3 -maes -msse4.2 -Wall" ./configure $CONFIGURE_ARGS`
This will compile for an older CPU that does not have AVX. This will compile for an older CPU that does not have AVX.
@@ -306,7 +307,7 @@ can enable the CPU Groups feature by adding the following to CFLAGS:
Once you have run configure successfully run the compiler with n CPU threads: Once you have run configure successfully run the compiler with n CPU threads:
`make -j n` `$ make -j n`
Copy cpuminer.exe to the release directory, compress and copy the release Copy cpuminer.exe to the release directory, compress and copy the release
directory to a Windows system and run cpuminer.exe from the command line. directory to a Windows system and run cpuminer.exe from the command line.
@@ -316,7 +317,7 @@ Run cpuminer
In a command windows change directories to the unzipped release folder. In a command windows change directories to the unzipped release folder.
to get a list of all options: to get a list of all options:
cpuminer.exe --help $ cpuminer.exe --help
Command options are specific to where you mine. Refer to the pool's Command options are specific to where you mine. Refer to the pool's
instructions on how to set them. instructions on how to set them.