From 89e6998054aed3f7798a0d8c0cf089cea9244668 Mon Sep 17 00:00:00 2001 From: Alexandru Negrila Date: Thu, 9 Apr 2020 09:09:21 +0300 Subject: [PATCH 01/14] Fix OpenSSL static link when BUILD_STATIC=ON is provided --- cmake/OpenSSL.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/OpenSSL.cmake b/cmake/OpenSSL.cmake index 53e970df..270ac87b 100644 --- a/cmake/OpenSSL.cmake +++ b/cmake/OpenSSL.cmake @@ -10,6 +10,11 @@ if (WITH_TLS) set(OPENSSL_USE_STATIC_LIBS TRUE) endif() + if (BUILD_STATIC) + set(OPENSSL_USE_STATIC_LIBS TRUE) + endif() + + find_package(OpenSSL) if (OPENSSL_FOUND) From 9d99fef52e29cbe93e232b86555b5e411447e7b1 Mon Sep 17 00:00:00 2001 From: XMRig Date: Thu, 20 Aug 2020 13:54:52 +0700 Subject: [PATCH 02/14] v6.3.3-dev --- src/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/version.h b/src/version.h index d18781d9..94653fb7 100644 --- a/src/version.h +++ b/src/version.h @@ -28,7 +28,7 @@ #define APP_ID "xmrig" #define APP_NAME "XMRig" #define APP_DESC "XMRig miner" -#define APP_VERSION "6.3.2" +#define APP_VERSION "6.3.3-dev" #define APP_DOMAIN "xmrig.com" #define APP_SITE "www.xmrig.com" #define APP_COPYRIGHT "Copyright (C) 2016-2020 xmrig.com" @@ -36,7 +36,7 @@ #define APP_VER_MAJOR 6 #define APP_VER_MINOR 3 -#define APP_VER_PATCH 2 +#define APP_VER_PATCH 3 #ifdef _MSC_VER # if (_MSC_VER >= 1920) From 950b5fa75ebd87847020cad458da62d21070e89a Mon Sep 17 00:00:00 2001 From: XMRig Date: Thu, 20 Aug 2020 15:02:31 +0700 Subject: [PATCH 03/14] Disable GPU backends with static build on Linux. --- CMakeLists.txt | 4 ---- cmake/flags.cmake | 4 ++++ src/backend/cuda/cuda.cmake | 6 ++++++ src/backend/opencl/opencl.cmake | 6 ++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78270e80..f5e5d9af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -198,10 +198,6 @@ include_directories(src) include_directories(src/3rdparty) include_directories(${UV_INCLUDE_DIR}) -if (BUILD_STATIC) - set(CMAKE_EXE_LINKER_FLAGS " -static") -endif() - if (WITH_DEBUG_LOG) add_definitions(/DAPP_DEBUG) endif() diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 7c2c79b8..7b6d0163 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -45,6 +45,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++") endif() + if (BUILD_STATIC) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") + endif() + add_definitions(/D_GNU_SOURCE) if (${CMAKE_VERSION} VERSION_LESS "3.1.0") diff --git a/src/backend/cuda/cuda.cmake b/src/backend/cuda/cuda.cmake index 75799cd8..d75fc395 100644 --- a/src/backend/cuda/cuda.cmake +++ b/src/backend/cuda/cuda.cmake @@ -1,3 +1,9 @@ +if (BUILD_STATIC AND XMRIG_OS_LINUX AND WITH_CUDA) + message(WARNING "CUDA backend is not compatible with static build, use -DWITH_CUDA=OFF to suppress this warning") + + set(WITH_CUDA OFF) +endif() + if (WITH_CUDA) add_definitions(/DXMRIG_FEATURE_CUDA) diff --git a/src/backend/opencl/opencl.cmake b/src/backend/opencl/opencl.cmake index c53e1f02..8d9235f3 100644 --- a/src/backend/opencl/opencl.cmake +++ b/src/backend/opencl/opencl.cmake @@ -1,3 +1,9 @@ +if (BUILD_STATIC AND XMRIG_OS_LINUX AND WITH_OPENCL) + message(WARNING "OpenCL backend is not compatible with static build, use -DWITH_OPENCL=OFF to suppress this warning") + + set(WITH_OPENCL OFF) +endif() + if (WITH_OPENCL) add_definitions(/DCL_TARGET_OPENCL_VERSION=200) add_definitions(/DCL_USE_DEPRECATED_OPENCL_1_2_APIS) From a354e9d2173a381c0ff2b5ec9d314ce1f9b8d2b6 Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 21 Aug 2020 08:21:51 +0700 Subject: [PATCH 04/14] Fixed tag in OclLib. --- src/backend/opencl/wrappers/OclLib.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/opencl/wrappers/OclLib.cpp b/src/backend/opencl/wrappers/OclLib.cpp index b5b12c62..158ef13e 100644 --- a/src/backend/opencl/wrappers/OclLib.cpp +++ b/src/backend/opencl/wrappers/OclLib.cpp @@ -44,7 +44,7 @@ static uv_lib_t oclLib; -static const char *kErrorTemplate = MAGENTA_BG_BOLD(WHITE_BOLD_S " ocl ") RED(" error ") RED_BOLD("%s") RED(" when calling ") RED_BOLD("%s"); +static const char *kErrorTemplate = MAGENTA_BG_BOLD(WHITE_BOLD_S " opencl ") RED(" error ") RED_BOLD("%s") RED(" when calling ") RED_BOLD("%s"); static const char *kBuildProgram = "clBuildProgram"; static const char *kCreateBuffer = "clCreateBuffer"; From 9a6b8594f3c7a2cbba366c4a6cce2ce8d31268dd Mon Sep 17 00:00:00 2001 From: XMRig Date: Fri, 21 Aug 2020 09:14:22 +0700 Subject: [PATCH 05/14] Removed bzip2 dependency for hwloc build. --- scripts/build.hwloc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build.hwloc.sh b/scripts/build.hwloc.sh index 326b6640..216f3af2 100755 --- a/scripts/build.hwloc.sh +++ b/scripts/build.hwloc.sh @@ -8,8 +8,8 @@ mkdir -p deps/lib mkdir -p build && cd build -wget https://download.open-mpi.org/release/hwloc/v2.2/hwloc-${HWLOC_VERSION}.tar.bz2 -O hwloc-${HWLOC_VERSION}.tar.bz2 -tar -xjf hwloc-${HWLOC_VERSION}.tar.bz2 +wget https://download.open-mpi.org/release/hwloc/v2.2/hwloc-${HWLOC_VERSION}.tar.gz -O hwloc-${HWLOC_VERSION}.tar.gz +tar -xzf hwloc-${HWLOC_VERSION}.tar.gz cd hwloc-${HWLOC_VERSION} ./configure --disable-shared --enable-static --disable-io --disable-libudev --disable-libxml2 From 879e160ba3e12848d95ebb24a8ce9dab8e39df57 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 23 Aug 2020 14:22:08 +0700 Subject: [PATCH 06/14] Fix compile warning. --- src/crypto/rx/RxNUMAStorage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/rx/RxNUMAStorage.cpp b/src/crypto/rx/RxNUMAStorage.cpp index 09a0fd37..4b4ab4d6 100644 --- a/src/crypto/rx/RxNUMAStorage.cpp +++ b/src/crypto/rx/RxNUMAStorage.cpp @@ -164,7 +164,7 @@ public: return true; } - for (const auto kv : m_datasets) { + for (const auto &kv : m_datasets) { if (kv.second->isOneGbPages()) { return false; } From 4b682b6633d1b3b95bd92104864f955923f87d22 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 23 Aug 2020 15:46:56 +0700 Subject: [PATCH 07/14] Better scripts/build.*.sh compatibility. --- cmake/flags.cmake | 4 ++++ scripts/build.hwloc.sh | 4 ++-- scripts/build.hwloc1.sh | 19 +++++++++++++++++++ scripts/build.libressl.sh | 4 ++-- scripts/build.openssl.sh | 4 ++-- scripts/build.uv.sh | 4 ++-- src/backend/cuda/cuda.cmake | 2 +- src/backend/opencl/opencl.cmake | 2 +- 8 files changed, 33 insertions(+), 10 deletions(-) create mode 100755 scripts/build.hwloc1.sh diff --git a/cmake/flags.cmake b/cmake/flags.cmake index 7b6d0163..5edad339 100644 --- a/cmake/flags.cmake +++ b/cmake/flags.cmake @@ -96,6 +96,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang) endif() endif() + if (BUILD_STATIC) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static") + endif() + endif() if (NOT WIN32) diff --git a/scripts/build.hwloc.sh b/scripts/build.hwloc.sh index 216f3af2..1ca34731 100755 --- a/scripts/build.hwloc.sh +++ b/scripts/build.hwloc.sh @@ -13,7 +13,7 @@ tar -xzf hwloc-${HWLOC_VERSION}.tar.gz cd hwloc-${HWLOC_VERSION} ./configure --disable-shared --enable-static --disable-io --disable-libudev --disable-libxml2 -make -j$(nproc) -cp -fr include/ ../../deps +make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu) +cp -fr include ../../deps cp hwloc/.libs/libhwloc.a ../../deps/lib cd .. \ No newline at end of file diff --git a/scripts/build.hwloc1.sh b/scripts/build.hwloc1.sh new file mode 100755 index 00000000..f1afc285 --- /dev/null +++ b/scripts/build.hwloc1.sh @@ -0,0 +1,19 @@ +#!/bin/bash -e + +HWLOC_VERSION="1.11.13" + +mkdir -p deps +mkdir -p deps/include +mkdir -p deps/lib + +mkdir -p build && cd build + +wget https://download.open-mpi.org/release/hwloc/v1.11/hwloc-${HWLOC_VERSION}.tar.gz -O hwloc-${HWLOC_VERSION}.tar.gz +tar -xzf hwloc-${HWLOC_VERSION}.tar.gz + +cd hwloc-${HWLOC_VERSION} +./configure --disable-shared --enable-static --disable-io --disable-libudev --disable-libxml2 +make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu) +cp -fr include ../../deps +cp src/.libs/libhwloc.a ../../deps/lib +cd .. \ No newline at end of file diff --git a/scripts/build.libressl.sh b/scripts/build.libressl.sh index af7fe822..e7495233 100755 --- a/scripts/build.libressl.sh +++ b/scripts/build.libressl.sh @@ -13,8 +13,8 @@ tar -xzf libressl-${LIBRESSL_VERSION}.tar.gz cd libressl-${LIBRESSL_VERSION} ./configure --disable-shared -make -j$(nproc) -cp -fr include/ ../../deps +make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu) +cp -fr include ../../deps cp crypto/.libs/libcrypto.a ../../deps/lib cp ssl/.libs/libssl.a ../../deps/lib cd .. \ No newline at end of file diff --git a/scripts/build.openssl.sh b/scripts/build.openssl.sh index 5939eb57..5f9e5a71 100755 --- a/scripts/build.openssl.sh +++ b/scripts/build.openssl.sh @@ -13,8 +13,8 @@ tar -xzf openssl-${OPENSSL_VERSION}.tar.gz cd openssl-${OPENSSL_VERSION} ./config -no-shared -no-asm -no-zlib -no-comp -no-dgram -no-filenames -no-cms -make -j$(nproc) -cp -fr include/ ../../deps +make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu) +cp -fr include ../../deps cp libcrypto.a ../../deps/lib cp libssl.a ../../deps/lib cd .. \ No newline at end of file diff --git a/scripts/build.uv.sh b/scripts/build.uv.sh index 6f4c9796..8279da37 100755 --- a/scripts/build.uv.sh +++ b/scripts/build.uv.sh @@ -14,7 +14,7 @@ tar -xzf v${UV_VERSION}.tar.gz cd libuv-${UV_VERSION} sh autogen.sh ./configure --disable-shared -make -j$(nproc) -cp -fr include/ ../../deps +make -j$(nproc || sysctl -n hw.ncpu || sysctl -n hw.logicalcpu) +cp -fr include ../../deps cp .libs/libuv.a ../../deps/lib cd .. \ No newline at end of file diff --git a/src/backend/cuda/cuda.cmake b/src/backend/cuda/cuda.cmake index d75fc395..6661ec83 100644 --- a/src/backend/cuda/cuda.cmake +++ b/src/backend/cuda/cuda.cmake @@ -1,4 +1,4 @@ -if (BUILD_STATIC AND XMRIG_OS_LINUX AND WITH_CUDA) +if (BUILD_STATIC AND XMRIG_OS_UNIX AND WITH_CUDA) message(WARNING "CUDA backend is not compatible with static build, use -DWITH_CUDA=OFF to suppress this warning") set(WITH_CUDA OFF) diff --git a/src/backend/opencl/opencl.cmake b/src/backend/opencl/opencl.cmake index 8d9235f3..acaed339 100644 --- a/src/backend/opencl/opencl.cmake +++ b/src/backend/opencl/opencl.cmake @@ -1,4 +1,4 @@ -if (BUILD_STATIC AND XMRIG_OS_LINUX AND WITH_OPENCL) +if (BUILD_STATIC AND XMRIG_OS_UNIX AND WITH_OPENCL) message(WARNING "OpenCL backend is not compatible with static build, use -DWITH_OPENCL=OFF to suppress this warning") set(WITH_OPENCL OFF) From ff13675d3110901eb501d78eae413ccdd1329621 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 23 Aug 2020 21:30:12 +0700 Subject: [PATCH 08/14] Improved CUDA loader error reporting and fixed plugin load on Linux. --- src/backend/cuda/CudaBackend.cpp | 4 +- src/backend/cuda/wrappers/CudaLib.cpp | 135 +++++++++++++++----------- src/backend/cuda/wrappers/CudaLib.h | 5 +- 3 files changed, 87 insertions(+), 57 deletions(-) diff --git a/src/backend/cuda/CudaBackend.cpp b/src/backend/cuda/CudaBackend.cpp index a15ba810..ed23d4d3 100644 --- a/src/backend/cuda/CudaBackend.cpp +++ b/src/backend/cuda/CudaBackend.cpp @@ -152,7 +152,9 @@ public: } if (!CudaLib::init(cuda.loader())) { - return printDisabled(kLabel, RED_S " (failed to load CUDA plugin)"); + Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") RED_BOLD("disabled ") RED("(%s)"), kLabel, CudaLib::lastError()); + + return; } runtimeVersion = CudaLib::runtimeVersion(); diff --git a/src/backend/cuda/wrappers/CudaLib.cpp b/src/backend/cuda/wrappers/CudaLib.cpp index 0829e0bb..db6b4e95 100644 --- a/src/backend/cuda/wrappers/CudaLib.cpp +++ b/src/backend/cuda/wrappers/CudaLib.cpp @@ -30,6 +30,7 @@ #include "backend/cuda/wrappers/CudaLib.h" #include "base/io/Env.h" #include "base/io/log/Log.h" +#include "base/kernel/Process.h" #include "crypto/rx/RxAlgo.h" @@ -46,6 +47,14 @@ enum Version : uint32_t static uv_lib_t cudaLib; +#if defined(__APPLE__) +static String defaultLoader = "/System/Library/Frameworks/OpenCL.framework/OpenCL"; +#elif defined(_WIN32) +static String defaultLoader = "xmrig-cuda.dll"; +#else +static String defaultLoader = "libxmrig-cuda.so"; +#endif + static const char *kAlloc = "alloc"; static const char *kAstroBWTHash = "astroBWTHash"; @@ -125,11 +134,12 @@ static setJob_v2_t pSetJob_v2 = nullptr; static version_t pVersion = nullptr; -#define DLSYM(x) if (uv_dlsym(&cudaLib, k##x, reinterpret_cast(&p##x)) == -1) { throw std::runtime_error("symbol not found (" #x ")"); } +#define DLSYM(x) if (uv_dlsym(&cudaLib, k##x, reinterpret_cast(&p##x)) == -1) { throw std::runtime_error(std::string("symbol not found: ") + k##x); } bool CudaLib::m_initialized = false; bool CudaLib::m_ready = false; +String CudaLib::m_error; String CudaLib::m_loader; @@ -139,9 +149,22 @@ String CudaLib::m_loader; bool xmrig::CudaLib::init(const char *fileName) { if (!m_initialized) { - m_loader = fileName == nullptr ? defaultLoader() : Env::expand(fileName); - m_ready = uv_dlopen(m_loader, &cudaLib) == 0 && load(); m_initialized = true; + m_loader = fileName == nullptr ? defaultLoader : Env::expand(fileName); + + if (!open()) { + return false; + } + + try { + load(); + } catch (std::exception &ex) { + m_error = (std::string(m_loader) + ": " + ex.what()).c_str(); + + return false; + } + + m_ready = true; } return m_ready; @@ -150,7 +173,7 @@ bool xmrig::CudaLib::init(const char *fileName) const char *xmrig::CudaLib::lastError() noexcept { - return uv_dlerror(&cudaLib); + return m_error; } @@ -344,66 +367,70 @@ void xmrig::CudaLib::release(nvid_ctx *ctx) noexcept } -bool xmrig::CudaLib::load() +bool xmrig::CudaLib::open() { - if (uv_dlsym(&cudaLib, kVersion, reinterpret_cast(&pVersion)) == -1) { + m_error = nullptr; + + if (uv_dlopen(m_loader, &cudaLib) == 0) { + return true; + } + +# ifdef XMRIG_OS_LINUX + if (m_loader == defaultLoader) { + m_loader = Process::location(Process::ExeLocation, m_loader); + } + else { return false; } + if (uv_dlopen(m_loader, &cudaLib) == 0) { + return true; + } +# endif + + m_error = uv_dlerror(&cudaLib); + + return false; +} + + +void xmrig::CudaLib::load() +{ + DLSYM(Version); + if (pVersion(ApiVersion) != 3U) { - return false; + throw std::runtime_error("API version mismatch"); } - uv_dlsym(&cudaLib, kDeviceInfo_v2, reinterpret_cast(&pDeviceInfo_v2)); - uv_dlsym(&cudaLib, kSetJob_v2, reinterpret_cast(&pSetJob_v2)); + DLSYM(Alloc); + DLSYM(CnHash); + DLSYM(DeviceCount); + DLSYM(DeviceInit); + DLSYM(DeviceInt); + DLSYM(DeviceName); + DLSYM(DeviceUint); + DLSYM(DeviceUlong); + DLSYM(Init); + DLSYM(LastError); + DLSYM(PluginVersion); + DLSYM(Release); + DLSYM(RxHash); + DLSYM(RxPrepare); + DLSYM(AstroBWTHash); + DLSYM(AstroBWTPrepare); + DLSYM(KawPowHash); + DLSYM(KawPowPrepare_v2); + DLSYM(KawPowStopHash); - try { - DLSYM(Alloc); - DLSYM(CnHash); - DLSYM(DeviceCount); - DLSYM(DeviceInit); - DLSYM(DeviceInt); - DLSYM(DeviceName); - DLSYM(DeviceUint); - DLSYM(DeviceUlong); - DLSYM(Init); - DLSYM(LastError); - DLSYM(PluginVersion); - DLSYM(Release); - DLSYM(RxHash); - DLSYM(RxPrepare); - DLSYM(AstroBWTHash); - DLSYM(AstroBWTPrepare); - DLSYM(KawPowHash); - DLSYM(KawPowPrepare_v2); - DLSYM(KawPowStopHash); - DLSYM(Version); + uv_dlsym(&cudaLib, kDeviceInfo_v2, reinterpret_cast(&pDeviceInfo_v2)); + if (!pDeviceInfo_v2) { + DLSYM(DeviceInfo); + } - if (!pDeviceInfo_v2) { - DLSYM(DeviceInfo); - } - - if (!pSetJob_v2) { - DLSYM(SetJob); - } - } catch (std::exception &ex) { - LOG_ERR("Error loading CUDA library: %s", ex.what()); - return false; + uv_dlsym(&cudaLib, kSetJob_v2, reinterpret_cast(&pSetJob_v2)); + if (!pSetJob_v2) { + DLSYM(SetJob); } pInit(); - - return true; -} - - -xmrig::String xmrig::CudaLib::defaultLoader() -{ -# if defined(__APPLE__) - return "/System/Library/Frameworks/OpenCL.framework/OpenCL"; // FIXME -# elif defined(_WIN32) - return "xmrig-cuda.dll"; -# else - return "libxmrig-cuda.so"; -# endif } diff --git a/src/backend/cuda/wrappers/CudaLib.h b/src/backend/cuda/wrappers/CudaLib.h index c058ffd5..d7b776d2 100644 --- a/src/backend/cuda/wrappers/CudaLib.h +++ b/src/backend/cuda/wrappers/CudaLib.h @@ -99,11 +99,12 @@ public: static void release(nvid_ctx *ctx) noexcept; private: - static bool load(); - static String defaultLoader(); + static bool open(); + static void load(); static bool m_initialized; static bool m_ready; + static String m_error; static String m_loader; }; From bc128d11d951962375b09a2be1681982808c8963 Mon Sep 17 00:00:00 2001 From: XMRig Date: Sun, 23 Aug 2020 23:48:05 +0700 Subject: [PATCH 09/14] Add strip for clang. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5e5d9af..dff77ee5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -209,3 +209,7 @@ if (WIN32) add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/bin/WinRing0/WinRing0x64.sys" $) endif() + +if (CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_BUILD_TYPE STREQUAL Release) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} ${CMAKE_PROJECT_NAME}) +endif() From 72c8404d18736d0a38048fb636ab63674f795012 Mon Sep 17 00:00:00 2001 From: XMRig Date: Mon, 24 Aug 2020 10:04:46 +0700 Subject: [PATCH 10/14] Fix compile warnings. --- src/base/kernel/Entry.cpp | 2 +- src/base/kernel/config/BaseConfig.cpp | 2 +- src/base/net/http/HttpListener.h | 9 ++++++++- src/crypto/kawpow/KPCache.cpp | 2 +- src/crypto/randomx/randomx.cpp | 2 ++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/base/kernel/Entry.cpp b/src/base/kernel/Entry.cpp index ae2ac3ce..a50cb634 100644 --- a/src/base/kernel/Entry.cpp +++ b/src/base/kernel/Entry.cpp @@ -84,7 +84,7 @@ static int showVersion() # if defined(LIBRESSL_VERSION_TEXT) printf("LibreSSL/%s\n", LIBRESSL_VERSION_TEXT + 9); # elif defined(OPENSSL_VERSION_TEXT) - constexpr const char *v = OPENSSL_VERSION_TEXT + 8; + constexpr const char *v = &OPENSSL_VERSION_TEXT[8]; printf("OpenSSL/%.*s\n", static_cast(strchr(v, ' ') - v), v); # endif } diff --git a/src/base/kernel/config/BaseConfig.cpp b/src/base/kernel/config/BaseConfig.cpp index 2e3a598c..27aa2ce9 100644 --- a/src/base/kernel/config/BaseConfig.cpp +++ b/src/base/kernel/config/BaseConfig.cpp @@ -157,7 +157,7 @@ void xmrig::BaseConfig::printVersions() snprintf(buf, sizeof buf, "LibreSSL/%s ", LIBRESSL_VERSION_TEXT + 9); libs += buf; # elif defined(OPENSSL_VERSION_TEXT) - constexpr const char *v = OPENSSL_VERSION_TEXT + 8; + constexpr const char *v = &OPENSSL_VERSION_TEXT[8]; snprintf(buf, sizeof buf, "OpenSSL/%.*s ", static_cast(strchr(v, ' ') - v), v); libs += buf; # endif diff --git a/src/base/net/http/HttpListener.h b/src/base/net/http/HttpListener.h index ac302dab..4f982c4d 100644 --- a/src/base/net/http/HttpListener.h +++ b/src/base/net/http/HttpListener.h @@ -29,13 +29,20 @@ namespace xmrig { class HttpListener : public IHttpListener { public: - inline HttpListener(IHttpListener *listener, const char *tag = nullptr) : m_tag(tag), m_listener(listener) {} + inline HttpListener(IHttpListener *listener, const char *tag = nullptr) : +# ifdef APP_DEBUG + m_tag(tag), +# endif + m_listener(listener) + {} protected: void onHttpData(const HttpData &data) override; private: +# ifdef APP_DEBUG const char *m_tag; +# endif IHttpListener *m_listener; }; diff --git a/src/crypto/kawpow/KPCache.cpp b/src/crypto/kawpow/KPCache.cpp index f4634102..2a60a787 100644 --- a/src/crypto/kawpow/KPCache.cpp +++ b/src/crypto/kawpow/KPCache.cpp @@ -91,7 +91,7 @@ bool KPCache::init(uint32_t epoch) const uint32_t a = (cache_nodes * i) / n; const uint32_t b = (cache_nodes * (i + 1)) / n; - threads.emplace_back([this, a, b, cache_nodes, &cache]() { + threads.emplace_back([this, a, b, &cache]() { uint32_t j = a; for (; j + 4 <= b; j += 4) ethash_calculate_dag_item4_opt(((node*)m_DAGCache.data()) + j, j, num_dataset_parents, &cache); for (; j < b; ++j) ethash_calculate_dag_item_opt(((node*)m_DAGCache.data()) + j, j, num_dataset_parents, &cache); diff --git a/src/crypto/randomx/randomx.cpp b/src/crypto/randomx/randomx.cpp index 5bfd9e78..fdd7bd06 100644 --- a/src/crypto/randomx/randomx.cpp +++ b/src/crypto/randomx/randomx.cpp @@ -207,7 +207,9 @@ RandomX_ConfigurationBase::RandomX_ConfigurationBase() # endif } +#ifdef XMRIG_ARMv8 static uint32_t Log2(size_t value) { return (value > 1) ? (Log2(value / 2) + 1) : 0; } +#endif void RandomX_ConfigurationBase::Apply() { From 5611ae9a30f729f37f46e1aea4fdf9a42e2e2cee Mon Sep 17 00:00:00 2001 From: SChernykh Date: Tue, 25 Aug 2020 16:17:48 +0200 Subject: [PATCH 11/14] Fixed self-select login sequence In self-select mode, we only have pool wallet right after login. --- src/base/net/stratum/Job.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/net/stratum/Job.h b/src/base/net/stratum/Job.h index ea52be74..8341439a 100644 --- a/src/base/net/stratum/Job.h +++ b/src/base/net/stratum/Job.h @@ -65,7 +65,7 @@ public: void setDiff(uint64_t diff); inline bool isNicehash() const { return m_nicehash; } - inline bool isValid() const { return m_size > 0 && m_diff > 0; } + inline bool isValid() const { return (m_size > 0 && m_diff > 0) || !m_poolWallet.isEmpty(); } inline bool setId(const char *id) { return m_id = id; } inline const Algorithm &algorithm() const { return m_algorithm; } inline const Buffer &seed() const { return m_seed; } From a06ec06e8bf3181efa42bd1a043e0310cd6ba369 Mon Sep 17 00:00:00 2001 From: XMRig Date: Wed, 26 Aug 2020 16:11:29 +0700 Subject: [PATCH 12/14] Fix colors on macOS. --- src/base/io/log/Log.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/base/io/log/Log.h b/src/base/io/log/Log.h index 5454feee..bbe9f560 100644 --- a/src/base/io/log/Log.h +++ b/src/base/io/log/Log.h @@ -81,7 +81,13 @@ private: #define CLEAR CSI "0m" // all attributes off #define BRIGHT_BLACK_S CSI "0;90m" // somewhat MD.GRAY #define BLACK_S CSI "0;30m" -#define BLACK_BOLD_S CSI "1;30m" // another name for GRAY + +#ifdef XMRIG_OS_APPLE +# define BLACK_BOLD_S CSI "0;37m" +#else +# define BLACK_BOLD_S CSI "1;30m" // another name for GRAY +#endif + #define RED_S CSI "0;31m" #define RED_BOLD_S CSI "1;31m" #define GREEN_S CSI "0;32m" From 24f541a0dd984ff4a0f35a4baa8aa71db5adefc0 Mon Sep 17 00:00:00 2001 From: xmrig Date: Wed, 26 Aug 2020 23:09:05 +0700 Subject: [PATCH 13/14] Update README.md --- README.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 78b96f6e..1077b7c8 100644 --- a/README.md +++ b/README.md @@ -2,36 +2,35 @@ [![Github All Releases](https://img.shields.io/github/downloads/xmrig/xmrig/total.svg)](https://github.com/xmrig/xmrig/releases) [![GitHub release](https://img.shields.io/github/release/xmrig/xmrig/all.svg)](https://github.com/xmrig/xmrig/releases) -[![GitHub Release Date](https://img.shields.io/github/release-date-pre/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/releases) +[![GitHub Release Date](https://img.shields.io/github/release-date/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/releases) [![GitHub license](https://img.shields.io/github/license/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/blob/master/LICENSE) [![GitHub stars](https://img.shields.io/github/stars/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/stargazers) [![GitHub forks](https://img.shields.io/github/forks/xmrig/xmrig.svg)](https://github.com/xmrig/xmrig/network) -XMRig High performance, open source, cross platform RandomX, KawPow, CryptoNight, AstroBWT and Argon2 CPU/GPU miner, with official support for Windows. +XMRig is a high performance, open source, cross platform RandomX, KawPow, CryptoNight and AstroBWT unified CPU/GPU miner. Official binaries are available for Windows, Linux, macOS and FreeBSD. ## Mining backends -- **CPU** (x64/x86/ARM) +- **CPU** (x64/ARMv8) - **OpenCL** for AMD GPUs. - **CUDA** for NVIDIA GPUs via external [CUDA plugin](https://github.com/xmrig/xmrig-cuda). - - ## Download -* Binary releases: https://github.com/xmrig/xmrig/releases -* Git tree: https://github.com/xmrig/xmrig.git - * Clone with `git clone https://github.com/xmrig/xmrig.git` :hammer: [Build instructions](https://github.com/xmrig/xmrig/wiki/Build). +* **[Binary releases](https://github.com/xmrig/xmrig/releases)** +* **[Build from source](https://xmrig.com/docs/miner/build)** ## Usage -The preferred way to configure the miner is the [JSON config file](src/config.json) as it is more flexible and human friendly. The command line interface does not cover all features, such as mining profiles for different algorithms. Important options can be changed during runtime without miner restart by editing the config file or executing API calls. +The preferred way to configure the miner is the [JSON config file](src/config.json) as it is more flexible and human friendly. The [command line interface](https://xmrig.com/docs/miner/command-line-options) does not cover all features, such as mining profiles for different algorithms. Important options can be changed during runtime without miner restart by editing the config file or executing API calls. -* **[xmrig.com/wizard](https://xmrig.com/wizard)** helps you create initial configuration for the miner. -* **[workers.xmrig.info](http://workers.xmrig.info)** helps manage your miners via HTTP API. -* **[Command line options](https://xmrig.com/docs/miner/command-line-options)** +* **[Wizard](https://xmrig.com/wizard)** helps you create initial configuration for the miner. +* **[Workers](http://workers.xmrig.info)** helps manage your miners via HTTP API. ## Donations * Default donation 1% (1 minute in 100 minutes) can be increased via option `donate-level` or disabled in source code. * XMR: `48edfHu7V9Z84YzzMa6fUueoELZ9ZRXq9VetWzYGzKt52XU5xvqgzYnDK9URnRoJMk1j8nLwEVsaSWJ4fhdUyZijBGUicoD` -* BTC: `1P7ujsXeX7GxQwHNnJsRMgAdNkFZmNVqJT` + +## Developers +* **[xmrig](https://github.com/xmrig)** +* **[sech1](https://github.com/SChernykh)** ## Contacts * support@xmrig.com From fc850179480030f055f40fcc29c57f857f25abf1 Mon Sep 17 00:00:00 2001 From: xmrig Date: Fri, 28 Aug 2020 21:25:26 +0700 Subject: [PATCH 14/14] Update CHANGELOG.md --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8b42784..87c5714d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +# v6.3.3 +- [#1817](https://github.com/xmrig/xmrig/pull/1817) Fixed self-select login sequence. +- Added brand new [build from source](https://xmrig.com/docs/miner/build) documentation. +- New binary downloads for macOS (`macos-x64`), FreeBSD (`freebsd-static-x64`), Linux (`linux-static-x64`), Ubuntu 18.04 (`bionic-x64`), Ubuntu 20.04 (`focal-x64`). +- Generic Linux download `xenial-x64` renamed to `linux-x64`. +- Builds without SSL/TLS support are no longer provided. +- Improved CUDA loader error reporting and fixed plugin load on Linux. +- Fixed build warnings with Clang compiler. +- Fixed colors on macOS. + # v6.3.2 - [#1794](https://github.com/xmrig/xmrig/pull/1794) More robust 1 GB pages handling. - Don't allocate 1 GB per thread if 1 GB is the default huge page size.