]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
build : enable libstdc++ assertions for debug builds (#4275)
authorJared Van Bortel <redacted>
Fri, 1 Dec 2023 18:18:35 +0000 (13:18 -0500)
committerGitHub <redacted>
Fri, 1 Dec 2023 18:18:35 +0000 (20:18 +0200)
CMakeLists.txt
Makefile

index 6f35a25d5221d1fada14e7a5b37851d91b5e5d17..0639518de8a821f01226b998b567c7f02a9f34f1 100644 (file)
@@ -116,6 +116,11 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
 find_package(Threads REQUIRED)
 include(CheckCXXCompilerFlag)
 
+# enable libstdc++ assertions for debug builds
+if (CMAKE_SYSTEM_NAME MATCHES "Linux")
+    add_compile_definitions($<$<CONFIG:Debug>:_GLIBCXX_ASSERTIONS>)
+endif()
+
 if (NOT MSVC)
     if (LLAMA_SANITIZE_THREAD)
         add_compile_options(-fsanitize=thread)
index 25b113e0a930697d52a4af4a247e2bcdfa60e33d..3cc932a2e28229b7fa67eb80fc02ff5c0a26a140 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -174,6 +174,10 @@ ifdef LLAMA_DEBUG
        MK_CFLAGS   += -O0 -g
        MK_CXXFLAGS += -O0 -g
        MK_LDFLAGS  += -g
+
+       ifeq ($(UNAME_S),Linux)
+               MK_CXXFLAGS += -Wp,-D_GLIBCXX_ASSERTIONS
+       endif
 else
        MK_CPPFLAGS += -DNDEBUG
 endif