Skip to content

Commit

Permalink
Update instructions for cross-compile.
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-zurkowski committed Oct 22, 2021
1 parent 9094450 commit 03ceab1
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions INSTALL_WINDOWS
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
Instructions for compiling cpuminer-opt for Windows.
Instructions for compiling cpuminer-gr for Windows.

Thwaw intructions nay be out of date. Please consult the wiki for
The instructions may be out of date. Please consult the wiki for
the latest:

https://github.com/JayDDee/cpuminer-opt/wiki/Compiling-from-source

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 executable binaries for Windows.
cpuminer-gr executable binaries for Windows.

These instructions were written for Debian and Ubuntu compatible distributions
but should work on other major distributions as well. However some of the
Expand Down Expand Up @@ -84,19 +82,20 @@ Define some local variables to point to local library.

$ export LOCAL_LIB="$HOME/usr/lib"

$ 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 MINGW_LIB="/usr/x86_64-w64-mingw32/lib"

Adjust for gcc version:

$ export GCC_MINGW_LIB="/usr/lib/gcc/x86_64-w64-mingw32/9.3-win32"
10-win32

Create a release directory and copy some dll files previously built. 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 recreated every time a source package is decompressed.

$ mkdir release
$ cp /usr/x86_64-w64-mingw32/lib/zlib1.dll release/
$ cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll release/
$ cp $MINGW_LIB/zlib1.dll release/
$ cp $MINGW_LIB/libwinpthread-1.dll release/
$ cp $GCC_MINGW_LIB/libstdc++-6.dll release/
$ cp $GCC_MINGW_LIB/libgcc_s_seh-1.dll release/
$ cp $LOCAL_LIB/openssl/libcrypto-1_1-x64.dll release/
Expand All @@ -112,28 +111,42 @@ location. .zip or .tar.gz, your choice.

https://github.com/WyvernTKC/cpuminer-gr-avx2/releases

Decompress and change to the cpuminer-opt directory.
$ git clone https://github.com/WyvernTKC/cpuminer-gr-avx2 cpuminer-gr

Decompress and change to the cpuminer-gr directory.

6. compile

Create a link to the locally compiled version of gmp.h

$ ln -s $LOCAL_LIB/gmp-version/gmp.h ./gmp.h
$ export LDFLAGS="-L$LOCAL_LIB/curl/lib/.libs -L$LOCAL_LIB/gmp/.libs -L$LOCAL_LIB/openssl"

$ rm ./gmp.h 2>/dev/null
$ ln -s $LOCAL_LIB/gmp/gmp.h ./gmp.h

$ make distclean
$ rm -f config.status
$ ./autogen.sh

Configure the compiler for the CPU architecture of the host machine:

$ export DCFLAGS="-fno-common -D_WIN32_WINNT=0x0601"

For GCC-10+:
CFLAGS="-O3 -march=native -mtune=native" CXXFLAGS="$CFLAGS -std=c++20 -Wno-ignored-attributes" ./configure --with-curl
CFLAGS="-O3 -march=native -mtune=native ${DCFLAGS}" \
CXXFLAGS="$CFLAGS -std=c++20 -Wno-ignored-attributes" \
./configure ${CONFIGURE_ARGS}

For GCC-8 && GCC-9:
CFLAGS="-O3 -march=native -mtune=native" CXXFLAGS="$CFLAGS -std=c++2a -fconcepts -Wno-ignored-attributes" ./configure --with-curl
CFLAGS="-O3 -march=native -mtune=native ${DCFLAGS}" \
CXXFLAGS="$CFLAGS -std=c++2a -fconcepts -Wno-ignored-attributes" \
./configure ${CONFIGURE_ARGS}

You can find several examples in README.txt

Once you have run configure successfully run the compiler with n CPU threads:

$ make -j n
$ make -j $(nproc)

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.

Expand All @@ -142,9 +155,3 @@ Run cpuminer
In a command windows change directories to the unzipped release folder. to get a list of all options:

cpuminer.exe --help

Command options are specific to where you mine. Refer to the pool's instructions on how to set them.

Create a link to the locally compiled version of gmp.h

$ ln -s $LOCAL_LIB/gmp-version/gmp.h ./gmp.h

0 comments on commit 03ceab1

Please sign in to comment.