Cannot find lattice/lat-hat.h?

I built and installed the openfhe library by executing this script on Mac M2. Then in my project, I use it like this:

add_library(TFHECmp “SortingHatCmp.cpp”)

target_link_directories(TFHECmp PUBLIC ${OpenFHE_LIBDIR})

target_link_libraries(TFHECmp PUBLIC ${OpenFHE_LIBRARIES})

target_include_directories(TFHECmp PUBLIC ${OpenFHE_INCLUDE})

It reports a bug:
– OpenFHE found!
– OpenFHE include dir: /Documents/code/TreeInference/build/include/openfhe
– OpenFHE lib: OPENFHEcore;OPENFHEpke;OPENFHEbinfhe;-Xpreprocessor;-fopenmp;-lomp;-Wno-unused-command-line-argument
– Configuring done (0.0s)
– Generating done (0.0s)
– Build files have been written to: /Documents/code/TreeInference/build
[ 50%] Building CXX object src/CMakeFiles/TFHECmp.dir/SortingHatCmp.cpp.o
In file included from /Documents/code/TreeInference/src/SortingHatCmp.cpp:1:
In file included from /Documents/code/TreeInference/src/SortingHatCmp.h:4:
In file included from /Documents/code/TreeInference/build/include/openfhe/binfhe/binfhecontext.h:39:
In file included from /Documents/code/TreeInference/build/include/openfhe/binfhe/binfhe-base-scheme.h:35:
/Documents/code/TreeInference/build/include/openfhe/binfhe/binfhe-base-params.h:35:10: fatal error: ‘lattice/lat-hal.h’ file not found
35 | #include “lattice/lat-hal.h”
| ^~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [src/CMakeFiles/TFHECmp.dir/SortingHatCmp.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/TFHECmp.dir/all] Error 2

How can I fix it? Thanks

It looks to me like this is a build problem. Have you followed these build instructions for building OpenFHE on MacOS?

Also follow these guidelines to build your user application

You may want to try the following:

  1. remove -DCMAKE_CROSSCOMPILING=1
  2. remove -DCMAKE_PREFIX_PATH

Remove your build directory and start over.


Hi, I removed the two options and rebuilt the openfhe. In my CMakeList.txt:
find_package(OpenFHE REQUIRED)
if(OpenFHE_FOUND)
message(STATUS “OpenFHE found!”)
else()
message(FATAL_ERROR “OpenFHE not found”)
endif()

I can find OpenFHE successfully, but it still reports the above error when I try to build my project

First, run make testall to check that OpenFHE is installed properly.

If the above goes through and you still face this problem, then please share your application’s CMakeLists.txt file?

Thanks for your reply. Here is my directory and the CMakeLists.txt :

Hi, I solved the above error by adding a directory :grinning: :

Thanks a lot!!!

You actually need to include more than just core!
Please follow the CMakeLists.User.txt at openfhe to create your application’s CMakeLists.txt.

include_directories( ${OPENMP_INCLUDES} )
include_directories( ${OpenFHE_INCLUDE} )
include_directories( ${OpenFHE_INCLUDE}/third-party/include )
include_directories( ${OpenFHE_INCLUDE}/core )
include_directories( ${OpenFHE_INCLUDE}/pke )
include_directories( ${OpenFHE_INCLUDE}/binfhe )
1 Like