错误:"shared_mutex"不是使用读取器锁定 = std::shared_lock<std::shared_mutex> 的"std"的成员;

error: ‘shared_mutex’ is not a member of ‘std’ using ReaderLock = std::shared_lock<std::shared_mutex>;

本文关键字:std shared mutex lock 成员 gt lt 读取 错误 锁定      更新时间:2023-10-16

我正在尝试使用微软海豹库进行同态加密,并按照以下链接中的步骤进行操作 https://github.com/cyberweapons/SEAL/blob/master/INSTALL.txt 当我使用命令 cmake . 终端显示以下结果

-- SEAL detected (version 2.3.1)
-- SEAL build type: Release
-- SEAL debug mode: OFF
-- SEAL using Microsoft GSL: OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ravindra/Desktop/../../MiSEAL/SEAL/SEALExamples

之后,当我给出make命令时,它应该生成一个文件main.cpp.o,而是给出以下错误。

[ 50%] Building CXX object CMakeFiles/sealexamples.dir/main.cpp.o
In file included from /usr/local/include/seal/util/mempool.h:12:0,
from /usr/local/include/seal/memorypoolhandle.h:6,
from /usr/local/include/seal/biguint.h:6,
from /usr/local/include/seal/bigpoly.h:9,
from /usr/local/include/seal/seal.h:3,
from /home/ravindra/Desktop/SakhaProjects/S20_AI/MiSEAL/SEAL/SEALExamples/main.cpp:12:
/usr/local/include/seal/util/locks.h:12:45: error: ‘shared_mutex’ is not a member of ‘std’
using ReaderLock = std::shared_lock<std::shared_mutex>;
^~~
/usr/local/include/seal/util/locks.h:12:45: error: ‘shared_mutex’ is not a member of ‘std’
/usr/local/include/seal/util/locks.h:12:62: error: template argument 1 is invalid
using ReaderLock = std::shared_lock<std::shared_mutex>;
^
/usr/local/include/seal/util/locks.h:14:45: error: ‘shared_mutex’ is not a member of ‘std’
using WriterLock = std::unique_lock<std::shared_mutex>;
^~~
/usr/local/include/seal/util/locks.h:14:45: error: ‘shared_mutex’ is not a member of ‘std’
/usr/local/include/seal/util/locks.h:14:62: error: template argument 1 is invalid
using WriterLock = std::unique_lock<std::shared_mutex>;
^
/usr/local/include/seal/util/locks.h:21:20: error: ‘ReaderLock’ does not name a type
inline ReaderLock acquire_read()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:26:20: error: ‘WriterLock’ does not name a type
inline WriterLock acquire_write()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:31:20: error: ‘ReaderLock’ does not name a type
inline ReaderLock try_acquire_read()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:36:20: error: ‘WriterLock’ does not name a type
inline WriterLock try_acquire_write()
^~~~~~~~~~
/usr/local/include/seal/util/locks.h:46:18: error: ‘shared_mutex’ in namespace ‘std’ does not name a type
std::shared_mutex rw_lock_mutex_;
^~~~~~~~~~~~
In file included from /usr/local/include/seal/memorypoolhandle.h:6:0,
from /usr/local/include/seal/biguint.h:6,
from /usr/local/include/seal/bigpoly.h:9,
from /usr/local/include/seal/seal.h:3,
from /home/ravindra/Desktop/SakhaProjects/S20_AI/MiSEAL/SEAL/SEALExamples/main.cpp:12:
/usr/local/include/seal/util/mempool.h: In member function ‘virtual int64_t seal::util::MemoryPoolMT::pool_count() const’:
/usr/local/include/seal/util/mempool.h:561:17: error: ‘ReaderLock’ was not declared in this scope
ReaderLock lock(pools_locker_.acquire_read());
^~~~~~~~~~
CMakeFiles/sealexamples.dir/build.make:62: recipe for target 'CMakeFiles/sealexamples.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/sealexamples.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/sealexamples.dir/all' failed
make[1]: *** [CMakeFiles/sealexamples.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

我是 SEAL 库的新手,我也是 C++ 编程的初学者,请有人帮助我解决这个问题。

嗨,我找到了解决方案, 我在CMakeLists中包含以下命令.txt文件继续执行步骤 `

# Below is TFHE START
export TFHE_PREFIX=/usr/local
export CPLUS_INCLUDE_PATH=${TFHE_PREFIX}/include:${CPLUS_INCLUDE_PATH}
export C_INCLUDE_PATH=${TFHE_PREFIX}/include:${C_INCLUDE_PATH}
export LIBRARY_PATH=${TFHE_PREFIX}/lib:${LIBRARY_PATH}
export LD_LIBRARY_PATH=${TFHE_PREFIX}/lib:${LD_LIBRARY_PATH}
# Below is TFHE END

'