scipy: Compiled code coverage with `--gcov` doesn't work with Meson
For how this is supposed to work, see the PR description of gh-3021. It works with python runtests.py --gcov, but doesn’t work with dev.py:
$ python dev.py --gcov
Removing previous GCOV .gcda files...
The Meson build system
Version: 0.62.0
Source dir: /home/rgommers/code/scipy
Build dir: /home/rgommers/code/scipy/build
Build type: native build
Project name: SciPy
Project version: 1.9.0.dev0
meson.build:1:0: ERROR: Executables created by c compiler /home/rgommers/anaconda3/envs/scipy-dev/bin/x86_64-conda-linux-gnu-cc --coverage are not runnable.
A full log can be found at /home/rgommers/code/scipy/build/meson-logs/meson-log.txt
I made no attempt to figure out why yet.
Full log:
$ cat build/meson-logs/meson-log.txt
Build started at 2022-03-29T22:07:44.629711
Main binary: /home/rgommers/anaconda3/envs/scipy-dev/bin/python3.10
Build Options: -Dprefix=/home/rgommers/code/scipy/build-install
Python system: Linux
The Meson build system
Version: 0.62.0
Source dir: /home/rgommers/code/scipy
Build dir: /home/rgommers/code/scipy/build
Build type: native build
Project name: SciPy
Project version: 1.9.0.dev0
Sanity testing C compiler: /home/rgommers/anaconda3/envs/scipy-dev/bin/x86_64-conda-linux-gnu-cc --coverage
Is cross compiler: False.
Sanity check compiler command line: /home/rgommers/anaconda3/envs/scipy-dev/bin/x86_64-conda-linux-gnu-cc --coverage sanitycheckc.c -o sanitycheckc.exe -Wno-unused-function -Wno-conversion -Wno-misleading-indentation -Wno-incompatible-pointer-types -D_FILE_OFFSET_BITS=64 -pthread -B /home/rgommers/anaconda3/envs/scipy-dev/compiler_compat -shared -Wl,-rpath,/home/rgommers/anaconda3/envs/scipy-dev/lib -Wl,-rpath-link,/home/rgommers/anaconda3/envs/scipy-dev/lib -L/home/rgommers/anaconda3/envs/scipy-dev/lib -Wl,-rpath,/home/rgommers/anaconda3/envs/scipy-dev/lib -Wl,-rpath-link,/home/rgommers/anaconda3/envs/scipy-dev/lib -L/home/rgommers/anaconda3/envs/scipy-dev/lib --coverage
Sanity check compile stdout:
-----
Sanity check compile stderr:
-----
Running test binary command: /home/rgommers/code/scipy/build/meson-private/sanitycheckc.exe
meson.build:1:0: ERROR: Executables created by c compiler /home/rgommers/anaconda3/envs/scipy-dev/bin/x86_64-conda-linux-gnu-cc --coverage are not runnable.
@Smit-create is this something you could look at?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (17 by maintainers)
Commits related to this issue
- DEV: Removed from TODO list, currently broken (details : https://github.com/scipy/scipy/issues/15896) — committed to schettino72/scipy by sayantikabanik 5 years ago
- DEV: Removed lcov_html from TODO list, currently broken (details : https://github.com/scipy/scipy/issues/15896) — committed to schettino72/scipy by sayantikabanik 5 years ago
I’m fine with this only working with GCC, since that was the status quo before the move to Meson as well. Let’s make sure that that is reflected in the docs though, and that on macOS the user gets an informative error message rather than a confusing traceback.
Yes please, that sounds like a useful thing to do. This should be as easy as possible, so
test --coverageshould prepare the coverage report and inform the developer how to open it ideally.IIRC the issue is that clang specifically hates the idea of linking to internal utility libraries providing helper symbols for instrumentation, because it wants to statically link them (why?) and not inline them (interestinger and interestinger, though understandable) and as a result cannot provide them in multiple DSOs so it will only provide them for “main executables”. Which means when you build shared libraries (and that’s what a python extension is) you get outright load errors unless you also build cpython itself with instrumentation. Go figure.
Ok so, I executed the following commands in order as mentioned,
python dev.py build --gcovpython dev.py test --coveragelcov --capture --directory build --output-file coverage.infogenhtml -q coverage.info --output-directory out --legend --highlightIt doesn’t work on
macOS. I get the following error in step 2, i.e.,python dev.py test --coveragecommand,More details:
On Linux both of these command work, and
gcdafiles are generated,On Linux it works. Here’s the output (some screenshots). It shows the coverage C/C++ code. You can check the full output at https://github.com/czgdp1807/scipy-lcov-genhtml-coverage-output and explore further.
Here’s what I noticed somethings,
build/coverage) and C/C++ code (for this it goes into the directory specified in--output-directoryoption ofgenhtml) go into different directories. We can providebuild/coveragein--output-directoryoption ofgenhtml. However, I think it would be better to merge the two outputs so that a user can see everything under the same HTML page they load locally. Something for later.--coverageoption is provided inpython dev.py test, then last two commands (out of the four which I mentioned in the beginning of this comment), should execute automatically. Right now I guess they don’t. May be that’s something which we should to close this issue? Am I making sense here?So that’s all for now. cc: @rgommers