openfheorg / openfhe-python

Official Python wrapper for OpenFHE. Current release is v0.8.8 (released on June 25, 2024).
https://openfheorg.github.io/openfhe-python/html/index.html
BSD 2-Clause "Simplified" License
60 stars 18 forks source link

HEXL support: Conda Installation Failure at make #105

Open jkav77 opened 5 months ago

jkav77 commented 5 months ago

Hello,

I'm getting the error below when trying to build the python binding. I have OpenFHE installed with HEXL enabled. That works with the c++ examples, but I can't build the python binding. Based on the error, I'm not sure where to start. Any insights?

(openfhe) dangerginger@homecompute ~/code/openfhe-python/build$ make                                                                                    ✹main 
Consolidate compiler generated dependencies of target openfhe
[ 16%] Building CXX object CMakeFiles/openfhe.dir/src/lib/bindings.cpp.o
In file included from /home/dangerginger/code/openfhe-python/src/lib/bindings.cpp:1:
/home/dangerginger/code/miniconda3/envs/openfhe/include/pybind11/pybind11.h: In instantiation of ‘void pybind11::cpp_function::initialize(Func&&, Return (*)(Args ...), const Extra& ...) [with Func = pybind11::cpp_function::cpp_function<void, lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int, pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v>(void (lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >::*)(std::vector<unsigned int>, std::vector<unsigned int>, unsigned int, unsigned int), const pybind11::name&, const pybind11::is_method&, const pybind11::sibling&, const char* const&, const pybind11::arg_v&, const pybind11::arg_v&, const pybind11::arg_v&, const pybind11::arg_v&, const pybind11::arg_v&)::<lambda(lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int>, std::vector<unsigned int>, unsigned int, unsigned int)>; Return = void; Args = {lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}]’:
/home/dangerginger/code/miniconda3/envs/openfhe/include/pybind11/pybind11.h:110:19:   required from ‘pybind11::cpp_function::cpp_function(Return (Class::*)(Arg ...), const Extra& ...) [with Return = void; Class = lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >; Arg = {std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int}; Extra = {pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}]’
/home/dangerginger/code/miniconda3/envs/openfhe/include/pybind11/pybind11.h:1575:22:   required from ‘pybind11::class_<type_, options>& pybind11::class_<type_, options>::def(const char*, Func&&, const Extra& ...) [with Func = void (lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >::*)(std::vector<unsigned int>, std::vector<unsigned int>, unsigned int, unsigned int); Extra = {const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v}; type_ = lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >; options = {std::shared_ptr<lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > > >}]’
/home/dangerginger/code/openfhe-python/src/lib/bindings.cpp:582:13:   required from here
/home/dangerginger/code/miniconda3/envs/openfhe/include/pybind11/pybind11.h:219:40: error: static assertion failed: The number of argument annotations does not match the number of function arguments
  219 |             expected_num_args<Extra...>(
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  220 |                 sizeof...(Args), cast_in::args_pos >= 0, cast_in::has_kwargs),
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/dangerginger/code/miniconda3/envs/openfhe/include/pybind11/pybind11.h:219:40: note: ‘pybind11::detail::expected_num_args<pybind11::name, pybind11::is_method, pybind11::sibling, const char*, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v, pybind11::arg_v>(5, (((int)pybind11::detail::argument_loader<lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int>::args_pos) >= 0), ((int)((bool)pybind11::detail::argument_loader<lbcrypto::CryptoContextImpl<lbcrypto::DCRTPolyImpl<bigintdyn::mubintvec<bigintdyn::ubint<long unsigned int> > > >*, std::vector<unsigned int, std::allocator<unsigned int> >, std::vector<unsigned int, std::allocator<unsigned int> >, unsigned int, unsigned int>::has_kwargs)))’ evaluates to false
cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning-option’ may have been intended to silence earlier diagnostics
cc1plus: note: unrecognized command-line option ‘-Wno-unknown-warning’ may have been intended to silence earlier diagnostics
make[2]: *** [CMakeFiles/openfhe.dir/build.make:76: CMakeFiles/openfhe.dir/src/lib/bindings.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/openfhe.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
jkav77 commented 5 months ago

I was able to build it for OpenFHE without HEXL enabled although I would prefer to use HEXL. I made only a small change to CMakeLists.txt to update the include directories since my installation of NTL, GMP, and OpenFHE was to $HOME/local.