Unable to generate coverage report using lcov on MacOs 15.3.1 #31927

issue Prabhat1308 openend this issue on February 21, 2025
  1. Prabhat1308 commented at 12:39 pm on February 21, 2025: none

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    While trying to get a coverage report , the report generation fails complaining of duplicate function definitions.

    Expected behaviour

    Generate a coverage report for the branch.

    Steps to reproduce

    0cmake -B build -DCMAKE_BUILD_TYPE=Coverage
    1cmake --build build
    2cmake -P build/Coverage.cmake
    

    Relevant log output

     0Capturing coverage data from src
     1geninfo cmd: '/opt/homebrew/Cellar/lcov/2.3/bin/geninfo src --toolname lcov --output-filename baseline.info --initial --gcov-tool /Users/prabhatverma/projects/bitcoin/build/cov_tool_wrapper.sh'
     2Found LLVM gcov version 16.0.0, which emulates gcov version 4.2.0
     3Using intermediate gcov format
     4Recording 'internal' directories:
     5        /Users/prabhatverma/projects/bitcoin/build/src
     6        src
     7Writing temporary data to /tmp/geninfo_datI48l
     8Scanning src for .gcno files ...
     9Found 401 graph files in src
    10using: chunkSize: 1, nchunks:401, intervalLength:20
    11lcov: WARNING: (gcov) GCOV did not produce any data for /Users/prabhatverma/projects/bitcoin/build/src/secp256k1/src/CMakeFiles/secp256k1_precomputed.dir/precomputed_ecmult.c.gcno
    12        (use "lcov --ignore-errors gcov,gcov ..." to suppress this warning)
    13lcov: WARNING: (gcov) GCOV did not produce any data for /Users/prabhatverma/projects/bitcoin/build/src/secp256k1/src/CMakeFiles/secp256k1_precomputed.dir/precomputed_ecmult_gen.c.gcno
    14Message summary:
    15  1 error message:
    16    inconsistent: 1
    17  2 warning messages:
    18    gcov: 2
    19lcov: ERROR: (inconsistent) "/Users/prabhatverma/projects/bitcoin/src/secp256k1/src/scalar_impl.h":67: duplicate function 'secp256k1_scalar_split_lambda' starts on line 67 but previous definition started on 142 while capturing from src/secp256k1/src/CMakeFiles/exhaustive_tests.dir/tests_exhaustive.c.gcno.
    20        (use "lcov --ignore-errors inconsistent ..." to bypass this error)
    21CMake Error at build/CoverageInclude.cmake:45 (execute_process):
    22  execute_process failed command indexes:
    23
    24    1: "Child return code: 1"
    25
    26Call Stack (most recent call first):
    27  build/Coverage.cmake:5 (include)
    

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    master@5b8fd7c

    Operating system and version

    MacOs Sequoia 15.3.1

    Machine specifications

    No response

  2. maflcko commented at 1:12 pm on February 21, 2025: member

    This is a known issue. While I don’t have macOS, some reported that it was working with clang/llvm tooling.

    You can try -DCMAKE_C_COMPILER='clang' -DCMAKE_CXX_COMPILER='clang++' -DCMAKE_CXX_FLAGS='-fprofile-instr-generate -fcoverage-mapping' and llvm-cov/llvm-profdata and see if that works for you.

  3. maflcko added the label Tests on Feb 21, 2025
  4. maflcko commented at 2:29 pm on February 21, 2025: member
    If it works for you, feel free to update the doc/developer-notes.md to mention it. Also, I wonder it it could make sense to add a CMakePreset for a clang coverage build based on the flags?

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-02-22 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me