File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,17 @@ fn build_librdkafka() {
276276 env:: set_var ( "CMAKE_LIBRARY_PATH" , cmake_library_paths. join ( ";" ) ) ;
277277 }
278278
279+ // When building with `CMAKE_BUILD_TYPE=Release/MinSizeRel/RelWithDebInfo`, cmake automatically
280+ // sets `-DNDEBUG` flags. This breaks librdkafka, which uses asserts for runtime error checking
281+ // (confluentinc/librdkafka#5099). We unset `NDEBUG` by manually overwriting the cmake's
282+ // `C_FLAGS` variables.
283+ config. define ( "CMAKE_C_FLAGS_RELEASE" , "-O3 -UNDEBUG" ) ;
284+ config. define ( "CMAKE_CXX_FLAGS_RELEASE" , "-O3 -UNDEBUG" ) ;
285+ config. define ( "CMAKE_C_FLAGS_MINSIZEREL" , "-O3 -UNDEBUG" ) ;
286+ config. define ( "CMAKE_CXX_FLAGS_MINSIZEREL" , "-O3 -UNDEBUG" ) ;
287+ config. define ( "CMAKE_C_FLAGS_RELWITHDEBINFO" , "-O3 -UNDEBUG" ) ;
288+ config. define ( "CMAKE_CXX_FLAGS_RELWITHDEBINFO" , "-O3 -UNDEBUG" ) ;
289+
279290 println ! ( "Configuring and compiling librdkafka" ) ;
280291 let dst = config. build ( ) ;
281292
You can’t perform that action at this time.
0 commit comments