isovic / graphmap

GraphMap - A highly sensitive and accurate mapper for long, error-prone reads http://www.nature.com/ncomms/2016/160415/ncomms11307/full/ncomms11307.html Note: This was the original repository which will no longer be officially maintained. Please use the new official repository here:
https://github.com/lbcb-sci/graphmap2
MIT License
178 stars 44 forks source link

Compile error - Control reaches end of non-void function #55

Closed citizenlee closed 7 years ago

citizenlee commented 7 years ago

Ran into the following compile error below:

src/graphmap/graphmap.cc: In member function ‘std::sharedptr GraphMap::SetupIndex(std::shared_ptr, const string&, const string&, const ProgramParameters&, int64_t) const’: src/graphmap/graphmap.cc:215:10: error: cannot bind ‘std::unique_ptr’ lvalue to ‘std::unique_ptr&&’ return index; ^ In file included from /usr/include/c++/4.8.3/memory:82:0, from ./src/sparsehash/dense_hash_map:102, from codebase/gindex/src/minimizer_index/minimizer_index.h:11, from ./src/graphmap/graphmap.h:23, from src/graphmap/graphmap.cc:11: /usr/include/c++/4.8.3/bits/shared_ptr.h:257:2: error: initializing argument 1 of ‘std::shared_ptr<_Tp>::shared_ptr(std::unique_ptr<_Up, _Ep>&&) [with _Tp1 = is::MinimizerIndex; _Del = std::default_delete; _Tp = is::MinimizerIndex]’ shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r) ^ src/graphmap/graphmap.cc:216:1: error: control reaches end of non-void function [-Werror=return-type] } ^ cc1plus: some warnings being treated as errors make: *** [obj_linux/src/graphmap/graphmap.o] Error 1

isovic commented 7 years ago

Hmm strange...can you try using a newer compiler and letting me know how it works? For me it works well on g++ 6.2 on several machines.

Best regards, Ivan.

citizenlee commented 7 years ago

Will try this on a different computer. The above was run on an Amazon AMI.

deathmantim commented 7 years ago

I am having the same problem with g++ version 4.8.4 on ubuntu 14.04 It does work if g++ 6 is used after installing g++ 6.

citizenlee commented 7 years ago

Using brew to install gcc 6.1 without multilib (for openmp), I get the following compilation failure:

Makefile:100: " WARNING g++ minor version <7 " mkdir -p obj_linux/codebase/gindex/src/minimizer_index/ g++ -static-libgcc -static-libstdc++ -D__cplusplus=201103L -I"./src/" -I"/usr/include/" -I"codebase/seqlib/src/libs/seqan-library-2.0.1/include" -I"codebase/seqlib/src/libs/libdivsufsort-2.0.1-64bit/" -Icodebase/argumentparser/src -Icodebase/gindex/src -Icodebase/seqlib/src -DRELEASE_VERSION -O3 -fdata-sections -ffunction-sections -c -fmessage-length=0 -ffreestanding -fopenmp -m64 -std=c++11 -Werror=return-type -pthread -o obj_linux/codebase/gindex/src/minimizer_index/minimizer_index.o codebase/gindex/src/minimizer_index/minimizer_index.cc codebase/gindex/src/minimizer_index/minimizer_index.cc:2:26: error: expected constructor, destructor, or type conversion before '.' token

citizenlee commented 7 years ago

I was able to compile on Amazon Ubuntu 16.04 (ami-f4cc1de2) after installing gcc/g++/zlib1g-dev

isovic commented 7 years ago

Hi all, thank you for reporting back!

It seems there was an important change between C++11 and C++14 standards: http://stackoverflow.com/questions/35906268/returning-local-unique-ptr-as-a-shared-ptr .

In the commit you tested I implicitly converted from std::unique_ptr to std::shared_ptr, which older versions of g++ could not handle.

I fixed this in the latest commit (about 15mins ago) and tested on g++ 4.8.4 and it seems to work.

Would it be possible for any of you to verify the fix?

Thank you, Best regards, Ivan.

citizenlee commented 7 years ago

Latest commit did compile for me with g++ 4.8.3 on Amazon Linux AMI. Running a clang error - unsupported option '-fopenmp' on my mac - will work on this more. Thanks Ivan!

isovic commented 7 years ago

Hi Henry! Thank you for testing and reporting back! Glad to hear it works on older compilers now. As for clang, from what I hear (I'm not a Mac user) it does not have a support for OpenMP for some reason...

Thanks again! Best regards, Ivan.

deathmantim commented 7 years ago

Hey isovic, I was also able to compile on g++ 4 on ubuntu 14.04. Thanks for the replies! Tim

isovic commented 7 years ago

Hey Tim! Great to hear - thanks for reporting!

Best regards, Ivan.