linux-test-project / lcov

LCOV
GNU General Public License v2.0
867 stars 235 forks source link

Error when try use on macOS #227

Closed paulocoutinhox closed 11 months ago

paulocoutinhox commented 1 year ago

Hi,

Im start get an error on my open source project Nativium ():

lcov -d /Users/paulo/Developer/workspaces/cpp/nativium/build/tests/debug/x86_64 -c -o /Users/paulo/Developer/workspaces/cpp/nativium/build/tests/debug/x86_64/lcov.coverage.info
Capturing coverage data from /Users/paulo/Developer/workspaces/cpp/nativium/build/tests/debug/x86_64
geninfo cmd: '/opt/homebrew/Cellar/lcov/2.0/bin/geninfo /Users/paulo/Developer/workspaces/cpp/nativium/build/tests/debug/x86_64 --output-filename /Users/paulo/Developer/workspaces/cpp/nativium/build/tests/debug/x86_64/lcov.coverage.info --memory 0'
Found LLVM gcov version 14.0.3, which emulates gcov version 4.2.0
Using intermediate gcov format
Writing temporary data to /tmp/geninfo_datqst5
Scanning /Users/paulo/Developer/workspaces/cpp/nativium/build/tests/debug/x86_64 for .gcda files ...
Found 2 data files in /Users/paulo/Developer/workspaces/cpp/nativium/build/tests/debug/x86_64
Processing /Users/paulo/Developer/workspaces/cpp/nativium/build/tests/debug/x86_64/target/build/tests.build/Debug/Objects-normal/x86_64/core.gcda
Processing /Users/paulo/Developer/workspaces/cpp/nativium/build/tests/debug/x86_64/target/build/tests.build/Debug/Objects-normal/x86_64/ApplicationCoreImpl.gcda
geninfo: ERROR: "/Users/paulo/.conan/data/gtest/1.11.0/_/_/package/448067e888eed02425989454e52454fec607e69b/include/gtest/gtest-message.h":91:  function _ZN7testing7MessageD1Ev found on line but no corresponding 'line' coverage data point.  Cannot derive function end line.
    (use "geninfo --ignore-errors inconsistent ..." to bypass this error)

Full log: https://github.com/nativium/nativium/actions/runs/5490406334/jobs/10005797221#step:15:19

It always work, but stop work now that i need commit an unrelated thing.

What can be wrong?

Thanks.

henry2cox commented 1 year ago

The message is telling you that the data generated by gcov for this function is inconsistent (likely a compiler or gcov bug).

Unfortunately, there is likely not much you can do to correct the data - apart from looking to see if there is a newer version of your compiler and/or toolchain where the bug is fixed.

Your other alternatives are:

lcov 2.0 is much, much more picky about errors and inconsistency than prior versions. This is a Good Thing, I think.

Hope this helped. Henry

paulocoutinhox commented 1 year ago

Is this, the latest version when brew install lcov happen is 2.0 and before is 1.16.

I install it manually and it works now.

curl -LO https://github.com/linux-test-project/lcov/archive/v1.16.tar.gz
tar -xzf v1.16.tar.gz
cd lcov-1.16
sudo make install
lcov --version

Thanks.

henry2cox commented 1 year ago

Glad it worked - but I would not go backward, if I were you.

I forgot to mention that you can also use the genhtml --keep-going flag, if you don't want the job to stop if it hits an error. This flag can also be set from your lcovrc file, if you want it to apply universally. Similarly, suppressions, exclusions, etc. can also be set from there.

henry2cox commented 1 year ago

Sorry - one more followup: the other thing to look at is the lcovrc man page for the "derive_function_end_line" option. This is where the error message you are seeing is coming from. If your compiler version is too old, then this is enabled by default - but you can turn it off. Once turned off, you won't see that particular error again - but you also won't be able to use any features that require to know the end line. This might not be a problem for you as you clearly were not using any of those features; they were not available in older lcov releases.

henry2cox commented 11 months ago

I believe this issue is addressed - so I am closing it now. The current lcov behaviour is correct: the data is inconsistent, and lcov is warning you about that. You can choose to ignore the warning or not - but it is a bad idea for a verification/validation tool to silently ignore issues.

In any case: if there is still a problem, please either reopen this issue or file a new one. Please include a detailed description of the problem and ideally include a testcase which exhibits it. Thanks Henry