microsoft / SEAL

Microsoft SEAL is an easy-to-use and powerful homomorphic encryption library.
https://www.microsoft.com/en-us/research/group/cryptography-research/
MIT License
3.62k stars 709 forks source link

How to Debug the SEAL examples? #627

Open EchizenG opened 1 year ago

EchizenG commented 1 year ago

Hi there,

I am trying to understand the HE and its operation through debugging the code. I built the SEAL in debug mode successfully which was built up in /Debug folder. I also tried to build /native/examples in Debug mode but cannot use gdb to debug it.

What I did: cd native/examples cmake -DCMAKE_BUILD_TYPE=Debug -S . -B build cmake --build build I also write set(CMAKE_BUILD_TYPE Debug) to the CMakeList.txt for double insurances.

cd build/bin gdb sealexamples

What I see: When I try to add breakpoint or check the code. They just report cannot find files.

Thank you.

peichao538 commented 1 year ago

because you can not only build /native/examples with Debug mode, also need with whole src to generate a debug seal library

EchizenG commented 1 year ago

You mean the SEAL's source code? I built it with debug mode, too.

because you can not only build /native/examples with Debug mode, also need with whole src to generate a debug seal library

elkanatovey commented 1 year ago

I think you need to build seal with -DSEAL_BUILD_EXAMPLES=ON

peichao538 commented 1 year ago

I write the following contents in CMakeList.txt, and can debug the seal.

SET(CMAKE_BUILD_TYPE "Debug") SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb") SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

You can try it.

elkanatovey commented 1 year ago

Try removing -03 that can cause problems with debug builds.

On Tue, Apr 4, 2023, 05:55 peichao @.***> wrote:

I write the following contents in CMakeList.txt, and can debug the seal.

SET(CMAKE_BUILD_TYPE "Debug") SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb") SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

You can try it.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/SEAL/issues/627#issuecomment-1495270979, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJUJCAWXKOCU47S5CQA4UCTW7OES3ANCNFSM6AAAAAAWJSZFAA . You are receiving this because you commented.Message ID: @.***>

harper-yuan commented 10 months ago

SET(CMAKE_BUILD_TYPE "Debug") SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb") SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

I have succeeded in compiling the SEAL in debug mode. Thanks! After adding those content to the last few lines of CMakeList.txt, just compile SEAL according to the official document content.