sneumann / mzR

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

mzR fails to install for Clang 11 and 12 #244

Closed sneumann closed 3 years ago

sneumann commented 3 years ago

It was recently reported by Kurt Hornik that mzR fails to install for Clang 11 and 12 (at least on Linux) with

pwiz/data/common/BinaryIndexStream.cpp:159:15: error: cannot assign to 
non-static data member within const member function 'operator[]'
         next_ = _Off * value_size_;
         ~~~~~ ^
pwiz/data/common/BinaryIndexStream.cpp:157:12: note: member function 
'pwiz::data::(anonymous 
namespace)::stream_vector_const_iterator::operator[]' is declared const here
         reference operator[](difference_type _Off) const
         ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Either this is a small-ish fix, or we'll have to hurry up getting a new pwiz/boost version in.

Yours, Steffen

sneumann commented 3 years ago

Kurt also already proposed a fix:

Thanks.  Changing the offending line

        reference operator[](difference_type _Off) const

to remove the const seems to make things installable for me.
sneumann commented 3 years ago

Hi, after some struggling I was able to easily reproduce:

docker run --rm -it rhub/debian-clang bash

cd /tmp ; apt install -y libnetcdf-dev libxml2-dev r-base

mkdir ~/.R
cat >~/.R/Makevars <<EOF
CC=/usr/bin/clang-11
CPP=/usr/bin/clang-cpp-11
CXX=/usr/bin/clang++-11
CXX11=/usr/bin/clang++-11
CXX14=/usr/bin/clang++-11
EOF

R -e 'install.packages(c("BiocManager", "ncdf4"), repos="https://cloud.r-project.org")'
R -e 'BiocManager::install(c("zlibbioc", "Rhdf5lib"))'
R -e 'BiocManager::install("mzR")'