Visa-Research / volepsi

Efficient Private Set Intersection base on VOLE
MIT License
98 stars 31 forks source link

An error occurred during compilation: Failed to find libsodium. #18

Closed hlysf closed 1 year ago

hlysf commented 1 year ago

Add -DFETCH_SODIUM=ON or -DFETCH_ALL=ON doesn't work either. The error message is as follows:

$ python3 build.py -DCOPROTO_ENABLE_BOOST=ON -DCOPROTO_ENABLE_OPENSSL=ON

====== build.py (vole-psi) ========
mkdir -p out/build/linux
cmake -S . -B out/build/linux  -DCOPROTO_ENABLE_BOOST=ON -DCOPROTO_ENABLE_OPENSSL=ON -DSUDO_FETCH=OFF -DFETCH_AUTO=ON -DPARALLEL_FETCH=4 -DCMAKE_BUILD_TYPE=Release
cmake --build out/build/linux   --parallel 4 
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

-- vole-psi options
=======================================================
-- Option: FETCH_AUTO        = ON
-- Option: FETCH_SPARSEHASH  = 
-- Option: FETCH_LIBOTE      = 
-- Option: FETCH_LIBDIVIDE   = 
-- Option: VERBOSE_FETCH     = ON

-- Option: VOLE_PSI_ENABLE_SSE      = ON
-- Option: VOLE_PSI_PIC             = OFF
-- Option: VOLE_PSI_ENABLE_GMW      = ON
-- Option: VOLE_PSI_ENABLE_CPSI     = ON
-- Option: VOLE_PSI_ENABLE_OPPRF    = ON

-- Option: COPROTO_ENABLE_BOOST     = ON
-- Option: COPROTO_ENABLE_OPENSSL   = ON
-- Option: LIBOTE_ENABLE_BITPOLYMUL = ON
-- VOLEPSI_THIRDPARTY_DIR=/home/zchain/volepsi/out/install/linux
sparsehash-c11 already fetched.
SPARSEHASH_INCLUDE_DIRS=/home/zchain/volepsi/out/install/linux/include
CMake Error at /usr/local/lib/cmake/cryptoTools/cryptoToolsDepHelper.cmake:151 (message):
  Failed to find libsodium.                                                                                                                                   

   Add -DFETCH_SODIUM=ON or -DFETCH_ALL=ON to auto download.                                                                                                  
Call Stack (most recent call first):                                                                                                                          
  /usr/local/lib/cmake/cryptoTools/cryptoToolsConfig.cmake:22 (include)                                                                                       
  /usr/local/lib/cmake/libOTe/libOTeConfig.cmake:25 (find_package)                                                                                            
  cmake/findDependancies.cmake:57 (find_package)                                                                                                              
  cmake/findDependancies.cmake:67 (FIND_LIBOTE)                                                                                                               
  CMakeLists.txt:14 (include)                                                                                                                                 

-- Configuring incomplete, errors occurred!
See also "/home/zchain/volepsi/out/build/linux/CMakeFiles/CMakeOutput.log".
-- vole-psi options
=======================================================
-- Option: FETCH_AUTO        = ON
-- Option: FETCH_SPARSEHASH  = 
-- Option: FETCH_LIBOTE      = 
-- Option: FETCH_LIBDIVIDE   = 
-- Option: VERBOSE_FETCH     = ON

-- Option: VOLE_PSI_ENABLE_SSE      = ON
-- Option: VOLE_PSI_PIC             = OFF
-- Option: VOLE_PSI_ENABLE_GMW      = ON
-- Option: VOLE_PSI_ENABLE_CPSI     = ON
-- Option: VOLE_PSI_ENABLE_OPPRF    = ON

-- Option: COPROTO_ENABLE_BOOST     = ON
-- Option: COPROTO_ENABLE_OPENSSL   = ON
-- Option: LIBOTE_ENABLE_BITPOLYMUL = ON
-- VOLEPSI_THIRDPARTY_DIR=/home/zchain/volepsi/out/install/linux
sparsehash-c11 already fetched.
SPARSEHASH_INCLUDE_DIRS=/home/zchain/volepsi/out/install/linux/include
CMake Error at /usr/local/lib/cmake/cryptoTools/cryptoToolsDepHelper.cmake:151 (message):
  Failed to find libsodium.                                                                                                                                   

   Add -DFETCH_SODIUM=ON or -DFETCH_ALL=ON to auto download.                                                                                                  
Call Stack (most recent call first):                                                                                                                          
  /usr/local/lib/cmake/cryptoTools/cryptoToolsConfig.cmake:22 (include)                                                                                       
  /usr/local/lib/cmake/libOTe/libOTeConfig.cmake:25 (find_package)                                                                                            
  cmake/findDependancies.cmake:57 (find_package)                                                                                                              
  cmake/findDependancies.cmake:67 (FIND_LIBOTE)                                                                                                               
  CMakeLists.txt:14 (include)                                                                                                                                 

-- Configuring incomplete, errors occurred!
See also "/home/zchain/volepsi/out/build/linux/CMakeFiles/CMakeOutput.log".
gmake: *** [Makefile:229:cmake_check_build_system] 错误 1
ladnir commented 1 year ago

So it looks like you installed cryptoTools somehow and it didn't include sodium.

Now you are building volepsi and when it looks for cryptoTools it find the installed version but then it errors because it doesn't have sodium.

You could Uninstaller the existing cryptoTools. Go to /usr/lib/cmake and delete cryptoTools, libOTe.

Im also working on making volepsi smarter to detect this incompatible and the not use the installed version if it's not appropriate but have pushed that yet.

hlysf commented 1 year ago

So it looks like you installed cryptoTools somehow and it didn't include sodium.

Now you are building volepsi and when it looks for cryptoTools it find the installed version but then it errors because it doesn't have sodium.

You could Uninstaller the existing cryptoTools. Go to /usr/lib/cmake and delete cryptoTools, libOTe.

Im also working on making volepsi smarter to detect this incompatible and the not use the installed version if it's not appropriate but have pushed that yet.

Hello. I have removed cryptoTools and libOTe under /usr/local/lib/cmake. I re-downloaded the code and performed the following operations, but the compilation error still occurred.

git clone volepsi
cd volepsi/thirdparty
git clone libOTe
cd libOTe
python3 build.py -D FETCH_SODIUM=true --setup
cd ../..
python3 build.py

`libOTe Build '/usr/bin/cmake' '--build' '/home/zchain/volepsi/out/libOTe/out/build/linux' '--config' 'Release' Consolidate compiler generated dependencies of target cryptoTools [ 1%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Crypto/SodiumCurve.cpp.o

/home/zchain/volepsi/out/libOTe/cryptoTools/cryptoTools/Crypto/SodiumCurve.cpp: In function ‘osuCrypto::Sodium::Monty25519 osuCrypto::Sodium::operator*(const osuCrypto::Sodium::Scalar25519&, const osuCrypto::Sodium::Monty25519&)’:
/home/zchain/volepsi/out/libOTe/cryptoTools/cryptoTools/Crypto/SodiumCurve.cpp:147:9: error: ‘crypto_scalarmult_noclamp’ was not declared in this scope; did you mean ‘crypto_scalarmult_base’?

147 | if (crypto_scalarmult_noclamp(prod.data, a.data, b.data) < 0) | ^~~~~~~~~ | crypto_scalarmult_base compilation terminated due to -Wfatal-errors. gmake[2]: [cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/build.make:286:cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Crypto/SodiumCurve.cpp.o] error 1 gmake[1]: [CMakeFiles/Makefile2:203:cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/all] error 2 gmake: *** [Makefile:136:all] error 2 libOTe Install '/usr/bin/cmake' '--install' '/home/zchain/volepsi/out/libOTe/out/build/linux' '--config' 'Release' '--prefix' '/home/zchain/volepsi/out/install/linux' '/usr/bin/cmake' '--install' '/home/zchain/volepsi/out/span-lite/build/linux' '--config' 'Release' '--prefix' '/home/zchain/volepsi/out/install/linux' -- Up-to-date: /home/zchain/volepsi/out/install/linux/lib/cmake/span-lite/span-lite-targets.cmake -- Up-to-date: /home/zchain/volepsi/out/install/linux/lib/cmake/span-lite/span-lite-config.cmake -- Up-to-date: /home/zchain/volepsi/out/install/linux/lib/cmake/span-lite/span-lite-config-version.cmake -- Up-to-date: /home/zchain/volepsi/out/install/linux/include -- Up-to-date: /home/zchain/volepsi/out/install/linux/include/nonstd -- Up-to-date: /home/zchain/volepsi/out/install/linux/include/nonstd/span.hpp 'mkdir' '-p' '/home/zchain/volepsi/out/install/linux/lib/' 'mkdir' '-p' '/home/zchain/volepsi/out/install/linux/include' 'mkdir' '-p' '/home/zchain/volepsi/out/install/linux/include/sodium' 'cp' '/home/zchain/volepsi/out/libOTe/cmake/../out/install/linux/lib/libsodium.a' '/home/zchain/volepsi/out/install/linux/lib/' 'cp' '/home/zchain/volepsi/out/libOTe/cmake/../out/install/linux/include/sodium.h' '/home/zchain/volepsi/out/install/linux/include/' 'cp' '-r' '/home/zchain/volepsi/out/libOTe/cmake/../out/install/linux/include/sodium' '/home/zchain/volepsi/out/install/linux/include/' -- Up-to-date: /home/zchain/volepsi/out/install/linux/lib/cmake/cryptoTools/cryptoToolsConfig.cmake -- Up-to-date: /home/zchain/volepsi/out/install/linux/lib/cmake/cryptoTools/cryptoToolsConfigVersion.cmake -- Up-to-date: /home/zchain/volepsi/out/install/linux/lib/cmake/cryptoTools/cryptoToolsDepHelper.cmake CMake Error at out/build/linux/cryptoTools/cmake_install.cmake:101 (file): file INSTALL cannot find "/home/zchain/volepsi/out/libOTe/out/build/linux/cryptoTools/cryptoTools/libcryptoTools.a": No such file or directory. Call Stack (most recent call first): out/build/linux/cmake_install.cmake:47 (include)

log /home/zchain/volepsi/thirdparty/log-libOTe.txt

CMake Error at cmake/findDependancies.cmake:57 (find_package): By not providing "FindlibOTe.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "libOTe", but CMake did not find one.

Could not find a package configuration file provided by "libOTe" with any of the following names:

   libOTeConfig.cmake
    libote-config.cmake

Add the installation prefix of "libOTe" to CMAKE_PREFIX_PATH or set "libOTe_DIR" to a directory containing one of the above files. If "libOTe" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): cmake/findDependancies.cmake:71 (FIND_LIBOTE) CMakeLists.txt:14 (include)

-- Configuring incomplete, errors occurred!`

ladnir commented 1 year ago

By default a custom version of sodium is used which define this function. You either have to configure libOTe / cryptoTools to not use this version or uninstaller the standard version of sodium from your system.

To change libOTe, read the libOTe Readme section about sodium and then set the flag in volepsi in the thirdparty/getLibOTe.cmake file where all the other flags are set.

hlysf commented 1 year ago

By default a custom version of sodium is used which define this function. You either have to configure libOTe / cryptoTools to not use this version or uninstaller the standard version of sodium from your system.

To change libOTe, read the libOTe Readme section about sodium and then set the flag in volepsi in the thirdparty/getLibOTe.cmake file where all the other flags are set.

Thank you very much, I have successfully completed the compilation. But I haven't seen a usage example yet. I don't usually use c++, so this is hard for me. Can you talk about it in detail?

ladnir commented 1 year ago

https://github.com/Visa-Research/volepsi/tree/main/frontend