APSI手动编译,CLion测试

一、简介
APSI——Asymmetric PSI
私用集交集(PSI)是指这样一种功能,即双方都持有一组私用项,可以在不向对方透露任何其他信息的情况下检查他们有哪些共同项。集合大小的上限被假定为公共信息,不受保护。

APSI(不对称PSI)库基于eprint.iacr.org/2021/1116中描述的协议为不对称集合大小提供PSI功能。例如,在许多情况下,一方可能持有数百万条记录的大型数据集,而另一方希望了解数据集中是出现了单个特定记录还是出现了少量记录。我们称之为未标记模式下的APSI。

然而,在许多情况下,查询器还希望为每个匹配的记录检索一些信息。这可以被视为具有隐私保护批量查询功能的键值存储。我们使用术语项和标签来指代这样一个键值存储中的键和值,并在标记模式下调用此APSI。

注意:除非实际需要标记模式,否则使用未标记模式会更有效率(在通信和计算方面)。

二、安装教程
若是简单测试可以尝试使用vcpkg安装:

./vcpkg install apsi

开发者模式安装,确定安装需要的依赖:

Dependencyvcpkg name
Microsoft SEALseal[no-throw-tran]
Microsoft Kukukuku
Log4cpluslog4cplus
cppzmqcppzmq (needed only for ZeroMQ networking support)
FlatBuffersflatbuffers
jsoncppjsoncpp
Google Testgtest (needed only for building tests)
TCLAPtclap (needed only for building CLI)

接下来我们要逐个安装依赖,里面会出现需要手动调时的东西,加油!
1.seal 4.1 :

git clone https://github.com/microsoft/SEAL.git
git checkout https://github.com/microsoft/SEAL.git
cd SEAL
git checkout origin/4.1.0
cmake -S . -B build  -DSEAL_THROW_ON_TRANSPARENT_CIPHERTEXT=OFF
cmake --build build
sudo cmake --install build

可以指定安装路径--prefix /Users/admin/git/SEAL-4.1.0/seal_4.1

2.kuku

git clone https://github.com/microsoft/Kuku.git
cd Kuku
cmake -S . -B build
cmake --build build
sudo cmake --install build

3.Log4cplus

git clone --recurse-submodules https://github.com/log4cplus/log4cplus
cd log4cplus
cmake -S . -B build
cmake --build build
sudo cmake --install build

4.cppzmq

git clone https://github.com/zeromq/cppzmq.git
cd cppzmq
pip install Zeromq
cmake -S . -B build
cmake --build build
sudo cmake --install build

5.FlatBuffers

git clone https://github.com/google/flatbuffers.git
cd flatbuffers
cmake -S . -B build
cmake --build build
sudo cmake --install build

6.jsoncpp

git clone https://github.com/open-source-parsers/jsoncpp.git
cd jsoncpp
cmake -S . -B build
cmake --build build
sudo cmake --install build

7.Google Test

git clone https://github.com/google/googletest.git
cd googletest
cmake -S . -B build -DCMAKE_CXX_COMPILER="c++" -DCMAKE_CXX_FLAGS="-std=c++14 -stdlib=libc++"
cmake --build build
sudo cmake --install build

8.TCLAP

下载:https://sourceforge.net/projects/tclap/
解压
cd tclap
cmake -S . -B build -DCMAKE_CXX_COMPILER="c++" -DCMAKE_CXX_FLAGS="-std=c++14 -stdlib=libc++"
cmake --build build
sudo cmake --install build

如果你可以走到这一步距离大功告成仅差最后一步啦~

上述过程中会出现很多bug,欢迎将问题和解决方案留在评论区🙏

cmake适配
1.使用clion打开APSI:

git clone https://github.com/microsoft/APSI.git

2.打开CMakeList.txt
197行:option(APSI_BUILD_TESTS ${APSI_BUILD_TESTS_OPTION_STR} OFF) 改成
option(APSI_BUILD_TESTS ${APSI_BUILD_TESTS_OPTION_STR} ON)
若出现下面这个错误:

 Linking CXX executable bin/unit_tests
Undefined symbols for architecture arm64:
  "log4cplus::Logger::getInstance(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&)", referenced from:
      apsi::Log::Configure() in libapsi-0.11.a(log.cpp.o)
      apsi::Log::SetLogLevel(apsi::Log::Level) in libapsi-0.11.a(log.cpp.o)
      apsi::Log::DoLog(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, apsi::Log::Level) in libapsi-0.11.a(log.cpp.o)
  "log4cplus::Logger::log(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, char const*, int, char const*) const", referenced from:
      apsi::Log::DoLog(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, apsi::Log::Level) in libapsi-0.11.a(log.cpp.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
#在其中增加依赖位置:
include_directories(/usr/local/include)
link_directories(/usr/local/lib)

这时打开test/unit/src/unit_tests_runner.cpp 仍会出现编译失败的问题,

gtest-port.h:281:2: error: C++ versions less than C++14 are not supported.
#error C++ versions less than C++14 are not supported.

确定自己使用的是C++14 以上版本,删除cmake-build-debug,重新编译。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值