Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"--coverage" flag does not seem to be working #345

Closed
aadler opened this issue Nov 21, 2018 · 7 comments
Closed

"--coverage" flag does not seem to be working #345

aadler opened this issue Nov 21, 2018 · 7 comments

Comments

@aadler
Copy link

aadler commented Nov 21, 2018

When I try to use covr for my package, I get errors indicating that the needed compile and linker flags are not being passed:

Warning: unknown option '--with-keep.parse.data'
* installing *source* package 'Delaporte' ...
** libs
c:/Rtools/mingw_64/bin/gfortran  -fopenmp   -O3  -march=native -pipe -O0 --coverage -c  utils.f95 -o utils.o
c:/Rtools/mingw_64/bin/gfortran  -fopenmp   -O3  -march=native -pipe -O0 --coverage -c  lgamma.f95 -o lgamma.o
c:/Rtools/mingw_64/bin/gfortran  -fopenmp   -O3  -march=native -pipe -O0 --coverage -c  delaporte.f95 -o delaporte.o
c:/Rtools/mingw_64/bin/gcc  -I"C:/R/RCurrent/R-35~1.0PA/include" -DNDEBUG   -march=native -pipe  -I"C:/R/extsoft/include"     -O3 -Wall  -std=gnu99 -march=native -pipe -O0 --coverage -c utils_and_wrappers.c -o utils_and_wrappers.o
c:/Rtools/mingw_64/bin/gfortran -shared -s -static-libgcc -o Delaporte.dll tmp.def delaporte.o lgamma.o utils.o utils_and_wrappers.o -LC:/R/RCurrent/R-35~1.0PA/bin/x64 -lRlapack -LC:/R/RCurrent/R-35~1.0PA/bin/x64 -lRblas -lgfortran -lm -lquadmath -fopenmp -LC:/R/extsoft/lib/x64 -LC:/R/extsoft/lib -LC:/R/RCurrent/R-35~1.0PA/bin/x64 -lR
delaporte.o:delaporte.f95:(.text+0x2cb8): undefined reference to `__gcov_init'
delaporte.o:delaporte.f95:(.data+0x60): undefined reference to `__gcov_merge_add'
lgamma.o:lgamma.f95:(.text+0x66b): undefined reference to `__gcov_init'
lgamma.o:lgamma.f95:(.data+0x60): undefined reference to `__gcov_merge_add'
utils.o:utils.f95:(.text+0x200): undefined reference to `__gcov_init'
utils.o:utils.f95:(.data+0x60): undefined reference to `__gcov_merge_add'
utils_and_wrappers.o:utils_and_wrappers.c:(.text+0xc84): undefined reference to `__gcov_init'
utils_and_wrappers.o:utils_and_wrappers.c:(.data+0x60): undefined reference to `__gcov_merge_add'
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'Delaporte'
* removing 'D:/Rtemp/Rtmp8AkZTR/R_LIBS39c86e094a60/Delaporte'
In R CMD INSTALL
Error in file(con, "r") : cannot open the connection
In addition: Warning messages:
1: In utils::install.packages(repos = NULL, lib = tmp_lib, pkg$path,  :
  installation of package ‘D:/Users/Parents/Documents/Avi/GitRepos/delaporte’ had non-zero exit status
2: In file(con, "r") :
  cannot open file 'D:/Rtemp/Rtmp8AkZTR/R_LIBS39c86e094a60/Delaporte/R/Delaporte': No such file or directory

However, when I manually put the proper flags in Makevars, it does work. Shouldn't --coverage alone be sufficient?

> package_coverage(quiet = FALSE, tests = "none", code = 'testthat::test_file("./tests/testthat/test-delap.r")', function_exclusions = "\\.onUnload*")
Warning: unknown option '--with-keep.parse.data'
* installing *source* package 'Delaporte' ...
** libs
c:/Rtools/mingw_64/bin/gfortran  -fopenmp -ftest-coverage -fprofile-arcs  -O3  -march=native -pipe -O0 --coverage -c  utils.f95 -o utils.o
c:/Rtools/mingw_64/bin/gfortran  -fopenmp -ftest-coverage -fprofile-arcs  -O3  -march=native -pipe -O0 --coverage -c  lgamma.f95 -o lgamma.o
c:/Rtools/mingw_64/bin/gfortran  -fopenmp -ftest-coverage -fprofile-arcs  -O3  -march=native -pipe -O0 --coverage -c  delaporte.f95 -o delaporte.o
c:/Rtools/mingw_64/bin/gcc  -I"C:/R/RCurrent/R-35~1.0PA/include" -DNDEBUG   -march=native -pipe  -I"C:/R/extsoft/include"     -O3 -Wall  -std=gnu99 -march=native -pipe -O0 --coverage -c utils_and_wrappers.c -o utils_and_wrappers.o
c:/Rtools/mingw_64/bin/gfortran -shared -s -static-libgcc -o Delaporte.dll tmp.def delaporte.o lgamma.o utils.o utils_and_wrappers.o -LC:/R/RCurrent/R-35~1.0PA/bin/x64 -lRlapack -LC:/R/RCurrent/R-35~1.0PA/bin/x64 -lRblas -lgfortran -lm -lquadmath -fopenmp -fprofile-arcs -LC:/R/extsoft/lib/x64 -LC:/R/extsoft/lib -LC:/R/RCurrent/R-35~1.0PA/bin/x64 -lR
installing to D:/Rtemp/Rtmp6561Jg/R_LIBS44b84063750c/Delaporte/libs/x64
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'Delaporte'
    finding HTML links ... done
    Delaporte-defunct                       html  
    Delaporte-internal                      html  
    Delaporte-package                       html  
    Delaporte                               html  example
** building package indices
** testing if installed package can be loaded
* DONE (Delaporte)
In R CMD INSTALL
Running specific tests for package ‘Delaporte’
  Running ‘test-all.R’
Delaporte Coverage: 77.78%
R/Delaporte.R: 77.78%
@jimhester
Copy link
Member

This is compiler dependant, perhaps the gfortran version you are using needs them explicitly set...

@aadler
Copy link
Author

aadler commented Nov 23, 2018

I guess that's a question for @jeroen then, as he builds Rtools for windows :)

@cjvanlissa
Copy link

This issue has been closed, but has it been resolved? I get the same issue in all of my packages with Fortran code.

@aadler
Copy link
Author

aadler commented Oct 23, 2019

No, I don't think so.

@jimhester
Copy link
Member

Feel free to open a PR with the settings you need for fortran code, and please ensure it works across the major compilers, clang + gcc and the RTools toolchain on windows.

@cjvanlissa
Copy link

I'd love to, but I don't understand how to!

@jimhester
Copy link
Member

Change

covr/R/zzz.R

Lines 18 to 19 in 26066d3

FFLAGS = "-O0 --coverage",
FCFLAGS = "-O0 --coverage",
to what it needs to be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants