Skip to content

make cov fails with lcov-2 #28468

Closed
Closed

Description

@maflcko

Is there an existing issue for this?

  • I have searched the existing issues

Current behaviour

# make cov 
/usr/bin/lcov --gcov-tool /bitcoin-core/cov_tool_wrapper.sh -c -i -d /bitcoin-core/src -o baseline.info
Can't locate lcovutil.pm in @INC (you may need to install the lcovutil module) (@INC contains: /usr/local/lib/lcov /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.36.0 /usr/local/share/perl/5.36.0 /usr/lib/x86_64-linux-gnu/perl5/5.36 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.36 /usr/share/perl/5.36 /usr/local/lib/site_perl) at /usr/bin/lcov line 102.
BEGIN failed--compilation aborted at /usr/bin/lcov line 102.
make: *** [Makefile:1344: baseline.info] Error 2
rm cov_tool_wrapper.sh

Expected behaviour

No error

Steps to reproduce

For example on Debian Trixie or Ubuntu Mantic:

apt update && apt install -y git python3 libevent-dev libboost-dev lcov build-essential libtool autotools-dev automake pkg-config bsdmainutils bsdextrautils clang llvm && git clone --depth=1 https://github.com/bitcoin/bitcoin bitcoin-core && cd bitcoin-core && ./autogen.sh && ./configure --enable-lcov --enable-lcov-branch-coverage --disable-bench && make -j$( nproc ) && make cov

Relevant log output

No response

How did you obtain Bitcoin Core

Compiled from source

What version of Bitcoin Core are you using?

current master

Operating system and version

Debian Trixie or Ubuntu Mantic

Machine specifications

No response

Activity

  1. maflcko commented on Sep 13, 2023

    @maflcko
    MemberAuthor

    No idea if this is an upstream packaging bug or something else in this codebase.

    Would be good to fix it either way, or migrate to llvm coverage tools?

  2. fanquake commented on Sep 13, 2023

    @fanquake
    Member

    if this is an upstream packaging bug or

    Seems to be the case, as just spinning up a fresh container and trying to run lcov --version fails. i.e:

    apt update -y && apt upgrade -y && apt install -y lcov && lcov --version
    ...
    Setting up lcov (2.0-1) ...
    Processing triggers for libc-bin (2.38-1ubuntu4) ...
    Can't locate lcovutil.pm in @INC (you may need to install the lcovutil module) (@INC contains: /usr/local/lib/lcov /etc/perl /usr/local/lib/aarch64-linux-gnu/perl/5.36.0 /usr/local/share/perl/5.36.0 /usr/lib/aarch64-linux-gnu/perl5/5.36 /usr/share/perl5 /usr/lib/aarch64-linux-gnu/perl-base /usr/lib/aarch64-linux-gnu/perl/5.36 /usr/share/perl/5.36 /usr/local/lib/site_perl) at /usr/bin/lcov line 77.
    BEGIN failed--compilation aborted at /usr/bin/lcov line 102.

    See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1043009. Not sure if there is an easy workaround here, and it looks like the fixed version in debian:sid still doesn't work, it fails the same as above. Looks like this is because the current debian:sid docker image does not yet contain the 2.0-2 version.

  3. maflcko commented on Sep 14, 2023

    @maflcko
    MemberAuthor

    Closing for now, because this is an upstream issue

  4. maflcko commented on Sep 14, 2023

    @maflcko
    MemberAuthor

    Using your shorter steps to reproduce, I get the same output:

    # grep VERSION_CODENAME /etc/os-release && lcov --version 
    VERSION_CODENAME=trixie
    Can't locate lcovutil.pm in @INC (you may need to install the lcovutil module) (@INC contains: /usr/local/lib/lcov /etc/perl /usr/local/lib/riscv64-linux-gnu/perl/5.36.0 /usr/local/share/perl/5.36.0 /usr/lib/riscv64-linux-gnu/perl5/5.36 /usr/share/perl5 /usr/lib/riscv64-linux-gnu/perl-base /usr/lib/riscv64-linux-gnu/perl/5.36 /usr/share/perl/5.36 /usr/local/lib/site_perl) at /usr/bin/lcov line 77.
    BEGIN failed--compilation aborted at /usr/bin/lcov line 102.
    
  5. fanquake commented on Sep 26, 2023

    @fanquake
    Member

    Looks like as of the latest Debian Sid, lcov 2 is still broken, although it's now different from above:

    apt update -y && apt upgrade -y && apt install -y lcov && lcov --version
    ...
    Setting up lcov (2.0-3) ...
    Can't locate Capture/Tiny.pm in @INC (you may need to install the Capture::Tiny module) (@INC contains: /usr/lib/lcov /etc/perl /usr/local/lib/aarch64-linux-gnu/perl/5.36.0 /usr/local/share/perl/5.36.0 /usr/lib/aarch64-linux-gnu/perl5/5.36 /usr/share/perl5 /usr/lib/aarch64-linux-gnu/perl-base /usr/lib/aarch64-linux-gnu/perl/5.36 /usr/share/perl/5.36 /usr/local/lib/site_perl) at /usr/lib/lcov/lcovutil.pm line 14.
    BEGIN failed--compilation aborted at /usr/lib/lcov/lcovutil.pm line 14.
    Compilation failed in require at /usr/bin/lcov line 77.
    BEGIN failed--compilation aborted at /usr/bin/lcov line 102.
  6. dergoegge commented on Nov 2, 2023

    @dergoegge
    Member

    Can't locate Capture/Tiny.pm in @inc (you may need to install the Capture::Tiny module)

    Can be fixed by apt install libcapture-tiny-perl libdatetime-perl but it's still broken after that when trying to generate coverage.

    e.g. from make cov_fuzz:

    geninfo: ERROR: "/workdir/bitcoin/depends/x86_64-pc-linux-gnu/include/boost/date_time/gregorian/greg_month.hpp":40:  function _ZN5boost9gregorian9bad_monthD0Ev found on line but no corresponding 'line' coverage data point.  Cannot derive function end line.
    
  7. maflcko commented on Jan 25, 2024

    @maflcko
    MemberAuthor

    but it's still broken

    Same here. Is there an upstream bug report?

  8. fanquake commented on Mar 8, 2024

    @fanquake
    Member

    I have a branch using lcov 2.0 that seems to be working. Unfortunately the configuration flags required don't work with 1.16. Here are two .zips containing the output from make_cov using 2.0, and another output using 1.16, if anyone wants to compare the difference.
    116_coverage.zip
    201_coverage.zip

  9. maflcko commented on Mar 11, 2024

    @maflcko
    MemberAuthor

    I have a branch

    Mind sharing it?

  10. fanquake commented on Mar 11, 2024

    @fanquake
    Member

    Mind sharing it?

    https://github.com/fanquake/bitcoin/tree/support_lcov_2.
    You'll also likely need to apt install libdatetime-format-dateparse-perl.

  11. fanquake commented on Mar 26, 2024

    @fanquake
    Member

    You'll also likely need to apt install libdatetime-format-dateparse-perl.

    This has been fixed in the latest lcov: https://changelogs.ubuntu.com/changelogs/pool/universe/l/lcov/lcov_2.0-4ubuntu2/changelog.

    So now an invocation like above, replaced with my branch, "just works". i.e:

    apt update && apt upgrade -y && apt install -y git python3 libevent-dev libboost-dev lcov build-essential libtool autotools-dev automake pkg-config bsdmainutils bsdextrautils clang llvm && git clone --depth=1 https://github.com/fanquake/bitcoin bitcoin-core -b support_lcov_2 && cd bitcoin-core && ./autogen.sh && ./configure --enable-lcov --enable-lcov-branch-coverage --disable-bench && make -j$( nproc ) && make cov
  12. hebasto commented on May 13, 2024

    @hebasto
    Member

    Mind sharing it?

    https://github.com/fanquake/bitcoin/tree/support_lcov_2.

    To work without --enable-lcov-branch-coverage, it should be:

    --- a/configure.ac
    +++ b/configure.ac
    @@ -842,12 +842,14 @@ if test "$use_lcov" = "yes"; then
         [AC_MSG_ERROR([lcov testing requested but --coverage linker flag does not work])])
       AX_CHECK_COMPILE_FLAG([--coverage],[CORE_CXXFLAGS="$CORE_CXXFLAGS --coverage"],
         [AC_MSG_ERROR([lcov testing requested but --coverage flag does not work])])
    -  CORE_CXXFLAGS="$CORE_CXXFLAGS -Og"
    +  CORE_CXXFLAGS="$CORE_CXXFLAGS -Og -fprofile-update=prefer-atomic"
     fi
     
    +LCOV_OPTS="--ignore mismatch"
     if test "$use_lcov_branch" != "no"; then
    -  AC_SUBST(LCOV_OPTS, "$LCOV_OPTS --rc lcov_branch_coverage=1")
    +  LCOV_OPTS="$LCOV_OPTS --rc branch_coverage=1"
     fi
    +AC_SUBST(LCOV_OPTS, "$LCOV_OPTS")
     
     dnl Check for endianness
     AC_C_BIGENDIAN
  13. maflcko commented on May 24, 2024

    @maflcko
    MemberAuthor

    Ubuntu support for 23.04 ended, so with vanilla Ubuntu, the only way to go back to lcov-1 is to use 22.04 LTS.

    Not sure about which devs use Ubuntu and lcov, but it seems plausible that more are using 24.04 LTS, than 22.04 LTS, so it could make sense to switch to lcov-2 going forward?

  14. added this to the 28.0 milestone on May 24, 2024
  15. hebasto commented on May 25, 2024

    @hebasto
    Member

    FWIW, the hebasto#191 supports both LCOV versions for CMake.

  16. added a commit that references this issue on Jun 3, 2024
  17. fanquake commented on Jun 3, 2024

    @fanquake
    Member

    @maflcko was #30192 enough to close this?

  18. locked and limited conversation to collaborators on Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions