mzR (2.8.1) Rcpp (0.12.10) compiler linker issue in Bioconductor 3.4, R 3.3.3
Entering edit mode
thomas • 0
Last seen 3.8 years ago

Good afternoon,

I have a clean install of R 3.3.3 with Bioconductor 3.4 on Windows 10 Pro x64 installed to a non-protected directory: d:\dev\R\

I am trying to use mzR::readMSData2(files), but I get the error: "Unable to create valid cRamp object". This seems to be due to a compatibility problem between the Rcpp_0.12.10 version that is installed with R 3.3.3 and the Rcpp_0.12.8 version that mzR_2.8.1 compiled against.

Are there any suggestion on how I can get the mzR functions to run properly?

Best regards,


Below is a more detailed walk-through of the problem and what I've tried.


When I loaded mzR and MSnbase, I received the following warning:

> library(mzR)
Warning in fun(libname, pkgname) :

  mzR has been built against a different Rcpp version (0.12.8)
than is installed on your system (0.12.10). This might lead to errors
when loading mzR. If you encounter such issues, please send a report,
including the output of sessionInfo() to the Bioc support forum at For details see also

I am working through the examples on this page:

> library(xcms)
> library(MSnbase)
> cdf_files <- dir(system.file("cdf", package = "faahKO"), recursive = TRUE, full.names = TRUE)
> s_groups <- rep("KO", length(cdf_files)) 
> s_groups[grep(cdf_files, pattern = "WT")] <- "WT"
> pheno <- data.frame(sample_name = sub(basename(cdf_files), pattern = ".CDF", replacement = "", fixed = TRUE), sample_group = s_groups, stringsAsFactors = FALSE)
> raw_data <- readMSData2(cdf_files, pdata = new("NAnnotatedDataFrame", pheno))

Failed to open file.
Error in mzR::openMSfile(f) : Unable to create valid cRamp object.
> traceback()
3: stop("Unable to create valid cRamp object.")
2: mzR::openMSfile(f)
1: readMSData2(cdf_files, pdata = new("NAnnotatedDataFrame", pheno))

I can use XCMS's xcmsSet to load the same data without an error:

> xset <- xcmsSet(cdf_files, phenoData=pheno)


I couldn't find a Windows binary build of (only 0.12.10 and 0.12.4), so I tried to build from source...

I have installed "devtools" and tried to install Rcpp 0.12.8 from source, (with Visual Studio 2015 installed) but I get a compilation error:

> install.packages("", repos=NULL, type="source")
trying URL ''
Content type 'application/x-gzip' length 2435852 bytes (2.3 MB)
downloaded 2.3 MB

* installing *source* package 'Rcpp' ...
** package 'Rcpp' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
Warning: running command 'make -f "" -f "d:/dev/Programs/R/R-3.3.3/etc/i386/Makeconf" -f "d:/dev/Programs/R/R-3.3.3/share/make/" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="Rcpp.dll" OBJECTS="Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o"' had status 127
ERROR: compilation failed for package 'Rcpp'
* removing 'd:/dev/R/R-3.3.3/library/Rcpp'
* restoring previous 'd:/dev/R/R-3.3.3/library/Rcpp'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, = TRUE) :
  problem copying d:\dev\R\R-3.3.3\library\00LOCK-Rcpp\Rcpp\libs\x64\Rcpp.dll to d:\dev\R\R-3.3.3\library\Rcpp\libs\x64\Rcpp.dll: Permission denied
Warning in install.packages :
  running command '"d:/dev/R/R-3.3.3/bin/x64/R" CMD INSTALL -l "d:\dev\R\R-3.3.3\library" "C:/Users/THOMAS/AppData/Local/Temp/RtmpWA3DIm/downloaded_packages/Rcpp_0.12.8.tar.gz"' had status 1
Warning in install.packages :
  installation of package ‘C:/Users/THOMAS/AppData/Local/Temp/RtmpWA3DIm/downloaded_packages/Rcpp_0.12.8.tar.gz’ had non-zero exit status


> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

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

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

other attached packages:
 [1] devtools_1.12.0      faahKO_1.14.0        MSnbase_2.0.2        BiocParallel_1.8.2  
 [5] xcms_1.50.1          Biobase_2.34.0       ProtGenerics_1.6.0   BiocGenerics_0.20.0 
 [9] mzR_2.8.1            Rcpp_0.12.10         BiocInstaller_1.24.0

loaded via a namespace (and not attached):
 [1] RColorBrewer_1.1-2     plyr_1.8.4             iterators_1.0.8        zlibbioc_1.20.0       
 [5] tools_3.3.3            digest_0.6.12          MALDIquant_1.16.2      memoise_1.0.0         
 [9] tibble_1.3.0           preprocessCore_1.36.0  gtable_0.2.0           lattice_0.20-35       
[13] foreach_1.4.3          Matrix_1.2-8           curl_2.4               httr_1.2.1            
[17] withr_1.0.2            stringr_1.2.0          IRanges_2.8.2          S4Vectors_0.12.2      
[21] stats4_3.3.3           multtest_2.30.0        grid_3.3.3             impute_1.48.0         
[25] R6_2.2.0               snow_0.4-2             XML_3.98-1.6           survival_2.41-3       
[29] RANN_2.5               limma_3.30.13          ggplot2_2.2.1          reshape2_1.4.2        
[33] magrittr_1.5           scales_0.4.1           pcaMethods_1.66.0      codetools_0.2-15      
[37] MASS_7.3-45            splines_3.3.3          mzID_1.12.0            MassSpecWavelet_1.40.0
[41] colorspace_1.3-2       stringi_1.1.5          affy_1.52.0            doParallel_1.0.10     
[45] lazyeval_0.2.0         munsell_0.4.3          vsn_3.42.3             affyio_1.44.0         
software error mzR Rcpp readMSData2 bioconductor • 1.7k views
Entering edit mode
Last seen 6 days ago

I don't think the error you see is a linker issue. The problem is that the files that you want to read are cdf files

[12] "/home/lg390/R/x86_64-pc-linux-gnu-library/3.4/faahKO/cdf/WT/wt22.CDF"
> basename(cdf_files)
 [1] "ko15.CDF" "ko16.CDF" "ko18.CDF" "ko19.CDF" "ko21.CDF" "ko22.CDF"
 [7] "wt15.CDF" "wt16.CDF" "wt18.CDF" "wt19.CDF" "wt21.CDF" "wt22.CDF"

but the backend that is used is cRamp - it should be netCDF. To first validate my hypothesis, you could run

> mzR::openMSfile(cdf_files[1], backend = "netCDF")
Mass Spectrometry file handle.
Filename:  /home/lg390/R/x86_64-pc-linux-gnu-library/3.4/faahKO/cdf/KO/ko15.CDF
Number of scans:  1278


> mzR::openMSfile(cdf_files[1], backend = "Ramp")
Failed to open file.
 Error in mzR::openMSfile(cdf_files[1], backend = "Ramp") :
  Unable to create valid cRamp object.

The correct netCDF backend is detected automatically in the development version, but there is a bug in the current release.

Unfortunately, the commits to the release branch have stopped, and I am unable to fix it now. My suggestion would be to download the devel version (get it here) and install it manually. If you use Rstudio, there is a menu entry to install local packages. Otherwise, you can do the following in R

install.package("", repos = NULL)

Let me know it this works.

Entering edit mode

Also, if you want to use the new functionality described in you'll need the current developmental xcms version (1.51.10). The xcms from Bioconductor release 3.4 that you are using does not provide these functions yet.

All this functionality will however be available in the next Bioconductor release, that will be available end of April.

Entering edit mode

Thank you, Laurent. 

This works:

> mzR::openMSfile(cdf_files[1], backend = "netCDF")

However, calling MSnbase::readMSData2  doesn't let me pass a backend argument down to mzR::openMSfile 

> MSnbase::readMSData2(cdf_files)
Failed to open file.
Error in mzR::openMSfile(f) : Unable to create valid cRamp object.
> traceback()
3: stop("Unable to create valid cRamp object.")
2: mzR::openMSfile(f)
1: MSnbase::readMSData2(cdf_files)


> readMSData2
function (files, pdata = NULL, msLevel., verbose = isMSnbaseVerbose(), 
    centroided., smoothed. = NA) 
    assaydata <- new.env(parent = emptyenv())
    filenams <- filenums <- c()
    fullhd2 <- fullhdorder <- c()
    fullhdordercounter <- 1
    .instrumentInfo <- list()
    featureDataList <- list()
    for (f in files) {
        filen <- match(f, files)
        filenums <- c(filenums, filen)
        filenams <- c(filenams, f)
        msdata <- mzR::openMSfile(f)

I'll try out the devel version.

Entering edit mode

Updating to MSnbase 2.1.16 resolved this problem. Thanks.

Entering edit mode

And you should also use the devel xcms version.

Entering edit mode
Last seen 14 hours ago
United States

If you need to build source packages with C code on Windows, nothing called 'devtools' will help. Neither will Visual Studio. You need Rtools, which these days is provided with a simple installer. After which:

> install.packages("", repos=NULL, type="source")
Installing package into 'C:/Users/jmacdon/AppData/Roaming/R/win-library/3.3'
(as 'lib' is unspecified)
trying URL ''
Content type 'application/x-gzip' length 2435852 bytes (2.3 MB)
downloaded 2.3 MB

* installing *source* package 'Rcpp' ...
** package 'Rcpp' successfully unpacked and MD5 sums checked
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c Date.cpp -o Date.o
c:/Rtools/mingw_32/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c Module.cpp -o Module.o
c:/Rtools/mingw_32/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c Rcpp_init.cpp -o Rcpp_init.o
c:/Rtools/mingw_32/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c api.cpp -o api.o
c:/Rtools/mingw_32/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c attributes.cpp -o attributes.o
c:/Rtools/mingw_32/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c barrier.cpp -o barrier.o
c:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o Rcpp.dll tmp.def Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 -Ld:/Compiler/gcc-4.9.3/local330/lib -Lc:/PROGRA~1/R/R-33~1.2/bin/i386 -lR
installing to C:/Users/jmacdon/AppData/Roaming/R/win-library/3.3/Rcpp/libs/i386

*** arch - x64
c:/Rtools/mingw_64/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c Date.cpp -o Date.o
c:/Rtools/mingw_64/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c Module.cpp -o Module.o
c:/Rtools/mingw_64/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c Rcpp_init.cpp -o Rcpp_init.o
c:/Rtools/mingw_64/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c api.cpp -o api.o
c:/Rtools/mingw_64/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c attributes.cpp -o attributes.o
c:/Rtools/mingw_64/bin/g++  -I"c:/PROGRA~1/R/R-33~1.2/include" -DNDEBUG -I../inst/include/    -I"d:/Compiler/gcc-4.9.3/local330/include"     -O2 -Wall  -mtune=core2 -c barrier.cpp -o barrier.o
c:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o Rcpp.dll tmp.def Date.o Module.o Rcpp_init.o api.o attributes.o barrier.o -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -Lc:/PROGRA~1/R/R-33~1.2/bin/x64 -lR
installing to C:/Users/jmacdon/AppData/Roaming/R/win-library/3.3/Rcpp/libs/x64
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (Rcpp)

But do note that using install.packages to install an older version of Rcpp puts you into the deep end of the pool, and you shouldn't expect much help (or really any at all) if things go awry, particularly for other packages that may be relying on things that are in the newer version of Rcpp.


Login before adding your answer.

Traffic: 424 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6