文章目录

  • 运行环境安装
    • 环境要求
    • python 3.5+ 安装,本地安装的是 python3.7(和本地虚拟机对应)
    • GCC安装,此处安装的是clang
    • libtool安装
    • yasm安装
    • libsodium library 安装
    • OpenSSL 安装
    • Boost.Asio with SSL support, Boost.Thread for BMR 安装
    • NTL 安装
    • 安装boost-system
    • MPIR安装
    • git安装
  • 编译运行测试环境
  • 问题汇总
    • 使用`mascot-party`虚拟机出现的错误
      • `libsodium.18.so`找不到错误
      • `libSPDZ.so`找不到错误
    • `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE

运行环境安装

环境要求

Requirements
- GCC 5 or later (tested with up to 11) or LLVM/clang 5 or later (tested with up to 12). We recommend clang because it performs better.
- MPIR library, compiled with C++ support (use flag --enable-cxx when running configure). You can use make -j8 tldr to install it locally.
- libsodium library, tested against 1.0.18
- OpenSSL, tested against 1.1.1
- Boost.Asio with SSL support (libboost-dev on Ubuntu), tested against 1.71
- Boost.Thread for BMR (libboost-thread-dev on Ubuntu), tested against 1.71
- x86 or ARM 64-bit CPU (the latter tested with AWS Gravitron and Apple Silicon)
- Python 3.5 or later
- NTL library for homomorphic encryption (optional; tested with NTL 10.5)

python 3.5+ 安装,本地安装的是 python3.7(和本地虚拟机对应)

// requirements
sudo dnf install -y gcc openssl-devel bzip2-devel libffi-devel// install python
cd /opt
sudo wget https://www.python.org/ftp/python/3.7.9/Python-3.7.12.tgz
sudo tar xzf Python-3.7.12.tgz
cd Python-3.7.12
sudo ./configure --enable-optimizations
sudo make altinstall
sudo rm Python-3.7.12.tgz// 建立python软连接
ll /usr/local/bin | grep python
sudo ln -s /usr/local/bin/python3.7 /usr/bin/python
sudo ln -s /usr/local/bin/python3.7 /usr/bin/python3
// 如果python3存在,则删除python3,再重新进行软连接
sudo rm /usr/bin/python3

GCC安装,此处安装的是clang

参考:How To Install clang on CentOS 8

sudo dnf makecache --refresh
sudo dnf -y install clang

如果出现如下错误:

Last metadata expiration check: 0:08:51 ago on Tue 09 Aug 2022 03:01:52 PM CST.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Modular dependency problems:Problem 1: conflicting requests- nothing provides module(perl:5.26) needed by module perl-DBD-SQLite:1.58:8030020200716174729:3a70019f-0.x86_64Problem 2: conflicting requests- nothing provides module(perl:5.26) needed by module perl-DBI:1.641:8030020200716150652:1e4bbb35-0.x86_64
No match for argument: clang
Error: Unable to find a match: clang

解决方法参考:centos8 yum替换阿里源

libtool安装

sudo dnf makecache
sudo dnf install -y libtool.x86_64

yasm安装

cd /opt
sudo wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
sudo tar zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
sudo ./configure
sudo make install
cd .. && sudo rm yasm-1.3.0.tar.gz

libsodium library 安装

sudo dnf install -y libsodium-static.x86_64

OpenSSL 安装

// 查看是否已安装,由于本地已安装OpenSSL 1.1.1k ,跳过此步骤
openssl version -v// Install C_rehash script
sudo yum install -y openssl-perl

Boost.Asio with SSL support, Boost.Thread for BMR 安装

截至到2022.7.7,centos8 最新版本是1.66

sudo dnf -y install boost// 安装 boost.asio库,参考https://blog.csdn.net/qq_28648083/article/details/53465367// 其下载地址:https://sourceforge.net/projects/boost/files/boost
// 打开F12,使用network选项卡,获得.tar.gz的下载地址
cd /opt
sudo wget https://jaist.dl.sourceforge.net/project/boost/boost/1.79.0/boost_1_79_0.tar.gz
sudo tar -zxvf  boost_1_79_0.tar.gz
cd boost_1_79_0
sudo ./bootstrap.sh
sudo ./b2 install

安装好之后,仍然找不到头文件

sudo vi /etc/ld.so.conf.d/boost.asio.1.79.conf
// 输入如下字符串,保存退出
/usr/local/lib// 使修改生效
sudo ldconfig

NTL 安装

install requirements

sudo dnf makecache --refresh
sudo dnf -y install gmp-devel

NTL download site: https://libntl.org/download.html

cd /opt
sudo wget https://libntl.org/ntl-11.5.1.tar.gz
sudo tar zxvf  ntl-11.5.1.tar.gz
cd ntl-11.5.1/src
sudo ./configure
sudo make
sudo make check // 可以不进行
sudo make install
cd ../.. && sudo rm ntl-11.5.1.tar.gz

安装boost-system

sudo dnf -y install boost-system

MPIR安装

cd /path/to/your/MP-SPDZ
make clean
cd mpir && make clean && cd ..
rm ./local/* -rf// 查看文件是否被删除干净
find ./ -type f | grep \\.o$
find ./ -type f | grep \\.so$
find ./ -type f | grep \\.x$
find ./ -type f | grep \\.d$
find ./ -type f | grep \\.a$
// 编译
make -j8 tldr

如果出现./configure: Permission denied错误,设置可执行权限

chmod +x mpir/*.sh
chmod +x mpir/configure

如果出现../libtool: line 1766: ../mpn/m4-ccas: Permission denied错误,设置可执行权限

chmod +x mpir/mpn/m4-ccas

git安装

sudo dnf install git -y

编译运行测试环境

./compile.py tutorial
echo 1 2 3 4 > Player-Data/Input-P0-0
echo 1 2 3 4 > Player-Data/Input-P1-0
Scripts/mascot.sh tutorial

问题汇总

当python(指向python3.7.12)和python3(指向python3.6.8)版本不一致时就会出现如下问题,到最后呈现都没法运行。所以,出现问题时,一定要检查python、python3的版本。同时执行make clean删除历史。

使用mascot-party虚拟机出现的错误

libsodium.18.so找不到错误

具体错误如下:

./mascot-party.x: error while loading shared libraries: libSPDZ.so: cannot open shared object file: No such file or directory

使用ldd mascot-party.x查看 mascot-party.x引用的链接库信息如下:

        linux-vdso.so.1 (0x00007fff854c6000)libSPDZ.so => /home/baas/codes/mpc/MP-SPDZ/local/lib/libSPDZ.so (0x00007f36b7c4d000)libmpirxx.so.8 => /home/baas/codes/mpc/MP-SPDZ/local/lib/libmpirxx.so.8 (0x00007f36b7a48000)libmpir.so.23 => /home/baas/codes/mpc/MP-SPDZ/local/lib/libmpir.so.23 (0x00007f36b77d3000)libsodium.so.23 => /usr/local/lib/libsodium.so.23 (0x00007f36b757d000)libboost_system.so.1.79.0 => /usr/local/lib/libboost_system.so.1.79.0 (0x00007f36b737b000)libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007f36b70e7000)libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007f36b6bfe000)librt.so.1 => /lib64/librt.so.1 (0x00007f36b69f5000)libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f36b6660000)libm.so.6 => /lib64/libm.so.6 (0x00007f36b62de000)libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f36b60c6000)libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f36b5ea6000)libc.so.6 => /lib64/libc.so.6 (0x00007f36b5ae4000)/lib64/ld-linux-x86-64.so.2 (0x00007f36b7ff4000)libsodium.so.18 => not foundlibboost_system.so.1.58.0 => not foundlibssl.so.1.0.0 => not foundlibcrypto.so.1.0.0 => not foundlibz.so.1 => /lib64/libz.so.1 (0x00007f36b58cd000)libdl.so.2 => /lib64/libdl.so.2 (0x00007f36b56c9000)

而正确的链接库链接如下:

        linux-vdso.so.1 (0x00007fff4a15d000)libSPDZ.so => /home/baas/codes/mpc/MP-SPDZ/libSPDZ.so (0x00007f2e4827d000)libmpirxx.so.8 => /home/baas/codes/mpc/MP-SPDZ/local/lib/libmpirxx.so.8 (0x00007f2e48078000)libmpir.so.23 => /home/baas/codes/mpc/MP-SPDZ/local/lib/libmpir.so.23 (0x00007f2e47e03000)libsodium.so.23 => /lib64/libsodium.so.23 (0x00007f2e47bab000)libboost_system.so.1.79.0 => /usr/local/lib/libboost_system.so.1.79.0 (0x00007f2e479a9000)libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007f2e47715000)libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007f2e4722c000)librt.so.1 => /lib64/librt.so.1 (0x00007f2e47023000)libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f2e46c8e000)libm.so.6 => /lib64/libm.so.6 (0x00007f2e4690c000)libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f2e466f4000)libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2e464d4000)libc.so.6 => /lib64/libc.so.6 (0x00007f2e46112000)/lib64/ld-linux-x86-64.so.2 (0x00007f2e48645000)libz.so.1 => /lib64/libz.so.1 (0x00007f2e45efb000)libdl.so.2 => /lib64/libdl.so.2 (0x00007f2e45cf7000)

通过对比,有如下几个库是重复、多余且找不到的:

        libsodium.so.18 => not foundlibboost_system.so.1.58.0 => not foundlibssl.so.1.0.0 => not foundlibcrypto.so.1.0.0 => not found

最终解决,发现make clean无法删除./local/lib目录下的libmpir.so,libmpirxx.so,libSPDZ.so文件,删除之后重新编译即可正常运行。

make clean
rm ./local/lib/*

libSPDZ.so找不到错误

重新编译一下:

make clean
rm CONFIG.mine
make -j 8 tldr

`.rodata.str1.8’ can not be used when making a PIE object; recompile with -fPIE

问题描述:

 g++ -o mascot-party.x -march=native -I./local/include -I./local/include -I./local/include -I./local/include -I./local/include -I./local/include -I./local/include -I./local/include -I./local/include -I./local/include -I./local/include -I./local/include -g -Wextra -Wall -O3 -I. -pthread    -DUSE_GF2N_LONG '-DPREP_DIR="Player-Data/"' '-DSSL_DIR="Player-Data/"'  -std=c++11 -Werror -fPIC -fPIE Machines/mascot-party.o OT/OTTripleSetup.o OT/BaseOT.o SimpleOT/libsimpleot.a libSPDZ.so Machines/SPDZ.o Machines/Tinier.o OT/MascotParams.o OT/BitDiagonal.o OT/OTExtensionWithMatrix.o OT/OTExtension.o -lmpirxx -lmpir -lsodium -Wl,-rpath -Wl,/home/verayy/codes/mpc/MP-SPDZ/local/lib -L/home/verayy/codes/mpc/MP-SPDZ/local/lib -Wl,-rpath -Wl,/home/verayy/codes/mpc/MP-SPDZ/local/lib -L/home/verayy/codes/mpc/MP-SPDZ/local/lib -Wl,-rpath -Wl,/home/baas/codes/mpc/MP-SPDZ/local/lib -L/home/baas/codes/mpc/MP-SPDZ/local/lib -Wl,-rpath -Wl,/home/baas/codes/mpc/MP-SPDZ/local/lib -L/home/baas/codes/mpc/MP-SPDZ/local/lib -Wl,-rpath -Wl,/home/baas/codes/mpc/MP-SPDZ/local/lib -L/home/baas/codes/mpc/MP-SPDZ/local/lib -Wl,-rpath -Wl,/home/baas/codes/mpc/MP-SPDZ/local/lib -L/home/baas/codes/mpc/MP-SPDZ/local/lib -Wl,-rpath -Wl,/home/server/yangyu/MP-SPDZ/local/lib -L/home/server/yangyu/MP-SPDZ/local/lib -Wl,-rpath -Wl,/home/server/yangyu/MP-SPDZ/local/lib -L/home/server/yangyu/MP-SPDZ/local/lib -Wl,-rpath -Wl,/home/server/yangyu/MP-SPDZ/local/lib -L/home/server/yangyu/MP-SPDZ/local/lib -Wl,-rpath -Wl,/home/server/yangyu/MP-SPDZ/local/lib -L/home/server/yangyu/MP-SPDZ/local/lib -Wl,-rpath -Wl,/home/server/yangyu/MP-SPDZ/local/lib -L/home/server/yangyu/MP-SPDZ/local/lib -Wl,-rpath -Wl,/home/server/yangyu/MP-SPDZ/local/lib -L/home/server/yangyu/MP-SPDZ/local/lib -lboost_system -lssl -lcrypto -lrt -Wl,-rpath -Wl,/home/server/yangyu/MP-SPDZ
/usr/bin/ld: SimpleOT/libsimpleot.a(ot_sender.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: SimpleOT/libsimpleot.a(ot_receiver.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: SimpleOT/libsimpleot.a(ge25519_unpack.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: SimpleOT/libsimpleot.a(ge25519_scalarmult_base.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: SimpleOT/libsimpleot.a(ge4x.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: SimpleOT/libsimpleot.a(gfe4x.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: SimpleOT/libsimpleot.a(ge4x_unpack_vartime.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: SimpleOT/libsimpleot.a(Keccak-simple.o): relocation R_X86_64_32S against symbol `KeccakF_RoundConstants' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: SimpleOT/libsimpleot.a(randombytes.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status

解决方法:

参考:https://ubuntuforums.org/showthread.php?t=2393181

As the error messages say, you need to try adding -fPIC to the C compiler flags and/or C++ compiler flags. If that does not work, try instead adding -fno-PIE -no-pie to the C compiler flags and C++ compiler flags.How to do this will depend on the specific software.

删除旧文件

make clean
// mpir清除旧文件
cd mpir && make clean && cd ..
rm ./local/* -rf// 查看文件是否被删除干净
find ./ -type f | grep \\.o$
find ./ -type f | grep \\.so$
find ./ -type f | grep \\.x$
find ./ -type f | grep \\.d$
find ./ -type f | grep \\.a$
// 如果有未删除干净的文件,则执行如下方法删除
find ./ -type f | grep \\.o$ | xargs rm -rf
find ./ -type f | grep \\.so$ | xargs rm -rf
find ./ -type f | grep \\.x$ | xargs rm -rf
find ./ -type f | grep \\.d$ | xargs rm -rf
find ./ -type f | grep \\.a$ | xargs rm -rf

如果还是不成功,则在Makefile文件的CFLAGS后增加 -fno-PIE -no-pie ,如下所示:

...
CFLAGS += -fPIC -fno-PIE -no-pie
...

另外,tldr、semi-party.x的库与hemi-party.x的库不一致,如果要编译hemi-party.x的库,就需要clean一下。

centos8上安装MP-SPDZ相关推荐

  1. 在Centos8上安装漏洞扫描软件Nessus

    本文摘要:简单叙述了在Centos8上安装Nessus扫描器的过程 Nessus 是目前全世界最多人使用的系统漏洞扫描与分析软件,Nessus的用户界面是基于Web界面来访问Nessus漏洞扫描器的, ...

  2. centos安装python3_在CentOS8 上安装Python3

    从centos开始入手学习linux.感觉安装python很费劲,之前centos6因为python2和python3兼容的问题一直无法彻底解决,python3一旦安装影响到python2,cento ...

  3. linux centos8下载,在Centos8上安装和使用curl

    导读 curl是用于从远程服务器传输数据或向远程服务器传输数据的强大 行工具. 使用curl可以使用各种网络协议(例如HTTP,HTTPS,SCP,SFTP和FTP)下载或上传数据. 如果在尝试下载带 ...

  4. centos 安装git_在Centos8上安装Git的方法

    版本控制系统工具在当今的现代软件开发中起着至关重要的作用.版本控制是一种软件,可以帮助一组软件开发人员一起工作并管理工作历史.它不会覆盖其他人的更改,因此您可以跟踪每个更改,将文件或项目还原到以前的状 ...

  5. 在CentOS8上安装win10虚拟机

    一.在物理机上安装centos8 首先找到一个可用的iso文件,我使用的是阿里云的,点击如下链接即可下载http://mirrors.aliyun.com/centos/8.4.2105/isos/x ...

  6. centos8上安装nginx

    参考自 https://www.jianshu.com/p/9b2dd37a5af9  : [1]安装步骤 step1)安装nginx sudo yum install -y nginx step2) ...

  7. Centos8上安装mysql8遇到SELinux is preventing /usr/libexec/mysqld from write access on the directory mysql

    问题描述 mysql8安装后数据默认存储路径/var/lib/mysql,修改默认存储路径后遇到如下报错: SELinux is preventing /usr/libexec/mysqld from ...

  8. centos查看正在运行的服务_RHEL8或CentOS8上如何配置NTP服务器和客户端

    请关注本头条号,每天坚持更新原创干货技术文章. 如需学习视频,请在微信搜索公众号"智传网优"直接开始自助视频学习 1. 前言 本教程主要讲解如何在RHEL8或CentOS8上使用C ...

  9. centos dhcp服务器文件,Centos8上搭建dhcp服务器

    Centos8上搭建dhcp服务器 首先我的环境是在本地的VMware虚拟机,所以先将VMware中的dhcp服务关闭 关闭防火墙,关闭selinux这些必须关闭: systemctl stop fi ...

最新文章

  1. CNN 究竟“看”到了什么?曲线检测器是否为可解释性带来了出路?
  2. 华月互网获得2012全国十大IDC服务商
  3. c语言程序设计一元二次函数,计算一元二次函数的根,大家看看那里有错了。。。。...
  4. Gradle 简单使用
  5. centos下升级jdk版本
  6. USACO-Section2.1 Ordered Fractions(简单数据处理)
  7. kali2020.3 vm版本内核是多少_Zircon Fuchsia 内核分析 启动(内核初始化)
  8. 【EMNLP2020】超越MLM,微软打造全新预训练任务
  9. 算法:回溯十八 Factor Combinations 因子组合(3种解法)
  10. pytorch关系抽取框架OpenNRE源码解读与实践:PCNN ATT
  11. 数学分析(一)数列与数列极限
  12. 「驱动安装」HighPoint RocketRAID R2722 磁盘阵列卡 驱动安装教程
  13. [南阳OJ-No.33]蛇形填数|在n*n方陈里填入1,2,...,n*n,要求填成蛇形。
  14. SphereEx 创始人张亮荣获『2021 年度海纳奖——分布式数据库十佳实践人物』
  15. 【经验总结】keil报错:declaration may not appear after executable statement in block···
  16. HTML、CSS、JavaScript学习总结
  17. Android实现百度地图定位(墨雪亲测)
  18. 性能测试结果分析结果
  19. 基础设施即代码(Infrastructure as Code)
  20. matlab 定时器开始无法停止,计时器程序无法停止计时

热门文章

  1. 谢欣伦 - OpenDev原创例程 - 网络摄像机WebCamera
  2. element ui el-table动态生成表头(v-for/v-if)导致的高度塌陷(少一截)的解决办法
  3. 【编程玄学】一个困扰我122天的技术问题,我好像知道答案了。
  4. Docker Desktop(WSL2)修改镜像存储位置
  5. 手机通过数据线与电脑USB连接之手机详细设置
  6. 单片机学习入门 我们应该这样学习单片机
  7. ap模式和sta模式共存_让无线网卡同时工作在 AP 和 STA 模式
  8. 连续状态转移算法(STA)的实现(python版)
  9. 哪种类型是python不支持的_Python不支持以下哪种数据类型?
  10. 九个问题从入门到熟悉HTTPS