Skip to content

Commit 4ebbcd8

Browse files
committed
build: don't disable asserts
see MaterializeInc/materialize#32629 needed to make sure Cargo Release builds don't run into MaterializeInc/database-issues#9313
1 parent c8d7ae6 commit 4ebbcd8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

rdkafka-sys/build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,13 @@ fn build_librdkafka() {
276276
env::set_var("CMAKE_LIBRARY_PATH", cmake_library_paths.join(";"));
277277
}
278278

279+
// When builing with `CMAKE_BUILD_TYPE=Release`, cmake automatically
280+
// sets `-DNDEBUG` flags. This breaks librdkafka, which uses asserts for
281+
// runtime error checking (confluentinc/librdkafka#5099). We unset
282+
// `NDEBUG` by manually overwriting the cmake's `C_FLAGS` variables.
283+
config.define("CMAKE_C_FLAGS_RELEASE", "-O3 -UNDEBUG");
284+
config.define("CMAKE_CXX_FLAGS_RELEASE", "-O3 -UNDEBUG");
285+
279286
println!("Configuring and compiling librdkafka");
280287
let dst = config.build();
281288

0 commit comments

Comments
 (0)