Skip to content

Commit

Permalink
Compile coverage builds with -fprofile-update=atomic
Browse files Browse the repository at this point in the history
Running lcov on Ubuntu 24.04 on a coverage enabled build by hand
produces the following error on Ubuntu 24.04:

    lcov --no-external --capture --directory . --output-file coverage.info

    Processing ./build/auxil/broker/caf/libcaf_core/CMakeFiles/libcaf_core_obj.dir/src/actor_system.cpp.gcda
    geninfo: ERROR: Unexpected negative count '-1' for /zeek/auxil/broker/caf/libcaf_core/src/actor_system.cpp:503.
        Perhaps you need to compile with '-fprofile-update=atomic
        (use "geninfo --ignore-errors negative ..." to bypass this error)

Compile with -fprofile-update=atomic for coverage enabled builds.
  • Loading branch information
awelzel committed Jun 11, 2024
1 parent aeca56d commit f07d6ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion SetDefaultCompileFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")

if ("${_build_type_upper}" STREQUAL "DEBUG")
if (ENABLE_COVERAGE)
set(EXTRA_COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} --coverage")
set(EXTRA_COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} --coverage -fprofile-update=atomic")
endif ()
# manual add of -g works around its omission in FreeBSD's CMake port
set(EXTRA_COMPILE_FLAGS "${EXTRA_COMPILE_FLAGS} -g -DDEBUG -DBRO_DEBUG")
Expand Down

0 comments on commit f07d6ca

Please sign in to comment.