diff --git a/CMakeLists.txt b/CMakeLists.txt index 896c7b75a1ec..933c083ab220 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,9 +147,11 @@ else(MSVC) endif() if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_ASSERTIONS") elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") add_definitions(-DNDEBUG=1) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -g") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_ASSERTIONS") else() add_definitions(-DNDEBUG=1) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") @@ -159,7 +161,7 @@ else(MSVC) elseif(SUPPORT_MSSE2) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2") endif() - set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}") if(SUPPORT_CXX14) add_definitions(-DDMLC_USE_CXX11=1) add_definitions(-DDMLC_USE_CXX14=1) diff --git a/Makefile b/Makefile index b578683a74b6..3dbad1b8b7db 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,7 @@ endif # CFLAGS for debug ifeq ($(DEBUG), 1) - CFLAGS += -g -O0 + CFLAGS += -g -O0 -D_GLIBCXX_ASSERTIONS else CFLAGS += -O3 -DNDEBUG=1 endif diff --git a/src/operator/random/shuffle_op.cc b/src/operator/random/shuffle_op.cc index 1bd70b1f323a..5b4d9c74766c 100644 --- a/src/operator/random/shuffle_op.cc +++ b/src/operator/random/shuffle_op.cc @@ -33,6 +33,7 @@ #include #include #ifdef USE_GNU_PARALLEL_SHUFFLE + #include #include #endif #include "../elemwise_op_common.h"