make cov fails with lcov-2 #28468

issue maflcko openend this issue on September 13, 2023
  1. maflcko commented at 9:53 am on September 13, 2023: member

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    0# make cov 
    1/usr/bin/lcov --gcov-tool /bitcoin-core/cov_tool_wrapper.sh -c -i -d /bitcoin-core/src -o baseline.info
    2Can't locate lcovutil.pm in [@INC](/bitcoin-bitcoin/contributor/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.
    3BEGIN failed--compilation aborted at /usr/bin/lcov line 102.
    4make: *** [Makefile:1344: baseline.info] Error 2
    5rm cov_tool_wrapper.sh
    

    Expected behaviour

    No error

    Steps to reproduce

    For example on Debian Trixie or Ubuntu Mantic:

    0apt 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

  2. maflcko commented at 9:55 am on September 13, 2023: member

    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?

  3. fanquake commented at 10:32 am on September 13, 2023: 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:

    0apt update -y && apt upgrade -y && apt install -y lcov && lcov --version
    1...
    2Setting up lcov (2.0-1) ...
    3Processing triggers for libc-bin (2.38-1ubuntu4) ...
    4Can't locate lcovutil.pm in [@INC](/bitcoin-bitcoin/contributor/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.
    5BEGIN 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.

  4. maflcko added the label Build system on Sep 14, 2023
  5. maflcko added the label Upstream on Sep 14, 2023
  6. maflcko closed this on Sep 14, 2023

  7. maflcko commented at 8:59 am on September 14, 2023: member
    Closing for now, because this is an upstream issue
  8. maflcko commented at 9:02 am on September 14, 2023: member

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

    0# grep VERSION_CODENAME /etc/os-release && lcov --version 
    1VERSION_CODENAME=trixie
    2Can't locate lcovutil.pm in [@INC](/bitcoin-bitcoin/contributor/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.
    3BEGIN failed--compilation aborted at /usr/bin/lcov line 102.
    
  9. fanquake commented at 9:23 am on September 26, 2023: member

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

    0apt update -y && apt upgrade -y && apt install -y lcov && lcov --version
    1...
    2Setting up lcov (2.0-3) ...
    3Can't locate Capture/Tiny.pm in [@INC](/bitcoin-bitcoin/contributor/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.
    4BEGIN failed--compilation aborted at /usr/lib/lcov/lcovutil.pm line 14.
    5Compilation failed in require at /usr/bin/lcov line 77.
    6BEGIN failed--compilation aborted at /usr/bin/lcov line 102.
    
  10. dergoegge commented at 3:00 pm on November 2, 2023: 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:

    0geninfo: 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.
    
  11. maflcko commented at 1:09 pm on January 25, 2024: member

    but it’s still broken

    Same here. Is there an upstream bug report?

  12. fanquake commented at 4:34 pm on March 8, 2024: 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
  13. maflcko commented at 10:57 am on March 11, 2024: member

    I have a branch

    Mind sharing it?

  14. fanquake commented at 12:11 pm on March 11, 2024: 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.

  15. fanquake commented at 9:48 am on March 26, 2024: 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:

    0apt 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
    
  16. hebasto commented at 6:27 pm on May 13, 2024: member

    Mind sharing it?

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

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

     0--- a/configure.ac
     1+++ b/configure.ac
     2@@ -842,12 +842,14 @@ if test "$use_lcov" = "yes"; then
     3     [AC_MSG_ERROR([lcov testing requested but --coverage linker flag does not work])])
     4   AX_CHECK_COMPILE_FLAG([--coverage],[CORE_CXXFLAGS="$CORE_CXXFLAGS --coverage"],
     5     [AC_MSG_ERROR([lcov testing requested but --coverage flag does not work])])
     6-  CORE_CXXFLAGS="$CORE_CXXFLAGS -Og"
     7+  CORE_CXXFLAGS="$CORE_CXXFLAGS -Og -fprofile-update=prefer-atomic"
     8 fi
     9 
    10+LCOV_OPTS="--ignore mismatch"
    11 if test "$use_lcov_branch" != "no"; then
    12-  AC_SUBST(LCOV_OPTS, "$LCOV_OPTS --rc lcov_branch_coverage=1")
    13+  LCOV_OPTS="$LCOV_OPTS --rc branch_coverage=1"
    14 fi
    15+AC_SUBST(LCOV_OPTS, "$LCOV_OPTS")
    16 
    17 dnl Check for endianness
    18 AC_C_BIGENDIAN
    
  17. maflcko commented at 10:13 am on May 24, 2024: member

    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?

  18. maflcko reopened this on May 24, 2024

  19. maflcko added this to the milestone 28.0 on May 24, 2024
  20. hebasto commented at 2:56 pm on May 25, 2024: member
    FWIW, the https://github.com/hebasto/bitcoin/pull/191 supports both LCOV versions for CMake.
  21. fanquake referenced this in commit f7c0ddff46 on Jun 3, 2024
  22. fanquake commented at 9:35 am on June 3, 2024: member
    @maflcko was #30192 enough to close this?
  23. maflcko closed this on Jun 3, 2024


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: 2024-12-30 15:12 UTC

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