Comments (16)
OK, I'll take a look tomorrow
from libote.
This cmake works for me.
cmake_minimum_required (VERSION 3.12)
project(test_s)
if("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
############################################
# If top level cmake #
############################################
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
message("Please consider updating CMake to 3.12+")
endif()
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin)
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib)
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib)
############################################
# Flag and #defines #
############################################
add_definitions(-DSOLUTION_DIR='${CMAKE_SOURCE_DIR}')
set(COMMON_FLAGS "-Wall -march=native -Wfatal-errors -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}")
# -Wno-ignored-attributes -Wno-parentheses
# -maes -msse2 -msse3 -msse4.1 -mpclmul
# -std=c++14
# -fPIC -no-pie
# Select flags.
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -fPIC")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO " -O2 -g -ggdb -rdynamic -fPIC")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb -rdynamic -fPIC")
############################################
# Build mode checks #
############################################
# Set a default build type for single-configuration
# CMake generators if no build type is set.
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
endif()
if( NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release"
AND NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug"
AND NOT "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" )
message(FATAL_ERROR ": Unknown build type - \${CMAKE_BUILD_TYPE}=${CMAKE_BUILD_TYPE}. Please use one of Debug, Release, or RelWithDebInfo. e.g. call\n\tcmake . -DCMAKE_BUILD_TYPE=Release\n" )
endif()
endif()
add_executable(test_s test_s.cpp)
## libOTe
###########################################################################
find_path(libOTe_INCLUDE_DIR NAMES libOTe/config.h )
find_library(libOTe_LIB NAMES libOTe)
find_path(cryptoTools_INCLUDE_DIR NAMES cryptoTools/Common/config.h )
find_library(cryptoTools_LIB NAMES cryptoTools)
if (NOT EXISTS ${libOTe_LIB})
message(FATAL_ERROR "Failed to find libOTe: ${libOTe_LIB}")
endif ()
if (NOT EXISTS ${libOTe_INCLUDE_DIR})
message(FATAL_ERROR "Failed to find libOTe include: ${libOTe_INCLUDE_DIR}")
endif ()
message(STATUS "libOTe_LIB: ${libOTe_LIB} ${cryptoTools_LIB}")
message(STATUS "libOTe_inc: ${libOTe_INCLUDE_DIR} ${cryptoTools_INCLUDE_DIR}\n")
target_link_libraries(test_s ${libOTe_LIB} ${cryptoTools_LIB})
## Relic
###########################################################################
find_package(Relic REQUIRED)
if (NOT Relic_FOUND)
message(FATAL_ERROR "Failed to find Relic")
endif (NOT Relic_FOUND)
message(STATUS "Relic_LIB: ${RELIC_LIBRARIES} ${RLC_LIBRARY}")
message(STATUS "Relic_inc: ${RELIC_INCLUDE_DIR} ${RLC_INCLUDE_DIR}\n")
target_include_directories(test_s PUBLIC ${RELIC_INCLUDE_DIR} ${RLC_INCLUDE_DIR})
target_link_libraries(test_s ${RELIC_LIBRARIES} ${RLC_LIBRARY})
## Boost
###########################################################################
set(BOOST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty/linux/boost/")
if(EXISTS ${BOOST_ROOT})
set(Boost_NO_SYSTEM_PATHS ON)
endif()
set(Boost_USE_STATIC_LIBS ON) # only find static libs
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
macro(findBoost)
find_package(Boost 1.69.0 COMPONENTS system thread)
endmacro()
findBoost()
# then look at system dirs
if(NOT Boost_FOUND)
set(Boost_NO_SYSTEM_PATHS OFF)
findBoost()
endif()
if(NOT Boost_FOUND)
message(FATAL_ERROR "Failed to find boost 1.69.0 or newer. Looked at system dirs and: " ${BOOST_ROOT})
endif()
target_include_directories(test_s PUBLIC ${Boost_INCLUDE_DIR})
target_link_libraries(test_s ${Boost_LIBRARIES})
message(STATUS "Boost_LIB: ${Boost_LIBRARIES}" )
message(STATUS "Boost_INC: ${Boost_INCLUDE_DIR}\n\n" )
## GMP
###########################################################################
if (GMP_INCLUDE_DIR AND GMP_LIBRARIES)#
set(GMP_FIND_QUIETLY TRUE)
endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES)
find_path(GMP_INCLUDE_DIR NAMES gmp.h )
find_library(GMP_LIBRARIES NAMES gmp libgmp )
find_library(GMPXX_LIBRARIES NAMES gmpxx libgmpxx)
#find_package(GMP REQUIRED)
message(STATUS "GMP_LIB: ${GMPXX_LIBRARIES} ${GMP_LIBRARIES}" )
message(STATUS "GMP_INC: ${GMP_INCLUDE_DIR}\n\n" )
target_link_libraries(test_s gmp gmpxx)
## OpenSSL
###########################################################################
find_package(OpenSSL REQUIRED)
target_link_libraries(test_s ${OPENSSL_LIBRARIES} )
from libote.
You need to link Relic. ep_... Is a Relic function.
from libote.
I think I linked relic. My final cmake linking looks like this target_link_libraries(test_s ${OPENSSL_LIBRARIES} ${Boost_LIBRARIES} ${GMP_LIBRARIES} ${GMPXX_LIBRARIES} ${RELIC_LIBRARY} libOTe cryptoTools KyberOT)
. I also tried linking using the absolute path /usr/local/lib/librelic.so
but got the same error.
from libote.
show me the output from (if you have cmake arguments add those):
rm CMakeCache.txt
cmake .
make VERBOSE=true
from libote.
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found RELIC: /usr/local/include
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found Boost: /usr/local/include (found version "1.69.0") found components: system date_time thread chrono atomic
-- Boost LIBS:/usr/local/lib/libboost_system.so/usr/local/lib/libboost_date_time.so/usr/local/lib/libboost_thread.so-lpthread/usr/local/lib/libboost_chrono.so/usr/local/lib/libboost_atomic.so
-- LIBS:/usr/lib/x86_64-linux-gnu/libssl.so/usr/lib/x86_64-linux-gnu/libcrypto.so | /usr/local/lib/libboost_system.so/usr/local/lib/libboost_date_time.so/usr/local/lib/libboost_thread.so-lpthread/usr/local/lib/libboost_chrono.so/usr/local/lib/libboost_atomic.so | /usr/lib/x86_64-linux-gnu/libgmp.so | /usr/lib/x86_64-linux-gnu/libgmpxx.so | /usr/local/lib/librelic.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/test_s
/usr/local/lib/python2.7/dist-packages/cmake/data/bin/cmake -S/home/test_s -B/home/test_s --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/lib/python2.7/dist-packages/cmake/data/bin/cmake -E cmake_progress_start /home/test_s/CMakeFiles /home/test_s//CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/test_s'
make -f CMakeFiles/test_s.dir/build.make CMakeFiles/test_s.dir/depend
make[2]: Entering directory '/home/test_s'
cd /home/test_s && /usr/local/lib/python2.7/dist-packages/cmake/data/bin/cmake -E cmake_depends "Unix Makefiles" /home/test_s /home/test_s /home/test_s /home/test_s /home/test_s/CMakeFiles/test_s.dir/DependInfo.cmake --color=
Dependee "/home/test_s/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/test_s/CMakeFiles/test_s.dir/depend.internal".
Scanning dependencies of target test_s
make[2]: Leaving directory '/home/test_s'
make -f CMakeFiles/test_s.dir/build.make CMakeFiles/test_s.dir/build
make[2]: Entering directory '/home/test_s'
[ 50%] Linking CXX executable bin/test_s
/usr/local/lib/python2.7/dist-packages/cmake/data/bin/cmake -E cmake_link_script CMakeFiles/test_s.dir/link.txt --verbose=true
/usr/bin/c++ -Wall -march=native -Wfatal-errors -fPIC -O3 -DNDEBUG -fPIC CMakeFiles/test_s.dir/test_s.cpp.o -o bin/test_s -Wl,-rpath,/usr/local/lib /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/local/lib/libboost_system.so /usr/local/lib/libboost_date_time.so /usr/local/lib/libboost_thread.so -lpthread /usr/local/lib/libboost_chrono.so /usr/local/lib/libboost_atomic.so /usr/lib/x86_64-linux-gnu/libgmp.so /usr/lib/x86_64-linux-gnu/libgmpxx.so /usr/local/lib/librelic.so -llibOTe -lcryptoTools -lKyberOT
/usr/bin/ld: //usr/local/lib/liblibOTe.a(naor-pinkas.cpp.o): undefined reference to symbol 'ep_copy'
/usr/local/lib/librelic.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/test_s.dir/build.make:112: recipe for target 'bin/test_s' failed
make[2]: *** [bin/test_s] Error 1
make[2]: Leaving directory '/home/test_s'
CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/test_s.dir/all' failed
make[1]: *** [CMakeFiles/test_s.dir/all] Error 2
make[1]: Leaving directory '/home/test_s'
Makefile:102: recipe for target 'all' failed
make: *** [all] Error 2
from libote.
Can you commit your code somewhere and I'll have a look.
from libote.
I made a git repo: https://github.com/siamumar/test-libOTE
I have also made a docker: siamumar/test-libote
Thanks a lot for your help.
from libote.
This is how cryptoTools finds relic. Try copying it...
find_package(Relic REQUIRED)
if (NOT Relic_FOUND)
message(FATAL_ERROR "Failed to find Relic")
endif (NOT Relic_FOUND)
message(STATUS "Relic_LIB: ${RELIC_LIBRARIES} ${RLC_LIBRARY}")
message(STATUS "Relic_inc: ${RELIC_INCLUDE_DIR} ${RLC_INCLUDE_DIR}\n")
target_include_directories(cryptoTools PUBLIC ${RELIC_INCLUDE_DIR} ${RLC_INCLUDE_DIR})
target_link_libraries(cryptoTools ${RELIC_LIBRARIES} ${RLC_LIBRARY})
from libote.
I still get the same error. I tired to print ${RLC_LIBRARY}
and ${RLC_INCLUDE_DIR}
but both of them are empty. Can this be the reason? I am actually not sure what RLC is.
from libote.
Are you using the master branch of Relic? Not my fork...
from libote.
At first, I used your fork but I got similar linking errors even in the libOTe project. Then I re-installed it from the master branch of Relic. It solved the linking error in the libOTe project but not in my project.
from libote.
I still get the same error! But it's possible that I messed up something while trying different things. I will make a fresh copy and try again. I really appreciate all the help.
from libote.
So if RLC_XXXX
is empty, thats an issue. Relic switched from the RELIC_XXX
prefix to RLC_XXX
. The fork on my git account uses the old profix while th correct version uses the new one. If you are getting the old one this suggests something is wrong there.
from libote.
oh, make sure to delete the CMakeCache.txt file. That could be the issue.
from libote.
Yes, that was it! I deleted CMakeCache.txt in libOTe, relic (your fork), and my project. The code compiled without error. Thanks again!
from libote.
Related Issues (20)
- Difference between silent VOLE and silent OT. HOT 5
- Building only Errors HOT 1
- Add support for subfield VOLE HOT 10
- SoftSpoken Test question HOT 2
- Question about slient VOLE HOT 12
- optimizations about silent ot HOT 2
- Fork of fork issue? HOT 1
- SoftSpokenOT doesn't work when using non-power-of-two as the fieldBits parameter HOT 2
- frontend examples does not correctly flush sockets HOT 1
- How to fix Segmantation fault HOT 27
- The network Problem HOT 4
- Can this code generate Random OTs using actively secure IKNP protocol? HOT 1
- libOTe does not build HOT 3
- Questions about codes in silent VOLE HOT 2
- Reverse the direction of the noisy_vole protocols (performance improvement)
- Build Failure: Compilation Error in RegularPprf.h HOT 1
- Can I use the library to silently generate Beaver's triples? HOT 29
- cmake build error: python3 build.py --all --boost --sodium HOT 4
- First build always fails on macOS HOT 1
- A build error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libote.