错误:使用ReaderLock = std :: shared_lock <std :: shared_mutex>的“ shared_mutex”不是“ std”的成员;

时间:2018-08-29 06:10:05

标签: c++ cmake cryptography

我正在尝试使用Microsoft SEAL库进行同态加密,并按照以下链接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 ++编程的初学者,请有人帮助我解决此问题。

1 个答案:

答案 0 :(得分:0)

嗨,我找到了解决方案, 我在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

`