DaehwanKimLab / centrifuge

Classifier for metagenomic sequences
GNU General Public License v3.0
246 stars 73 forks source link

compilation error on Ubuntu Trusty (14.04) #115

Closed Krischan closed 6 years ago

Krischan commented 6 years ago

Compiling centrifuge (commit b8de8e4) fails on Ubuntu Trusty. Ubuntu is up to date.

Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty

GCC is gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.4)

Is a newer GCC required?

Below the output after running make:

/usr/bin/g++  -O3 -m64 -msse2 -funroll-loops -g3 -DCOMPILER_OPTIONS="\"-O3 -m64 -msse2 -funroll-loops -g3 -DPOPCNT_CAPABILITY\"" -DPOPCNT_CAPABILITY \
    -fno-strict-aliasing -DCENTRIFUGE_VERSION="\"1.0.4\"" -DBUILD_HOST="\"`hostname`\"" -DBUILD_TIME="\"`date`\"" -DCOMPILER_VERSION="\"`/usr/bin/g++  -v 2>&1 | tail -1`\"" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE   -DBOWTIE_MM  -DCENTRIFUGE -DBOWTIE2 -DBOWTIE_64BIT_INDEX -DNDEBUG -Wall \
     -I third_party \
    -o centrifuge-build-bin centrifuge_build.cpp \
    ccnt_lut.cpp ref_read.cpp alphabet.cpp shmem.cpp edit.cpp bt2_idx.cpp reference.cpp ds.cpp limit.cpp random_source.cpp tinythread.cpp diff_sample.cpp centrifuge_build_main.cpp \
    -lpthread
In file included from centrifuge_build.cpp:27:0:
bt2_idx.h: In static member function ‘static std::pair<Ebwt<index_t>*, Ebwt<index_t>*> Ebwt<index_t>::fromStrings(const EList<std::basic_string<char> >&, bool, int, int, bool, int32_t, int32_t, int32_t, const string&, bool, index_t, index_t, index_t, int, uint32_t, bool, bool, bool)’:
bt2_idx.h:1120:3: error: ‘unique_ptr’ was not declared in this scope
   unique_ptr<stringstream> ss(new stringstream());
   ^
bt2_idx.h:1120:26: error: expected primary-expression before ‘>’ token
   unique_ptr<stringstream> ss(new stringstream());
                          ^
bt2_idx.h:1120:49: error: there are no arguments to ‘ss’ that depend on a template parameter, so a declaration of ‘ss’ must be available [-fpermissive]
   unique_ptr<stringstream> ss(new stringstream());
                                                 ^
bt2_idx.h:1120:49: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
bt2_idx.h:1122:6: error: ‘ss’ was not declared in this scope
    (*ss) << ">" << i << endl << strs[i] << endl;
      ^
bt2_idx.h:1124:21: error: expected primary-expression before ‘>’ token
   unique_ptr<FileBuf> fb(new FileBuf(ss.get()));
                     ^
bt2_idx.h:1124:38: error: ‘ss’ was not declared in this scope
   unique_ptr<FileBuf> fb(new FileBuf(ss.get()));
                                      ^
bt2_idx.h:1124:47: error: there are no arguments to ‘fb’ that depend on a template parameter, so a declaration of ‘fb’ must be available [-fpermissive]
   unique_ptr<FileBuf> fb(new FileBuf(ss.get()));
                                               ^
bt2_idx.h:1129:16: error: ‘fb’ was not declared in this scope
   is.push_back(fb.get());
                ^
In file included from bt2_idx.cpp:25:0:
bt2_idx.h: In static member function ‘static std::pair<Ebwt<index_t>*, Ebwt<index_t>*> Ebwt<index_t>::fromStrings(const EList<std::basic_string<char> >&, bool, int, int, bool, int32_t, int32_t, int32_t, const string&, bool, index_t, index_t, index_t, int, uint32_t, bool, bool, bool)’:
bt2_idx.h:1120:3: error: ‘unique_ptr’ was not declared in this scope
   unique_ptr<stringstream> ss(new stringstream());
   ^
bt2_idx.h:1120:26: error: expected primary-expression before ‘>’ token
   unique_ptr<stringstream> ss(new stringstream());
                          ^
bt2_idx.h:1120:49: error: there are no arguments to ‘ss’ that depend on a template parameter, so a declaration of ‘ss’ must be available [-fpermissive]
   unique_ptr<stringstream> ss(new stringstream());
                                                 ^
bt2_idx.h:1120:49: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
bt2_idx.h:1122:6: error: ‘ss’ was not declared in this scope
    (*ss) << ">" << i << endl << strs[i] << endl;
      ^
bt2_idx.h:1124:21: error: expected primary-expression before ‘>’ token
   unique_ptr<FileBuf> fb(new FileBuf(ss.get()));
                     ^
bt2_idx.h:1124:38: error: ‘ss’ was not declared in this scope
   unique_ptr<FileBuf> fb(new FileBuf(ss.get()));
                                      ^
bt2_idx.h:1124:47: error: there are no arguments to ‘fb’ that depend on a template parameter, so a declaration of ‘fb’ must be available [-fpermissive]
   unique_ptr<FileBuf> fb(new FileBuf(ss.get()));
                                               ^
bt2_idx.h:1129:16: error: ‘fb’ was not declared in this scope
   is.push_back(fb.get());
                ^
make: *** [centrifuge-build-bin] Error 1
mourisl commented 6 years ago

Will the solution from #108 help?

Krischan commented 6 years ago

Thanks for the pointer @mourisl! #108 (almost) did the trick.

Instead of -std=c++14, the option required forgcc 4.8.4 is -std=c++1y (found via Stackoverflow).