libOPENFHEpke.dll not found in directory

Hello OpenFHE Team,

I am getting the following error when trying to execute my code on Windows.

xxxxx@xxx MINGW64 ~/OneDrive/Documents/FHE123/build
$ ./simpleinteger.exe
C:/Users/xxxxx/XXXX/Documents/FHE123/build/simpleinteger.exe: error while loading shared libraries: libOPENFHEpke.dll: cannot open shared object file: No such file or directory

I copied libOPENFHEpke.dll to the ‘lib’ folder in C:\home\xxxxx\build\lib but the problem persists.

I am using VSCode, and ran the following to arrive at this point
mkdir build
cd build/
cmake …
cmake --build . [At this point the libOPENFHEpke.dll.a and libOPENFHEpke.dll were
not in the lib folder, so I copied the files there.]
./simpleinteger.exe

I would appreciate your help because I have searched a lot of online materials but could not find any solution.

I have never worked with OpenFHE on native Windows, but I think you need to add the OpenFHE DLLs directory to the PATH environment variable.
Try doing that in windows GUI, or you can try this command line:

setx PATH “%PATH%;C:\path\to\your\openfhe\dll\directory”

Thank you so much. It worked.

Hello OpenFHE Team.

I get the following error while at the linking phase of code compilation.
xx@xx MINGW64 ~/OneDrive/Documents/crypt/build
$ cmake --build .
[2/2] Linking CXX executable reward2.exe
FAILED: reward2.exe
C:\WINDOWS\xxxxxx\cmd.exe /C “cd . && C:\msys64\mingw64\bin\c++.exe -Wall -Werror -O3 -DOPENFHE_VERSION=1.2.0 -Wno-parentheses -DMATHBACKEND=4 -fopenmp -static CMakeFiles/reward2.dir/neward2.cpp.obj -o reward2.exe -Wl,–out-implib,libreward2.dll.a -Wl,–major-image-version,0,–minor-image-version,0 -LC:/PROGRA~2/OpenFHE/lib -fopenmp -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd .”
C:/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/13.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/reward2.dir/neward2.cpp.obj:neward2.cp:(.text+0x1583): undefined reference to `blake2xb’

What could be the reason for an undefined reference error?

Thank you

Can you confirm you could build and install OpenFHE correctly following this guide?
If so, did you use this guide to build your user application reward?

Yes, I did. I have also successfully compiled other OpenFHE codes. In this code, I made some changes to the cmakelists file below shown below by editing set(CMAKE_CXX_STANDARD 20)

Also, I am trying use openFHE to encrypt between two arduino communication. I finally got to this point and I am getting this error.

If you keep the default CMAKE_CXX_STANDARD (17), do you still get the same error?

I have not tried that yet but I ran a similar OpenFHE library program with C++ Standard 20 and it compiled without errors

Hello Sir,
I changed the standard back to 17 in cmakeLists.txt and made some changes to the code. The undefined error I am getting now is related to the twi.h file I included. It cannot see the other pair of twi.cpp while linking. On the other hand, it can see the OpenFHE link libraries from link_directories( {OpenFHE_LIBDIR} ) link_directories( {OPENMP_LIBRARIES} ).

How do I edit the cmakeLists.txt to make the compiler see other link directories?

Note: I already added the folder to the include directories in cmakeLists.txt.
Thank you

It looks like your problem is a C++ and make issue. We cannot help you without code or detailed description of the problem.

Please follow the OpenFHE user application guide I referenced above. Also, review some material on how to set up a cmake C++ project.

Sure, will do. Thank you