deweylab / RSEM

RSEM: accurate quantification of gene and isoform expression from RNA-Seq data
http://deweylab.biostat.wisc.edu/rsem/
GNU General Public License v3.0
410 stars 118 forks source link

make pRSEM fails on CentOS 7 #128

Open mathog opened 4 years ago

mathog commented 4 years ago

After installing RSEM (and the R packages caTools, data.table, GenomicRanges, and ShortRead, all newer versions than are listed in pRSEM/installRLib.R) commented out the stanza that loads those packages (to skip needless reinstallation) and in main RSEM level ran:

make pRSEM

that fails with:

MAP -DMAQ_LONGREADS       -fpic  -g -O2  -c bamread.cpp -o bamread.o
In file included from /opt/rh/devtoolset-7/root/usr/include/c++/7/ext/hash_set:60:0,
                 from pc.h:5,
                 from bamread.cpp:1:
/opt/rh/devtoolset-7/root/usr/include/c++/7/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
 #warning \
  ^~~~~~~
bamread.cpp:14:10: fatal error: boost/tokenizer.hpp: No such file or directory
 #include <boost/tokenizer.hpp>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Modified RSEM/pRSEM/phantompeakqualtools/spp_1.10.1_on_R3.3/src/Makevars.in to

PKG_CXXFLAGS=-I./ -I/usr/include/boost169 -D_FASTMAP -DMAQ_LONGREADS @HAVE_LIBBZ2@ Returned to pRSEM level and did "make clean", then to top level and once again did

make pRSEM which failed at:

g++ -std=gnu++11 -I"/usr/common/modules/el7/x86_64/software/R/3.6.1-CentOS-vanilla/lib64/R/include" -DNDEBUG   -I/usr/local/include -I./ -I/usr/include/boost169 -D_FASTMAP -DMAQ_LONGREADS     -fpic  -g -O2  -c bamread.cpp -o bamread.o
In file included from /opt/rh/devtoolset-7/root/usr/include/c++/7/ext/hash_set:60:0,
                 from pc.h:5,
                 from bamread.cpp:1:
/opt/rh/devtoolset-7/root/usr/include/c++/7/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. [-Wcpp]
 #warning \
  ^~~~~~~
bamread.cpp: In function ‘SEXPREC* read_bam(SEXP, SEXP)’:
bamread.cpp:69:55: error: template argument 3 is invalid
   hash_map<string, int, hash<string>,equal_to<string> > cind_map;
                                                       ^
bamread.cpp:106:59: error: template argument 3 is invalid
       hash_map<string, int, hash<string>,equal_to<string> >::const_iterator li=cind_map.find(chr);
                                                           ^
bamread.cpp:106:77: error: qualified-id in declaration before ‘li’
       hash_map<string, int, hash<string>,equal_to<string> >::const_iterator li=cind_map.find(chr);
                                                                             ^~
bamread.cpp:108:10: error: ‘li’ was not declared in this scope
       if(li==cind_map.end()) {
          ^~
bamread.cpp:108:23: error: request for member ‘end’ in ‘cind_map’, which is of non-class type ‘int’
       if(li==cind_map.end()) {
                       ^~~
bamread.cpp:112:10: error: no match for ‘operator[]’ (operand types are ‘int’ and ‘std::string {aka std::basic_string<char>}’)
  cind_map[chr]=cind;
          ^
make[2]: *** [bamread.o] Error 1

This was using gcc 7.3.1 and R 3.6.1. Suggestions?

Thank you.

mathog commented 4 years ago

In case anybody else runs into this, for the files maqread.cpp, bamread.cpp, and bed2vector.cpp modify so that they look like this (add the last line):

using namespace std;
using namespace __gnu_cxx;
#define hash __gnu_cxx::hash // resolve std::hash vs. __gnu_cxx::hash collision otherwise present

It appears that when this code was written there was no std::hash so these lines:

hash_map<string, int, hash<string>,equal_to<string> > cind_map;

were unambiguously the __gnu_cxx::hash. In more recent c++ compilers there are two and g++ is picking std::hash instead of __gnu_cxx::hash, which is not compatible with the template.