ABY icon indicating copy to clipboard operation
ABY copied to clipboard

CMake files

Open prvsousa opened this issue 8 years ago • 10 comments

Has anyone ever made "cmakefiles" for this project?

prvsousa avatar Feb 14 '17 08:02 prvsousa

We have not used CMake so far, but it looks like a promising alternative to the Makefiles that we currently use. We will look into CMake and see what it offers. Of course we would be happy if someone wants to support us with that.

dd23 avatar Feb 14 '17 15:02 dd23

That is something I wanted to do for a while and I am working on this right now. My CMake is not that good, so I will not promise anything.

lenerd avatar Feb 14 '17 15:02 lenerd

I've been using CMake to build ABY for a project for several months now. You can find it here

My setup is the following: I have a directory containing a folder ABY (cloned from this repo) and a folder myproject. ABY contains the CMakeLists.txt I linked to above. myproject contains a CMakeLists.txt using the ABY folder as a CMake subdirectory in the following way:

...
add_subdirectory(../ABY ${CMAKE_BINARY_DIR}/aby EXCLUDE_FROM_ALL)
include_directories(../ABY/src/abycore)
...
add_executable(myproject <the usual stuff here>)
target_link_libraries(myproject ABY)

Maybe that helps :) I hope I didn't miss anything. Feel free to use and modify it.

KloolK avatar Feb 15 '17 18:02 KloolK

Oh @KloolK this helps me so much!! Thanks!

prvsousa avatar Feb 15 '17 19:02 prvsousa

I have not figured out yet, what is the optimal way to manage external dependencies and publish the own targets in CMake. In my project I am using these files in combination with ExternalProject_Add.

2017/02/21: Since OTExtension and ABY ship slightly different versions of for example util/cbitvector.h, I ran into problems when linking my application to abycore and OTExtension. I resorted to copying the ot/ files again and updated the CMake files accordingly.

lenerd avatar Feb 18 '17 14:02 lenerd

Hi @KloolK , do you remember this issue? When you say : # Build ABY as static library (building as shared library would require -fPIC when building miracl.a)

How can I build miracl.a with -fPIC? Any hint?

prvsousa avatar Sep 07 '17 12:09 prvsousa

Hi @patricia93sousa Are you sure you need to build ABY as a shared library?

If you have to, add the -fPIC in the build scripts of Miracl located here in the official repo. I guess you will have to modify the linux64 file there and add the -fPIC flag to most of the lines starting with gcc or g++. I'm not really sure though.

Maybe the better place to ask is the Miracl repo. Especially if you are using some other platform.

KloolK avatar Sep 07 '17 20:09 KloolK

Hi,

I already try to put the -fPIC in the gcc and g++ under the miracl script linux64 but without success in the compile of the shared library . I got the error to recompile with -fPIC and the error is related to the big.o file... this is so strange. But yea, maybe I have to ask in the miracl official. I only ask here because in the cmake you have that comment , and I thought that you probably know the solutions.

Thanks anyway.

prvsousa avatar Sep 07 '17 21:09 prvsousa

The error that I got was: /usr/bin/ld: ../src/abycore/ENCRYPTO_utils/miracl_lib/big.o: relocation R_X86_64_32S against '_ZNKSt5ctypeIcE8do_widenEc' can not be used when making a shared object; recompile with -fPIC

prvsousa avatar Sep 08 '17 09:09 prvsousa

Several paths have changed recently, especially those to miracl. I adapted my CMakeLists.txt a while ago. Here you can find my current version. Maybe that helps.

KloolK avatar Sep 08 '17 13:09 KloolK