sneumann / mzR

This is the git repository matching the Bioconductor package mzR: parser for netCDF, mzXML, mzData and mzML files (mass spectrometry data)
40 stars 26 forks source link

mzR fail installation #86

Closed microalgues closed 7 years ago

microalgues commented 7 years ago

Dear all,

I am having problems to install mzR package in R under my Ubuntu 16.04LTS distribution.

source("https://bioconductor.org/biocLite.R")

bioClite("mzR")

As you can see below I get several similar errors. I checked the software version of:

GNU Make 4.1 gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 netCDF 4.4.0

And I also tried to install from git-hub

install.packages("devtools") library(devtools) install_github("sneumann/mzR")

but it didn't work. Could someone help me?

With thanks,

Xavier

./boost/utility/base_from_member.hpp:xxx:xx: warning: variadic templates only available with -std=c++11 or -std=gnu++11

template<typename ...T>

./boost/thread/detail/invoke.hpp:xxx:xx: warning: variadic templates only available with -std=c++11 or -std=gnu++11

 invoke(Ret(*f)(Args... ), BOOST_THREAD_RV_REF(Args) ...args)

./boost/thread/once.hpp:35:13: note: template argument deduction/substitution failed:

boost/thread/src/pthread/thread.cpp:xxx:xx: note: cannot convert ‘boost::detail::{anonymous}::create_current_thread_tls_key’ (type ‘void()’) to type ‘boost::once_flag&’ boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);

boost/thread/src/pthread/thread.cpp: In function ‘void boost::detail::set_current_thread_data(boost::detail::thread_data_base*)’:

boost/thread/src/pthread/thread.cpp:xxx:xx: error: no matching function for call to ‘call_once(boost::once_flag&, void (&)())’ boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);

lgatto commented 7 years ago

Please, do not cross-post. I am closing this issue as the question has also been asked on the Bioconductor support forum.

lgatto commented 7 years ago

Does this error look familiar to anyone, or is it a red herring?

#./boost/utility/base_from_member.hpp:xxx:xx: warning: variadic templates only available with -std=c++11 or -std=gnu++11
template<typename ...T>

#./boost/thread/detail/invoke.hpp:xxx:xx: warning: variadic templates only available with -std=c++11 or -std=gnu++11
invoke(Ret(*f)(Args... ), BOOST_THREAD_RV_REF(Args) ...args)

#./boost/thread/once.hpp:35:13: note: template argument deduction/substitution failed:
boost/thread/src/pthread/thread.cpp:xxx:xx: note: cannot convert ‘boost::detail::{anonymous}::create_current_thread_tls_key’ (type ‘void()’) to type ‘boost::once_flag&’
boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);

#boost/thread/src/pthread/thread.cpp: In function ‘void boost::detail::set_current_thread_data(boost::detail::thread_data_base*)’:
boost/thread/src/pthread/thread.cpp:xxx:xx: error: no matching function for call to ‘call_once(boost::once_flag&, void (&)())’
boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);

I installed successfully using

R version 3.3.2 Patched (2016-11-01 r71616)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

locale:
 [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
 [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
 [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] BiocInstaller_1.24.0

loaded via a namespace (and not attached):
[1] tools_3.3.2   msdata_0.14.0

Cc @sneumann @jotsetung

microalgues commented 7 years ago

Thanks so far for your help. Although, it is not a hoax at all. However, after digging a bit deeper, I found out that the problem is caused by the following error

error: no matching function for call to ‘call_once(boost::once_flag&, void (&)())’boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);

rather than by the warnings. Other forums report it to be a bug and found some workarounds. One includes to set the compiler flag -std=c++0x. Crux of the matter, I have no idea how to force R to compile a package with given compiler flags.

Any ideas are appreciated.

sneumann commented 7 years ago

We have the same on the travis build for mzR. There we had to: mkdir ~/.R && echo 'CXX1X=g++ -std=c++0x -g -O2 -fPIC' > ~/.R/Makevars

lgatto commented 7 years ago

Red herring doesn't mean a hoax, it means that the error that is shown is actually not the real reason things fail. I wanted to check here before asking you to provide a more complete or full output.

lgatto commented 7 years ago

More details about that issue: https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=17189

lgatto commented 7 years ago

@microalgues - if setting the CXX flags fixes you local issue, would you mind reporting this on the Bioconductor support site, please.

microalgues commented 7 years ago

Hello @lgatto @sneumann , Finally, the recommended command doesn't work

mkdir ~/.R && echo 'CXX1X=g++ -std=c++0x -g -O2 -fPIC' > ~/.R/Makevars In general, create Makevars files does't work for me (I've tried in several folders)

In some way, I have already installed the package but with a lot of warnings and notes (see below). I changed different flags of the /etc/R/Makeconfig file, and the CPPFLAGS was that one which allow the pseudo-installation:

CC = gcc -std=gnu99 CFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdat$ CPICFLAGS = -fpic ---> CPPFLAGS = -std=c++0x CXX = g++ CXXCPP = $(CXX) -E CXXFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wd$ CXXPICFLAGS = -fpic CXX1X = g++ CXX1XFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -$ CXX1XPICFLAGS = -fpic CXX1XSTD = -std=c++0x

If I run the packages:

mzf [1] "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01-20141210.mzML"

library("mzR") Warning message: 'loadRcppModules' is deprecated. Use 'loadModule' instead. See help("Deprecated") ms <- openMSfile(mzf) [SpectrumList_mzML::create()] Bad istream. Failed to open file. Error in openMSfile(mzf) : Unable to create valid cRamp object.

Do you have any suggestion? With thanks

INSTALLATION WARNINGS & NOTES g++ -I/usr/share/R/include -DNDEBUG -D_LARGEFILE_SOURCE -I./boost_aux/ -I. -DHAVE_PWIZ_MZML_LIB -D_NODEBUG -DWITHOUT_MZ5 -I./boost nc-config --cflags || /bin/true -std=c++0x -I"/home/microalgues/R/mylibrary/Rcpp/include" -I"/home/microalgues/R/mylibrary/zlibbioc/include" -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c pwiz/utility/misc/Filesystem.cpp -o pwiz/utility/misc/Filesystem.o In file included from ./boost/bind/mem_fn.hpp:25:0, from ./boost/mem_fn.hpp:22, from ./boost/function/detail/prologue.hpp:18, from ./boost/function.hpp:24, from ./boost/algorithm/string/detail/find_iterator.hpp:18, from ./boost/algorithm/string/find_iterator.hpp:24, from ./boost/algorithm/string/iter_find.hpp:27, from ./boost/algorithm/string/split.hpp:16, from ./boost/algorithm/string.hpp:23, from pwiz/utility/misc/String.hpp:29, from pwiz/utility/misc/Filesystem.hpp:29, from pwiz/utility/misc/Filesystem.cpp:26: ./boost/get_pointer.hpp:27:40: warning: ‘template class std::auto_ptr’ is deprecated [-Wdeprecated-declarations] template T * get_pointer(std::auto_ptr const& p) ^ In file included from /usr/include/c++/5/bits/locale_conv.h:41:0, from /usr/include/c++/5/locale:43, from ./boost/algorithm/string/classification.hpp:15, from ./boost/algorithm/string/trim.hpp:23, from ./boost/algorithm/string.hpp:19, from pwiz/utility/misc/String.hpp:29, from pwiz/utility/misc/Filesystem.hpp:29, from pwiz/utility/misc/Filesystem.cpp:26: /usr/include/c++/5/bits/unique_ptr.h:49:28: note: declared here template class auto_ptr;

cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o mzR.so cramp.o ramp_base64.o ramp.o RcppRamp.o RcppRampModule.o rnetCDF.o RcppPwiz.o RcppPwizModule.o RcppIdent.o RcppIdentModule.o ./boost/system/src/error_code.o ./boost/regex/src/posix_api.o ./boost/regex/src/fileiter[......................]z/utility/misc/TabReader.o ./pwiz/utility/misc/random_access_compressed_ifstream.o ./pwiz/utility/misc/SHA1.o ./pwiz/utility/misc/SHA1Calculator.o ./pwiz/utility/misc/sha1calc.o ./random_access_gzFile.o rampR.o R_init_mzR.o -lpthread -L/usr/lib -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lnetcdf -lhdf5_hl -lhdf5 -lpthread -lsz -lz -ldl -lm -lcurl -L/usr/lib/R/lib -lR installing to /home/microalgues/R/mylibrary/mzR/libs R inst preparing package for lazy loading help * installing help indices building package indices installing vignettes testing if installed package can be loaded Warning: 'loadRcppModules' is deprecated. Use 'loadModule' instead. See help("Deprecated")

lgatto commented 7 years ago

I guess you could also set the flags in mzR/src/Makevars.

What is your Rcpp version, given by packageVersion("Rcpp"); I have 0.12.9. I am surprised by the deprecation warning.

Where does mzf come from? Did you download it? Could you try

> library(mzR)
> library(msdata)
> fls <- proteomics(full.names = TRUE)
> basename(fls)
[1] "MRM-standmix-5.mzML.gz"                                       
[2] "MS3TMT10_01022016_32917-33481.mzML.gz"                        
[3] "TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzML.gz"
> openMSfile(fls[2])
Mass Spectrometry file handle.
Filename:  MS3TMT10_01022016_32917-33481.mzML.gz 
Number of scans:  565 
> openMSfile(fls[3])
Mass Spectrometry file handle.
Filename:  TMT_Erwinia_1uLSike_Top10HCD_isol2_45stepped_60min_01.mzML.gz 
Number of scans:  509 
microalgues commented 7 years ago

Hello, I have created the folder mzR/src/ because it does't exist in mylibrary. Should it exist?

> packageVersion("Rcpp")
[1] ‘0.12.9’
> library(mzR)
Loading required package: Rcpp
Warning message:
'loadRcppModules' is deprecated.
Use 'loadModule' instead.
See help("Deprecated") 
> library(msdata)
> fls <- proteomics(full.names = TRUE)
Error: could not find function "proteomics"
> basename(fls)
Error in basename(fls) : object 'fls' not found

mzf file come from R/Bioconductor tools for mass spectrometry-based proteomics (https://lgatto.github.io/ProteomicsBioc2016Workshop/)

>library("rpx")
>pxannounced()
>px <- PXDataset("PXD000001")
>pxfiles(px)
>mzf <- pxget(px, pxfiles(px)[7])

I have problems also with the installation of RforProteomics:

Warning: 'loadRcppModules' is deprecated.
Use 'loadModule' instead.
See help("Deprecated")
Warning: multiple methods tables found for ‘unlist’

Thanks again, Xavier

lgatto commented 7 years ago

I have created the folder mzR/src/ because it does't exist in mylibrary. Should it exist?

In the source package, it exists. Flags should be set prior to compilation.

I think you need to update all your packages. msdata is outdated, as it doesn't have the proteomics function that returns proteomics files. Could you

library("BiocInstaller")
biocLite()

to update all packages and try the example code I suggested again.

microalgues commented 7 years ago

Sry, I don't get how flags can be set prior to compilation in the mzR/src/ folder as this folder is first created with the biocLite command which goes in hand with its immediate compilation. So, there is no mzR/src/ folder before "compiling" where I could pre-set flags.

lgatto commented 7 years ago

To compile yourself and set flags, you need to download the source manually (you can get the package tarball from Bioconductor landing page or get the source tree from github). Then, you can modify the Makevars in the src directory, then compile (build), check, and install with

R CMD build mzR
R CMD check mzR_2.9.8.tar.gz
R CMD INSTALL mzR_2.9.8.tar.gz

You still need to update everything using biocLite, as some packages are outdated.

microalgues commented 7 years ago

Thank you very much. Yeah, right, we tried to avoid to install and compile it from hand. Anyhow, we tried it, but the errors seem to glue to our soles as chewing gums. We removed R completely and re-installed it; then, we tried to run the "build" command, and got the following error:

lgatto commented 7 years ago

Yeah, right, we tried to avoid to install and compile it from hand.

You also compile using biocLite on Linux, so there isn't such a big different, at least compared to other OSes.

The LaTeX error you get is when building the vignette. You can bypass this with

R CMD build --no-build-vignettes mzR
R CMD check --no-build-vignettes mzR_2.9.8.tar.gz
R CMD INSTALL mzR_2.9.8.tar.gz
microalgues commented 7 years ago

Finally the package is working. I've installed after manual compilation from the command line following your recommendations.

R CMD build --no-build-vignettes mzR R CMD check --no-build-vignettes mzR_2.9.8.tar.gz R CMD INSTALL mzR_2.9.8.tar.gz

But I have had to modify the flags from the Makeconf file, because the mzR/src/Makevar file didn't work form me. Despite everything, I had some warnings during some other packages installation (are also working). I paste how looks my modifications of Makeconf file.

C_VISIBILITY = -fvisibility=hidden
CC = gcc -std=gnu99
CFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g $(LTO)
CPICFLAGS = -fpic
CPPFLAGS = 
CXX = g++
CXXCPP = $(CXX) -E
CXXFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g $(LTO)
CXXPICFLAGS = -fpic
CXX1X = g++
CXX1XFLAGS = -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g
CXX1XPICFLAGS = -fpic
CXX1XSTD = -std=c++0x

.SUFFIXES:
.SUFFIXES: .c .cc .cpp .d .f .f90 .f95 .m .mm .M .o

.c.o:
    $(CC)  $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
.c.d:
    @echo "making $@ from $<"
    @$(CC) -MM $(ALL_CFLAGS) $< > $@
.m.d:
    @echo > $@
.cc.o:
    $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
.cpp.o:
    $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
.cc.d:
    @echo "making $@ from $<"
    @$(CC) -M $(ALL_CPPFLAGS) $(ALL_CFLAGS) $< > $@
.cpp.d:
    @echo "making $@ from $<"
    @$(CXX) -M $(ALL_CPPFLAGS) $< > $@
.m.o:
    $(OBJC) $(ALL_CPPFLAGS) $(ALL_OBJCFLAGS) -c $< -o $@
.mm.o:
    $(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
.M.o:
    $(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
.f.o:
    $(F77) $(ALL_FFLAGS) -c $< -o $@
.f95.o:
    $(FC) $(PKG_FCFLAGS) $(FCPICFLAGS) $(FCFLAGS) -c  $< -o $@
.f90.o:
    $(FC) $(PKG_FCFLAGS) $(FCPICFLAGS) $(FCFLAGS) -c  $< -o $@

Thank you very much and I hope it helps. Xavier