From 11f00a2e6e017b9330fb4e7df55d8bffd94ec53f Mon Sep 17 00:00:00 2001 From: kpcyrd Date: Mon, 12 Mar 2018 21:03:04 +0100 Subject: [PATCH 1/9] Add -DBUILD_STATIC=ON for static builds See #238 --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e1673ea..ea02d373 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(xmrig) option(WITH_LIBCPUID "Use Libcpuid" ON) option(WITH_AEON "CryptoNight-Lite support" ON) option(WITH_HTTPD "HTTP REST API" ON) +option(BUILD_STATIC "Build static binary" OFF) include (CheckIncludeFile) include (cmake/cpu.cmake) @@ -204,5 +205,9 @@ include_directories(src) include_directories(src/3rdparty) include_directories(${UV_INCLUDE_DIR}) +if (BUILD_STATIC) + set(CMAKE_EXE_LINKER_FLAGS " -static") +endif() + add_executable(xmrig ${HEADERS} ${SOURCES} ${SOURCES_OS} ${SOURCES_CPUID} ${HEADERS_CRYPTO} ${SOURCES_CRYPTO} ${SOURCES_SYSLOG} ${HTTPD_SOURCES}) target_link_libraries(xmrig ${UV_LIBRARIES} ${MHD_LIBRARY} ${EXTRA_LIBS} ${CPUID_LIB}) From c0ca68e2dbbcbd5170e98569af18b012536a3343 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 14 Mar 2018 06:32:43 +0700 Subject: [PATCH 2/9] Fix FindUV.cmake and FindMHD.cmake. --- cmake/FindMHD.cmake | 4 ++++ cmake/FindUV.cmake | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/cmake/FindMHD.cmake b/cmake/FindMHD.cmake index a20ecfec..b1e4e895 100644 --- a/cmake/FindMHD.cmake +++ b/cmake/FindMHD.cmake @@ -13,6 +13,8 @@ find_path( DOC "microhttpd include dir" ) +find_path(MHD_INCLUDE_DIR NAMES microhttpd.h) + find_library( MHD_LIBRARY NAMES microhttpd libmicrohttpd @@ -21,6 +23,8 @@ find_library( DOC "microhttpd library" ) +find_library(MHD_LIBRARY NAMES microhttpd libmicrohttpd) + set(MHD_INCLUDE_DIRS ${MHD_INCLUDE_DIR}) set(MHD_LIBRARIES ${MHD_LIBRARY}) diff --git a/cmake/FindUV.cmake b/cmake/FindUV.cmake index 7906633f..ba59d1d3 100644 --- a/cmake/FindUV.cmake +++ b/cmake/FindUV.cmake @@ -3,15 +3,21 @@ find_path( NAMES uv.h PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS" PATH_SUFFIXES "include" + NO_DEFAULT_PATH ) +find_path(UV_INCLUDE_DIR NAMES uv.h) + find_library( UV_LIBRARY NAMES libuv.a uv libuv PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS" PATH_SUFFIXES "lib" + NO_DEFAULT_PATH ) +find_library(UV_LIBRARY NAMES libuv.a uv libuv) + set(UV_LIBRARIES ${UV_LIBRARY}) set(UV_INCLUDE_DIRS ${UV_INCLUDE_DIR}) From f9a3315d7570c5121efadc3c1fbcf54e329bec49 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 14 Mar 2018 16:58:39 +0700 Subject: [PATCH 3/9] Fixes for 32 bit gcc builds. --- src/net/Id.h | 4 ++-- src/net/Job.cpp | 20 ++++++-------------- src/net/Job.h | 14 +------------- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/src/net/Id.h b/src/net/Id.h index 5c77d1d4..5fb2db52 100644 --- a/src/net/Id.h +++ b/src/net/Id.h @@ -34,9 +34,9 @@ namespace xmrig { class Id { public: - inline Id() + inline Id() : + m_data() { - memset(m_data, 0, sizeof(m_data)); } diff --git a/src/net/Job.cpp b/src/net/Job.cpp index 8b1966aa..48e73a52 100644 --- a/src/net/Job.cpp +++ b/src/net/Job.cpp @@ -58,29 +58,31 @@ static inline char hf_bin2hex(unsigned char c) Job::Job() : m_nicehash(false), + m_coin(), m_algo(xmrig::ALGO_CRYPTONIGHT), m_poolId(-2), m_threadId(-1), m_variant(xmrig::VARIANT_AUTO), m_size(0), m_diff(0), - m_target(0) + m_target(0), + m_blob() { - memset(m_coin, 0, sizeof(m_coin)); } Job::Job(int poolId, bool nicehash, int algo, int variant) : m_nicehash(nicehash), + m_coin(), m_algo(algo), m_poolId(poolId), m_threadId(-1), m_variant(variant), m_size(0), m_diff(0), - m_target(0) + m_target(0), + m_blob() { - memset(m_coin, 0, sizeof(m_coin)); } @@ -113,11 +115,6 @@ bool Job::setBlob(const char *blob) m_nicehash = true; } -# ifdef XMRIG_PROXY_PROJECT - memset(m_rawBlob, 0, sizeof(m_rawBlob)); - memcpy(m_rawBlob, blob, m_size * 2); -# endif - return true; } @@ -154,11 +151,6 @@ bool Job::setTarget(const char *target) return false; } -# ifdef XMRIG_PROXY_PROJECT - memset(m_rawTarget, 0, sizeof(m_rawTarget)); - memcpy(m_rawTarget, target, len); -# endif - m_diff = toDiff(m_target); return true; } diff --git a/src/net/Job.h b/src/net/Job.h index 545eaa88..d981ed37 100644 --- a/src/net/Job.h +++ b/src/net/Job.h @@ -30,7 +30,6 @@ #include -#include "align.h" #include "net/Id.h" #include "xmrig.h" @@ -64,11 +63,6 @@ public: inline void setNicehash(bool nicehash) { m_nicehash = nicehash; } inline void setThreadId(int threadId) { m_threadId = threadId; } -# ifdef XMRIG_PROXY_PROJECT - inline char *rawBlob() { return m_rawBlob; } - inline const char *rawTarget() const { return m_rawTarget; } -# endif - static bool fromHex(const char* in, unsigned int len, unsigned char* out); static inline uint32_t *nonce(uint8_t *blob) { return reinterpret_cast(blob + 39); } static inline uint64_t toDiff(uint64_t target) { return 0xFFFFFFFFFFFFFFFFULL / target; } @@ -77,8 +71,6 @@ public: bool operator==(const Job &other) const; private: - VAR_ALIGN(16, uint8_t m_blob[84]); // Max blob size is 84 (75 fixed + 9 variable), aligned to 96. https://github.com/xmrig/xmrig/issues/1 Thanks fireice-uk. - bool m_nicehash; char m_coin[5]; int m_algo; @@ -88,12 +80,8 @@ private: size_t m_size; uint64_t m_diff; uint64_t m_target; + uint8_t m_blob[96]; // Max blob size is 84 (75 fixed + 9 variable), aligned to 96. https://github.com/xmrig/xmrig/issues/1 Thanks fireice-uk. xmrig::Id m_id; - -# ifdef XMRIG_PROXY_PROJECT - VAR_ALIGN(16, char m_rawBlob[169]); - VAR_ALIGN(16, char m_rawTarget[17]); -# endif }; #endif /* __JOB_H__ */ From 7adf30e326ce076c64e0aff511bf6e583ceefda9 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 14 Mar 2018 17:11:51 +0700 Subject: [PATCH 4/9] Remove align.h. --- src/3rdparty/align.h | 33 --------------------------------- src/Mem.h | 5 +---- src/crypto/CryptoNight.h | 8 +++----- src/workers/DoubleWorker.h | 1 - 4 files changed, 4 insertions(+), 43 deletions(-) delete mode 100644 src/3rdparty/align.h diff --git a/src/3rdparty/align.h b/src/3rdparty/align.h deleted file mode 100644 index b61179b9..00000000 --- a/src/3rdparty/align.h +++ /dev/null @@ -1,33 +0,0 @@ -/* XMRig - * Copyright 2010 Jeff Garzik - * Copyright 2012-2014 pooler - * Copyright 2014 Lucas Jones - * Copyright 2014-2016 Wolf9466 - * Copyright 2016 Jay D Dee - * Copyright 2016-2017 XMRig - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef __ALIGN_H__ -#define __ALIGN_H__ - -#ifdef _MSC_VER -# define VAR_ALIGN(x, decl) __declspec(align(x)) decl -#else -# define VAR_ALIGN(x, decl) decl __attribute__ ((aligned(x))) -#endif - -#endif /* __ALIGN_H__ */ diff --git a/src/Mem.h b/src/Mem.h index eaa4f49a..18914d68 100644 --- a/src/Mem.h +++ b/src/Mem.h @@ -30,9 +30,6 @@ #include -#include "align.h" - - struct cryptonight_ctx; @@ -63,7 +60,7 @@ private: static int m_threads; static size_t m_offset; static size_t m_size; - VAR_ALIGN(16, static uint8_t *m_memory); + alignas(16) static uint8_t *m_memory; # ifndef XMRIG_NO_AEON static cryptonight_ctx *createLite(int threadId); diff --git a/src/crypto/CryptoNight.h b/src/crypto/CryptoNight.h index 9526309d..13e9c8e8 100644 --- a/src/crypto/CryptoNight.h +++ b/src/crypto/CryptoNight.h @@ -30,8 +30,6 @@ #include -#include "align.h" - #define AEON_MEMORY 1048576 #define AEON_MASK 0xFFFF0 #define AEON_ITER 0x40000 @@ -42,9 +40,9 @@ struct cryptonight_ctx { - VAR_ALIGN(16, uint8_t state0[200]); - VAR_ALIGN(16, uint8_t state1[200]); - VAR_ALIGN(16, uint8_t* memory); + alignas(16) uint8_t state0[200]; + alignas(16) uint8_t state1[200]; + alignas(16) uint8_t* memory; }; diff --git a/src/workers/DoubleWorker.h b/src/workers/DoubleWorker.h index 9f29fa5b..57be59d0 100644 --- a/src/workers/DoubleWorker.h +++ b/src/workers/DoubleWorker.h @@ -26,7 +26,6 @@ #define __DOUBLEWORKER_H__ -#include "align.h" #include "net/Job.h" #include "net/JobResult.h" #include "workers/Worker.h" From 0e60c5802d17befda45515afd483d430557fe22f Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 14 Mar 2018 17:17:36 +0700 Subject: [PATCH 5/9] Fix. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8959a69f..8823b078 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,6 @@ include (cmake/cpu.cmake) set(HEADERS - src/3rdparty/align.h src/api/Api.h src/api/ApiState.h src/api/NetworkState.h From 2c2b3d2f36e4b1ab4ada3e25b6eca8163e7fb900 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 14 Mar 2018 19:58:38 +0700 Subject: [PATCH 6/9] Fix FindMHD.cmake --- cmake/FindMHD.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/FindMHD.cmake b/cmake/FindMHD.cmake index b1e4e895..7a598e02 100644 --- a/cmake/FindMHD.cmake +++ b/cmake/FindMHD.cmake @@ -11,16 +11,18 @@ find_path( PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS" PATH_SUFFIXES "include" DOC "microhttpd include dir" + NO_DEFAULT_PATH ) find_path(MHD_INCLUDE_DIR NAMES microhttpd.h) find_library( MHD_LIBRARY - NAMES microhttpd libmicrohttpd + NAMES libmicrohttpd.a microhttpd libmicrohttpd PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS" PATH_SUFFIXES "lib" DOC "microhttpd library" + NO_DEFAULT_PATH ) find_library(MHD_LIBRARY NAMES microhttpd libmicrohttpd) From 04c02d4add9dcb2c2141f3e728c8665ef6184131 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 14 Mar 2018 20:22:30 +0700 Subject: [PATCH 7/9] Fix macOS compile. --- src/Mem.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Mem.cpp b/src/Mem.cpp index 9c608f73..b32d2196 100644 --- a/src/Mem.cpp +++ b/src/Mem.cpp @@ -32,13 +32,13 @@ #include "xmrig.h" -bool Mem::m_doubleHash = false; -int Mem::m_algo = 0; -int Mem::m_flags = 0; -int Mem::m_threads = 0; -size_t Mem::m_offset = 0; -size_t Mem::m_size = 0; -uint8_t *Mem::m_memory = nullptr; +bool Mem::m_doubleHash = false; +int Mem::m_algo = 0; +int Mem::m_flags = 0; +int Mem::m_threads = 0; +size_t Mem::m_offset = 0; +size_t Mem::m_size = 0; +alignas(16) uint8_t *Mem::m_memory = nullptr; cryptonight_ctx *Mem::create(int threadId) From d48921bfc8a9f7872c599d629c4c71a1809f9888 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 14 Mar 2018 20:33:17 +0700 Subject: [PATCH 8/9] v2.5.0 --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index e0d4511a..cfaf7e9c 100644 --- a/src/version.h +++ b/src/version.h @@ -27,7 +27,7 @@ #define APP_ID "xmrig" #define APP_NAME "XMRig" #define APP_DESC "XMRig CPU miner" -#define APP_VERSION "2.5.0-dev" +#define APP_VERSION "2.5.0" #define APP_DOMAIN "xmrig.com" #define APP_SITE "www.xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2018 xmrig.com" From 7959cf39fabee36d83683d25d7cd55cead3e3230 Mon Sep 17 00:00:00 2001 From: xmrig Date: Wed, 14 Mar 2018 23:43:57 +0700 Subject: [PATCH 9/9] Update README.md --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index b563d5b0..0330f83f 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Originally based on cpuminer-multi with heavy optimizations/rewrites and removin * [Common Issues](#common-issues) * [Other information](#other-information) * [Donations](#donations) +* [Release checksums](#release-checksums) * [Contacts](#contacts) ## Features @@ -115,6 +116,15 @@ Please note performance is highly dependent on system load. The numbers above ar * XMR: `48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD` * BTC: `1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT` +## Release checksums +### SHA-256 +``` +232ea929f7219c8de81c7e6fcae7437d40d8128cf55b597a6e1fca0cd77f9f5b xmrig-2.5.0-xenial-amd64.tar.gz/xmrig-2.5.0/xmrig +6149ffed21e740cac12aa61b2fdd17248cbd3e51bab2289d2766aad1d29df910 xmrig-2.5.0-gcc-win32.zip/xmrig.exe +9c89f80e21db906439a7a1b333b8215dbe07d8e42f98a63f6c10c954288a7108 xmrig-2.5.0-gcc-win64.zip/xmrig.exe +b50773c5a74ca9921597a1152e2469ec266cc89eb9765038db7e876f0bcece73 xmrig-2.5.0-msvc-win64.zip/xmrig.exe +``` + ## Contacts * support@xmrig.com * [reddit](https://www.reddit.com/user/XMRig/)