diff options
author | Felix Weilbach <felix.weilbach@nextcloud.com> | 2021-04-19 17:08:00 +0300 |
---|---|---|
committer | Felix Weilbach (Rebase PR Action) <felix.weilbach@t-online.de> | 2021-05-17 14:43:55 +0300 |
commit | e2d0481c64c02583ae72be13166d2e8ed05b3e61 (patch) | |
tree | 23569b9c28f6494e1fbaf087e2997aa9703ac9fe /doc | |
parent | 31179131f2878b653f1d1c5943084589cab80e7c (diff) |
Add CMake option to enable address sanitizers
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/building.rst | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/doc/building.rst b/doc/building.rst index 31c82b737..c3d8beb18 100644 --- a/doc/building.rst +++ b/doc/building.rst @@ -373,6 +373,38 @@ The following are known cmake parameters: * ``BUILD_WITH_QT4=ON``: Builds using Qt4 (even if Qt5 is found). * ``CMAKE_INSTALL_PREFIX=path``: Set an install prefix. This is mandatory on Mac OS +Address Sanitizer +================= + +You can enable the address sanitizer to detect memory corruptions and other mistakes. +The are the following sanitizers are available: + + +* Address Sanitizer +* Leak anitizer +* Memory sanitizer +* Undefined sanitizer +* Threads sanitizer + +You can enable one or more sanitizers through CMake. For example, to +enable the address and the undefined sanitizer, execute CMake like +``cmake .. -D ECM_ENABLE_SANITIZERS="address;undefined"``. +Keep in mind that not all combinations of sanitizers work together, and on some +platforms, not all types of sanitizers are available. For example, on Windows there is +currently only the address sanitizer available. If you are on Windows, you need to +make sure that the linker can find the sanitizer dlls at runtime. If you installed +Visual Studio in the standard location, you could find them in +**C:/ProgramFiles (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/Llvm/x64/lib/clang/10.0.0/lib/windows**. +Make sure you add this location to your path. You may also need to +`upgrade your Visual Studio version <https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-160#install-the-addresssanitizer>`_. + +.. note:: If you use Visual Studio on Windows, you can enable the + sanitizer if you click on **Manage Configurations**, scroll + down to the section **CMake Command Arguments** and enter then + ``-D ECM_ENABLE_SANITIZERS="address"`` in the text input field below. + After that, click on **Save and generate CMake cache to load variables** + right above the table. + .. _CMake: http://www.cmake.org/download .. _CSync: http://www.csync.org .. _Client Download Page: https://nextcloud.com/install/#install-clients |