aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2023-11-06 09:21:55 -0500
committerluigi1111 <luigi1111w@gmail.com>2023-11-06 09:21:55 -0500
commit3cea45bc56c6a6d9d7b62be9b9994e69541b7f4f (patch)
tree24a144c2ca60cfaae0e034152a6e73641435dd4a
parentMerge pull request #9026 (diff)
parentcmake: set -fno-aligned-allocation on macOS ARM (diff)
downloadmonero-3cea45bc56c6a6d9d7b62be9b9994e69541b7f4f.tar.xz
Merge pull request #8922
b4491c1 cmake: set -fno-aligned-allocation on macOS ARM (selsta) df9f380 cmake: set BOOST_NO_AUTO_PTR to fix c++17 compilation (selsta) 5136974 device: boost -> std locks to fix c++17 compilation (selsta) 5965b02 cmake: set cpp17 standard (selsta)
-rw-r--r--CMakeLists.txt6
-rw-r--r--README.md2
-rw-r--r--contrib/depends/toolchain.cmake.in2
-rw-r--r--src/device/device_ledger.cpp9
-rw-r--r--src/device/device_ledger.hpp7
-rw-r--r--src/device_trezor/device_trezor_base.hpp15
6 files changed, 20 insertions, 21 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7f96017c6..99baba2ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -96,7 +96,7 @@ enable_language(C ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
@@ -999,6 +999,9 @@ else()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0")
+ if(ARM)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-aligned-allocation")
+ endif()
endif()
set(DEBUG_FLAGS "-g3")
@@ -1077,6 +1080,7 @@ if (WIN32)
endif()
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
add_definitions(-DBOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION)
+add_definitions(-DBOOST_NO_AUTO_PTR)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
if(NOT Boost_FOUND)
diff --git a/README.md b/README.md
index 062bf1104..f0c0fe7fd 100644
--- a/README.md
+++ b/README.md
@@ -166,7 +166,7 @@ library archives (`.a`).
| Dep | Min. version | Vendored | Debian/Ubuntu pkg | Arch pkg | Void pkg | Fedora pkg | Optional | Purpose |
| ------------ | ------------- | -------- | -------------------- | ------------ | ------------------ | ------------------- | -------- | --------------- |
-| GCC | 5 | NO | `build-essential` | `base-devel` | `base-devel` | `gcc` | NO | |
+| GCC | 7 | NO | `build-essential` | `base-devel` | `base-devel` | `gcc` | NO | |
| CMake | 3.5 | NO | `cmake` | `cmake` | `cmake` | `cmake` | NO | |
| pkg-config | any | NO | `pkg-config` | `base-devel` | `base-devel` | `pkgconf` | NO | |
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | `boost-devel` | `boost-devel` | NO | C++ libraries |
diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in
index e5c0cbbb8..6fe4618ae 100644
--- a/contrib/depends/toolchain.cmake.in
+++ b/contrib/depends/toolchain.cmake.in
@@ -92,7 +92,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(PORT OFF)
SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/")
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
- SET(CMAKE_CXX_STANDARD 14)
+ SET(CMAKE_CXX_STANDARD 17)
SET(LLVM_ENABLE_PIC OFF)
SET(LLVM_ENABLE_PIE OFF)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp
index 27d080a1c..009ee16ca 100644
--- a/src/device/device_ledger.cpp
+++ b/src/device/device_ledger.cpp
@@ -34,9 +34,6 @@
#include "cryptonote_basic/subaddress_index.h"
#include "cryptonote_core/cryptonote_tx_utils.h"
-#include <boost/thread/locks.hpp>
-#include <boost/thread/lock_guard.hpp>
-
namespace hw {
namespace ledger {
@@ -322,10 +319,10 @@ namespace hw {
//automatic lock one more level on device ensuring the current thread is allowed to use it
#define AUTO_LOCK_CMD() \
/* lock both mutexes without deadlock*/ \
- boost::lock(device_locker, command_locker); \
+ std::lock(device_locker, command_locker); \
/* make sure both already-locked mutexes are unlocked at the end of scope */ \
- boost::lock_guard<boost::recursive_mutex> lock1(device_locker, boost::adopt_lock); \
- boost::lock_guard<boost::mutex> lock2(command_locker, boost::adopt_lock)
+ std::lock_guard<std::recursive_mutex> lock1(device_locker, std::adopt_lock); \
+ std::lock_guard<std::mutex> lock2(command_locker, std::adopt_lock)
//lock the device for a long sequence
void device_ledger::lock(void) {
diff --git a/src/device/device_ledger.hpp b/src/device/device_ledger.hpp
index 071274160..b65943f0c 100644
--- a/src/device/device_ledger.hpp
+++ b/src/device/device_ledger.hpp
@@ -35,8 +35,7 @@
#include "device.hpp"
#include "log.hpp"
#include "device_io_hid.hpp"
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/recursive_mutex.hpp>
+#include <mutex>
namespace hw {
@@ -140,8 +139,8 @@ namespace hw {
class device_ledger : public hw::device {
private:
// Locker for concurrent access
- mutable boost::recursive_mutex device_locker;
- mutable boost::mutex command_locker;
+ mutable std::recursive_mutex device_locker;
+ mutable std::mutex command_locker;
//IO
hw::io::device_io_hid hw_device;
diff --git a/src/device_trezor/device_trezor_base.hpp b/src/device_trezor/device_trezor_base.hpp
index df6e42b1f..e0fc2aafb 100644
--- a/src/device_trezor/device_trezor_base.hpp
+++ b/src/device_trezor/device_trezor_base.hpp
@@ -32,13 +32,12 @@
#include <cstddef>
+#include <mutex>
#include <string>
#include "device/device.hpp"
#include "device/device_default.hpp"
#include "device/device_cold.hpp"
#include <boost/scope_exit.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/recursive_mutex.hpp>
#include "cryptonote_config.h"
#include "trezor.hpp"
@@ -49,12 +48,12 @@
//automatic lock one more level on device ensuring the current thread is allowed to use it
#define TREZOR_AUTO_LOCK_CMD() \
/* lock both mutexes without deadlock*/ \
- boost::lock(device_locker, command_locker); \
+ std::lock(device_locker, command_locker); \
/* make sure both already-locked mutexes are unlocked at the end of scope */ \
- boost::lock_guard<boost::recursive_mutex> lock1(device_locker, boost::adopt_lock); \
- boost::lock_guard<boost::mutex> lock2(command_locker, boost::adopt_lock)
+ std::lock_guard<std::recursive_mutex> lock1(device_locker, std::adopt_lock); \
+ std::lock_guard<std::mutex> lock2(command_locker, std::adopt_lock)
-#define TREZOR_AUTO_LOCK_DEVICE() boost::lock_guard<boost::recursive_mutex> lock1_device(device_locker)
+#define TREZOR_AUTO_LOCK_DEVICE() std::lock_guard<std::recursive_mutex> lock1_device(device_locker)
namespace hw {
namespace trezor {
@@ -86,8 +85,8 @@ namespace trezor {
protected:
// Locker for concurrent access
- mutable boost::recursive_mutex device_locker;
- mutable boost::mutex command_locker;
+ mutable std::recursive_mutex device_locker;
+ mutable std::mutex command_locker;
std::shared_ptr<Transport> m_transport;
i_device_callback * m_callback;