From 6c0088919ad0f3af7d0e164c9b0f82146e8a5459 Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 16 Dec 2014 13:33:04 +0100 Subject: [PATCH] build system: do not separate the debugging symbols by default the reason is that the tools for profiling and for coverage analysis (i.e., gprof and gcov) have trouble with this and crash. if you want this to be enabled for whatever reason, use the cmake flag -DSTRIP_DEBUGGING_SYMBOLS=ON or pass configure the --enable-strip-debug option. --- cmake/Modules/OpmCompile.cmake | 8 ++++++-- cmake/Modules/OpmSatellites.cmake | 6 ++++-- cmake/Scripts/configure | 13 ++++++++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/cmake/Modules/OpmCompile.cmake b/cmake/Modules/OpmCompile.cmake index aeb0ef68..0f76cf0c 100644 --- a/cmake/Modules/OpmCompile.cmake +++ b/cmake/Modules/OpmCompile.cmake @@ -1,5 +1,7 @@ # - Compile main library target +option (STRIP_DEBUGGING_SYMBOLS "use separate files for the executable code and the debugging symbols" OFF) + macro (opm_compile opm) # some CMake properties do not do list expansion string (REPLACE ";" " " ${opm}_LINKER_FLAGS_STR "${${opm}_LINKER_FLAGS}") @@ -28,8 +30,10 @@ macro (opm_compile opm) ) target_link_libraries (${${opm}_TARGET} ${${opm}_LIBRARIES}) - # queue this executable to be stripped - strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG) + if (STRIP_DEBUGGING_SYMBOLS) + # queue this executable to be stripped + strip_debug_symbols (${${opm}_TARGET} ${opm}_DEBUG) + endif() else (${opm}_SOURCES) # unset this variable to signal that no library is generated set (${opm}_TARGET) diff --git a/cmake/Modules/OpmSatellites.cmake b/cmake/Modules/OpmSatellites.cmake index 161c79fe..3ae5aaf4 100644 --- a/cmake/Modules/OpmSatellites.cmake +++ b/cmake/Modules/OpmSatellites.cmake @@ -70,8 +70,10 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp) set (_test_lib "") endif (NOT "${test_regexp}" STREQUAL "") target_link_libraries (${_sat_NAME} ${${opm}_TARGET} ${${opm}_LIBRARIES} ${_test_lib}) - strip_debug_symbols (${_sat_NAME} _sat_DEBUG) - list (APPEND ${satellite}_DEBUG ${_sat_DEBUG}) + if (STRIP_DEBUGGING_SYMBOLS) + strip_debug_symbols (${_sat_NAME} _sat_DEBUG) + list (APPEND ${satellite}_DEBUG ${_sat_DEBUG}) + endif() # variable with regular expression doubles as a flag for # whether tests should be setup or not diff --git a/cmake/Scripts/configure b/cmake/Scripts/configure index c87eecf1..5074a8d2 100755 --- a/cmake/Scripts/configure +++ b/cmake/Scripts/configure @@ -21,6 +21,7 @@ Optional Features: [default=no] --disable-runpath do not use RUNPATH in installed library [default=yes] --enable-lto use whole program optimization [default=no] + --enable-strip-debug separate the executable code and the debugging symbols [default=no] --disable-tests do not compile and enable unit tests [default=yes] --disable-examples do not compile example programs [default=yes] --disable-pch do not use precompiled headers (if buggy compiler) @@ -123,6 +124,8 @@ silent_rules= debug_loc= #use_lto=" -DWHOLE_PROG_OPTIM=OFF" use_lto= +#strip_debug=" -DSTRIP_DEBUGGING_SYMBOLS=OFF" +strip_debug= #use_runpath=" -DUSE_RUNPATH=OFF" use_runpath= #use_tests=" -DBUILD_TESTING=ON" @@ -314,6 +317,10 @@ for OPT in "$@"; do use_lto=" -DWHOLE_PROG_OPTIM=OFF" pkgname="" ;; + strip-debug ) + strip_debug=" -DSTRIP_DEBUGGING_SYMBOLS=OFF" + pkgname="" + ;; openmp) use_openmp=" -DUSE_OPENMP=OFF" pkgname="" @@ -397,6 +404,10 @@ for OPT in "$@"; do use_lto=" -DWHOLE_PROG_OPTIM=ON" shared="" ;; + strip-debug ) + strip_debug=" -DSTRIP_DEBUGGING_SYMBOLS=ON" + pkgname="" + ;; tests) use_tests=" -DBUILD_TESTING=ON" pkgname="" @@ -534,7 +545,7 @@ elif test "$c_compiler$c_opts$cxx_compiler$cxx_opts$fort_compiler$fort_opts" != fi # pass everything on to CMake -CMDLINE="${ENVVARS}${CMAKE_COMMAND} \"${srcdir}\" ${use_ninja}\"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${use_runpath}${use_tests}${use_samples}${use_underscoring}${c_compiler}${c_opts}${cxx_compiler}${cxx_opts}${fort_compiler}${fort_opts}${boost_opts}${buildname}${site} ${FEATURES}" +CMDLINE="${ENVVARS}${CMAKE_COMMAND} \"${srcdir}\" ${use_ninja}\"-DCMAKE_INSTALL_PREFIX=$prefix\"${buildtype}${pch_use}${silent_rules}${debug_loc}${use_openmp}${use_mpi}${use_lto}${strip_debug}${use_runpath}${use_tests}${use_samples}${use_underscoring}${c_compiler}${c_opts}${cxx_compiler}${cxx_opts}${fort_compiler}${fort_opts}${boost_opts}${buildname}${site} ${FEATURES}" echo --- calling CMake --- echo "${CMDLINE}" eval exec "${CMDLINE}"