Skip to content

compiled code not showing up on windows #448

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

Closed
tdhock opened this issue Sep 15, 2020 · 10 comments
Closed

compiled code not showing up on windows #448

tdhock opened this issue Sep 15, 2020 · 10 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@tdhock
Copy link

tdhock commented Sep 15, 2020

hi @jimhester first of all thanks for maintaining covr which I find to be a very useful tool for many projects.

On my windows box the compiled code coverage is not showing up on the local report created via

covr::report(covr::package_coverage(type="all"))

This is with https://github.com/tdhock/binsegRcpp -- I only see one file R/binseg_normal.R on the coverage report, and I expected to also see src/binseg_normal.cpp and src/interface.cpp as on codecov e.g. https://coveralls.io/builds/33368011

I do have gcov on the path, is there any other setup that I need to do to get this to work?

> system("gcov --version")
gcov (MinGW.org GCC-6.3.0-1) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.

[1] 0
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] htmlwidgets_1.5.1 compiler_4.0.2    R6_2.4.1          magrittr_1.5     
 [5] lazyeval_0.2.2    htmltools_0.5.0   tools_4.0.2       rex_1.2.0        
 [9] withr_2.2.0       yaml_2.2.1        DT_0.15           crosstalk_1.1.0.1
[13] jsonlite_1.7.1    digest_0.6.25     covr_3.5.0        rlang_0.4.7      
> str(covr::package_coverage(type="all"))
List of 18
 $ binseg_normal.R:24:3:24:44:3:44:34:34    :List of 3
  ..$ value    : num 3
  ..$ srcref   : 'srcref' int [1:8] 24 3 24 44 3 44 34 34
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "binseg_normal"
 $ binseg_normal.R:79:3:79:56:3:56:89:89    :List of 3
  ..$ value    : num 1
  ..$ srcref   : 'srcref' int [1:8] 79 3 79 56 3 56 89 89
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "plot.binseg_normal"
 $ binseg_normal.R:113:5:117:6:5:6:123:127  :List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 113 5 117 6 5 6 123 127
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:95:6:99:3:6:3:105:109    :List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 95 6 99 3 6 3 105 109
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:94:3:94:22:3:22:104:104  :List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 94 3 94 22 3 22 104 104
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:92:3:93:50:3:50:102:103  :List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 92 3 93 50 3 50 102 103
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:100:5:102:11:5:11:110:112:List of 3
  ..$ value    : num 3
  ..$ srcref   : 'srcref' int [1:8] 100 5 102 11 5 11 110 112
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:112:5:112:51:5:51:122:122:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 112 5 112 51 5 51 122 122
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:25:3:25:4:3:4:35:35      :List of 3
  ..$ value    : num 3
  ..$ srcref   : 'srcref' int [1:8] 25 3 25 4 3 4 35 35
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "binseg_normal"
 $ binseg_normal.R:108:5:110:11:5:11:118:120:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 108 5 110 11 5 11 118 120
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:107:5:107:50:5:50:117:117:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 107 5 107 50 5 50 117 117
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:106:5:106:24:5:24:116:116:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 106 5 106 24 5 24 116 116
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:14:3:23:45:3:45:24:33    :List of 3
  ..$ value    : num 3
  ..$ srcref   : 'srcref' int [1:8] 14 3 23 45 3 45 24 33
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "binseg_normal"
 $ binseg_normal.R:104:3:118:19:3:19:114:128:List of 3
  ..$ value    : num 2
  ..$ srcref   : 'srcref' int [1:8] 104 3 118 19 3 19 114 128
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:105:5:105:19:5:19:115:115:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 105 5 105 19 5 19 115 115
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:111:5:111:29:5:29:121:121:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 111 5 111 29 5 29 121 121
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:12:3:12:37:3:37:22:22    :List of 3
  ..$ value    : num 3
  ..$ srcref   : 'srcref' int [1:8] 12 3 12 37 3 37 22 22
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr [1:2] "binseg_normal" "na"
 $ binseg_normal.R:11:3:11:54:3:54:21:21    :List of 3
  ..$ value    : num 3
  ..$ srcref   : 'srcref' int [1:8] 11 3 11 54 3 54 21 21
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b6ac10> 
  ..$ functions: chr "binseg_normal"
 - attr(*, "class")= chr "coverage"
 - attr(*, "package")=List of 14
  ..$ package    : chr "binsegRcpp"
  ..$ type       : chr "Package"
  ..$ title      : chr "Efficient Implementation of Binary Segmentation"
  ..$ version    : chr "2020.9.15"
  ..$ author     : chr "Toby Dylan Hocking"
  ..$ maintainer : chr "Toby Dylan Hocking <[email protected]>"
  ..$ description: chr "Standard template library\ncontainers are used to implement an efficient binary segmentation\nalgorithm, which "| __truncated__
  ..$ license    : chr "GPL-3"
  ..$ linkingto  : chr "Rcpp"
  ..$ url        : chr "https://github.com/tdhock/binseg"
  ..$ bugreports : chr "https://github.com/tdhock/binseg/issues"
  ..$ imports    : chr "data.table, Rcpp"
  ..$ suggests   : chr "ggplot2, testthat"
  ..$ path       : chr "C:/Users/th798/R/binsegRcpp"
 - attr(*, "relative")= logi TRUE
>  
@jimhester
Copy link
Member

There shouldn't be anything special you need to do, I will try to look into it and see if I can reproduce the issue on my Windows machine.

@stephematician
Copy link
Contributor

stephematician commented Mar 9, 2021

I noticed that covr can't find gcov on my work machine. It uses R 3.6.1 (probably should upgrade) with the usual Rtools. I can find gcov.exe in Rtools/mingw_64/bin/ but in R; Sys.which('gcov') produces nothing, as does getOption('covr.gcov'). So it seems like it just ain't finding/running gcov?

Setting the path via:

options(covr.gcov=normalizePath('blah/blah/blah/Rtools/mingw_64/bin/gcov.exe'))

Worked.

@tdhock
Copy link
Author

tdhock commented Mar 9, 2021

I was wondering if this would be fixed by #460 which was recently merged into master, so I installed current master, but the problem persists. On my windows machine R can find gcov just fine (that is not the problem either).

> str(covr::package_coverage(type="all"))
List of 18
 $ binseg_normal.R:24:3:24:44:3:44:34:34    :List of 3
  ..$ value    : num 4
  ..$ srcref   : 'srcref' int [1:8] 24 3 24 44 3 44 34 34
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "binseg_normal"
 $ binseg_normal.R:79:3:79:56:3:56:89:89    :List of 3
  ..$ value    : num 1
  ..$ srcref   : 'srcref' int [1:8] 79 3 79 56 3 56 89 89
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "plot.binseg_normal"
 $ binseg_normal.R:113:5:117:6:5:6:123:127  :List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 113 5 117 6 5 6 123 127
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:95:6:99:3:6:3:105:109    :List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 95 6 99 3 6 3 105 109
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:94:3:94:22:3:22:104:104  :List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 94 3 94 22 3 22 104 104
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:92:3:93:50:3:50:102:103  :List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 92 3 93 50 3 50 102 103
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:100:5:102:11:5:11:110:112:List of 3
  ..$ value    : num 3
  ..$ srcref   : 'srcref' int [1:8] 100 5 102 11 5 11 110 112
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:112:5:112:51:5:51:122:122:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 112 5 112 51 5 51 122 122
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:25:3:25:4:3:4:35:35      :List of 3
  ..$ value    : num 4
  ..$ srcref   : 'srcref' int [1:8] 25 3 25 4 3 4 35 35
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "binseg_normal"
 $ binseg_normal.R:108:5:110:11:5:11:118:120:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 108 5 110 11 5 11 118 120
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:107:5:107:50:5:50:117:117:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 107 5 107 50 5 50 117 117
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:106:5:106:24:5:24:116:116:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 106 5 106 24 5 24 116 116
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:14:3:23:45:3:45:24:33    :List of 3
  ..$ value    : num 4
  ..$ srcref   : 'srcref' int [1:8] 14 3 23 45 3 45 24 33
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "binseg_normal"
 $ binseg_normal.R:104:3:118:19:3:19:114:128:List of 3
  ..$ value    : num 2
  ..$ srcref   : 'srcref' int [1:8] 104 3 118 19 3 19 114 128
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:105:5:105:19:5:19:115:115:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 105 5 105 19 5 19 115 115
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:111:5:111:29:5:29:121:121:List of 3
  ..$ value    : num 5
  ..$ srcref   : 'srcref' int [1:8] 111 5 111 29 5 29 121 121
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "coef.binseg_normal"
 $ binseg_normal.R:12:3:12:37:3:37:22:22    :List of 3
  ..$ value    : num 4
  ..$ srcref   : 'srcref' int [1:8] 12 3 12 37 3 37 22 22
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr [1:2] "binseg_normal" "na"
 $ binseg_normal.R:11:3:11:54:3:54:21:21    :List of 3
  ..$ value    : num 4
  ..$ srcref   : 'srcref' int [1:8] 11 3 11 54 3 54 21 21
  .. ..- attr(*, "srcfile")=Classes 'srcfilealias', 'srcfile' <environment: 0x0000000017b55b20> 
  ..$ functions: chr "binseg_normal"
 - attr(*, "class")= chr "coverage"
 - attr(*, "package")=List of 14
  ..$ package    : chr "binsegRcpp"
  ..$ type       : chr "Package"
  ..$ title      : chr "Efficient Implementation of Binary Segmentation"
  ..$ version    : chr "2021.1.6"
  ..$ author     : chr "Toby Dylan Hocking"
  ..$ maintainer : chr "Toby Dylan Hocking <[email protected]>"
  ..$ description: chr "Standard template library\ncontainers are used to implement an efficient binary segmentation\nalgorithm, which "| __truncated__
  ..$ license    : chr "GPL-3"
  ..$ linkingto  : chr "Rcpp"
  ..$ url        : chr "https://github.com/tdhock/binsegRcpp"
  ..$ bugreports : chr "https://github.com/tdhock/binsegRcpp/issues"
  ..$ imports    : chr "data.table, Rcpp"
  ..$ suggests   : chr "ggplot2, testthat"
  ..$ path       : chr "C:/Users/th798/R/binsegRcpp"
 - attr(*, "relative")= logi TRUE
> Sys.which("gcov")
                      gcov 
"C:\\MinGW\\bin\\gcov.exe" 
> devtools::session_info()
- Session info ---------------------------------------------------------------
 setting  value                       
 version  R version 4.0.2 (2020-06-22)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RTerm                       
 language (EN)                        
 collate  English_United States.1252  
 ctype    English_United States.1252  
 tz       America/Phoenix             
 date     2021-03-09                  

- Packages -------------------------------------------------------------------
 ! package     * version    date       lib source                     
   assertthat    0.2.1      2019-03-21 [1] CRAN (R 4.0.2)             
   backports     1.1.10     2020-09-15 [1] CRAN (R 4.0.2)             
   callr         3.4.4      2020-09-07 [1] CRAN (R 4.0.2)             
   cli           2.0.2      2020-02-28 [1] CRAN (R 4.0.2)             
   covr          3.5.1.9000 2021-03-09 [1] Github (r-lib/covr@db5423f)
 V crayon        1.3.4      2021-02-08 [1] CRAN (R 4.0.4)             
   crosstalk     1.1.0.1    2020-03-13 [1] CRAN (R 4.0.2)             
   curl          4.3        2019-12-02 [1] CRAN (R 4.0.2)             
   desc          1.2.0      2018-05-01 [1] CRAN (R 4.0.2)             
   devtools      2.3.2      2020-09-18 [1] CRAN (R 4.0.2)             
   digest        0.6.27     2020-10-24 [1] CRAN (R 4.0.4)             
   DT            0.15       2020-08-05 [1] CRAN (R 4.0.2)             
   ellipsis      0.3.1      2020-05-15 [1] CRAN (R 4.0.2)             
   fansi         0.4.1      2020-01-08 [1] CRAN (R 4.0.2)             
   fs            1.5.0      2020-07-31 [1] CRAN (R 4.0.2)             
   glue          1.4.2      2020-08-27 [1] CRAN (R 4.0.2)             
   htmltools     0.5.0      2020-06-16 [1] CRAN (R 4.0.2)             
   htmlwidgets   1.5.1      2019-10-08 [1] CRAN (R 4.0.2)             
   jsonlite      1.7.2      2020-12-09 [1] CRAN (R 4.0.4)             
   lazyeval      0.2.2      2019-03-15 [1] CRAN (R 4.0.2)             
   magrittr      1.5        2014-11-22 [1] CRAN (R 4.0.2)             
   memoise       1.1.0      2017-04-21 [1] CRAN (R 4.0.2)             
   pkgbuild      1.1.0      2020-07-13 [1] CRAN (R 4.0.2)             
   pkgload       1.1.0      2020-05-29 [1] CRAN (R 4.0.2)             
   prettyunits   1.1.1      2020-01-24 [1] CRAN (R 4.0.2)             
   processx      3.4.4      2020-09-03 [1] CRAN (R 4.0.2)             
   ps            1.3.4      2020-08-11 [1] CRAN (R 4.0.2)             
   R6            2.5.0      2020-10-28 [1] CRAN (R 4.0.4)             
   remotes       2.2.0      2020-07-21 [1] CRAN (R 4.0.2)             
   rex           1.2.0      2020-04-21 [1] CRAN (R 4.0.2)             
   rlang         0.4.7      2020-07-09 [1] CRAN (R 4.0.2)             
   rprojroot     1.3-2      2018-01-03 [1] CRAN (R 4.0.2)             
   sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 4.0.2)             
   testthat      2.3.2      2020-03-02 [1] CRAN (R 4.0.2)             
   usethis       1.6.3      2020-09-17 [1] CRAN (R 4.0.2)             
 V withr         2.3.0      2021-01-26 [1] CRAN (R 4.0.4)             
   yaml          2.2.1      2020-02-01 [1] CRAN (R 4.0.2)             

[1] C:/Program Files/R/R-4.0.2/library

 V -- Loaded and on-disk version mismatch.
> 

@stephematician
Copy link
Contributor

I was able to get a full report on Windows 10, with R 3.6.1 and covr 3.5.1. Because I was using an older toolchain (Rtools 3.5) I had to add a src/Makevars.win to set the correct C++ standard, but I can't see how this would affect covr. I also have to set covr.gcov because my work machine is a bit messed up ... but ok.

> options(covr.gcov='whatever/Rtools/mingw_64/bin/gcov.exe')
> covr::package_coverage()
binsegRcpp Coverage: 99.31%
R/binseg_normal.R: 97.56%
src/binseg_normal.cpp: 100.00%
src/interface.cpp: 100.00%

Session info in case you are interested:

R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=C                          
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.6.1 lazyeval_0.2.2 magrittr_1.5   tools_3.6.1    rex_1.1.2     
[6] withr_2.1.2    crayon_1.3.4   covr_3.5.1 

@stephematician
Copy link
Contributor

Another thing you could check is that package_coverage() actually calls gcov; if the following is FALSE, then that means it should try to run gcov.

covr:::uses_icc()

You could step through covr::package_coverage with debug() to inspect the output from run_gcov (or you could debug(covr:::run_gcov) and see what happens there).

@tdhock
Copy link
Author

tdhock commented Mar 12, 2021

seems like the problem is that the first gcov on my PATH is "C:/mingw/bin/gcov.exe" which is version 6.3.0 (does not generate gcov files), whereas Rtools gcov is version 8.3.0 (does generate gcov files). So a short term fix is to manually specify the Rtools gcov,

> options(covr.gcov="c:/rtools40/mingw64/bin/gcov.exe")
> setwd("~/R/binsegRcpp")
> covr::package_coverage()
binsegRcpp Coverage: 99.31%
R/binseg_normal.R: 97.56%
src/binseg_normal.cpp: 100.00%
src/interface.cpp: 100.00%
> 

for a longer term / big picture fix, can you please add a warning? I would have expected something like ran gcov version x.y.z but it did not generate any src/*.gcov files; please fix by upgrading to at least gcov a.b.c; manually specify gcov path via options(covr.gcov='path/to/gcov')
What is the minimal version of gcov required?

@stephematician
Copy link
Contributor

Are you sure it's the gcov version, as opposed to, say, a conflict between the gcc/g++ tools used to create the .gcno files (probably from Rtools/mingw_64/bin) and the gcov found in a separate MinGW installation? PATH environment variable shenanigans have tripped me up many a time in Windows in similar ways.

I've added warnings when covr identifies relevant '.gcno' files but obtains no output from 'gcov' because either;

  • getOptions('covr.gcov') is empty; or
  • for whatever reason the parsed gcov output is empty.

I think this would be useful, although I'm not sure if there would be some cases that the warning might 'annoy' a user (I think they could always adjust their .covrignore so any .gcno that they don't need doesn't get built anyway)

@jimhester
Copy link
Member

The gcov version has to match the version you are compiling the package with. If you compile with the R toolchain you need to use the gcov from Rtools.

@jimhester
Copy link
Member

Closed by #465

@tdhock
Copy link
Author

tdhock commented Mar 17, 2021

super thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants