amplab / snap

Scalable Nucleotide Alignment Program -- a fast and accurate read aligner for high-throughput sequencing data
https://www.microsoft.com/en-us/research/project/snap/
Apache License 2.0
287 stars 66 forks source link

Compiling on Ubuntu 16.10 fails #78

Closed lpryszcz closed 5 years ago

lpryszcz commented 7 years ago

Hi, I've compiled snap on many machines without any problem. However lately compilation on Ubuntu 16.10 failed. Any idea why? btw: really great job with this aligner!

/usr/include/c++/6/tuple:1190:52: note:   candidate expects 3 arguments, 0 provided
    static_cast<_Inherited&>(*this) = std::move(__in);
                                                    ^
/usr/include/c++/6/tuple: In member function ‘std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(const std::pair<_U1, _U2>&)’:
/usr/include/c++/6/tuple:1198:31: error: expected primary-expression before ‘.’ token
    this->_M_head(*this) = __in.first;
                               ^
/usr/include/c++/6/tuple:1199:46: error: expected primary-expression before ‘.’ token
    this->_M_tail(*this)._M_head(*this) = __in.second;
                                              ^
/usr/include/c++/6/tuple: In member function ‘std::tuple<_T1, _T2>& std::tuple<_T1, _T2>::operator=(std::pair<_U1, _U2>&&)’:
/usr/include/c++/6/tuple:1207:49: error: expected primary-expression before ‘.’ token
    this->_M_head(*this) = std::forward<_U1>(__in.first);
                                                 ^
/usr/include/c++/6/tuple:1208:64: error: expected primary-expression before ‘.’ token
    this->_M_tail(*this)._M_head(*this) = std::forward<_U2>(__in.second);
                                                                ^
<builtin>: recipe for target 'SNAPLib/AlignerContext.o' failed
make: *** [SNAPLib/AlignerContext.o] Error 1
lpryszcz commented 7 years ago

this can be specific to newer versions of g++ (I have 6.2).

http://stackoverflow.com/questions/15792462/g-error-expected-primary-expression http://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords

anyidea how to solve it? I'm not c++ developer...

xhongyi commented 7 years ago

Hi sorry for the late reply.

While I'm not sure what exactly caused it but It does seems to be a gcc version issue. For some reason the compiler doesn't sort out the overloading of http://en.cppreference.com/w/cpp/utility/move but instead, had http://en.cppreference.com/w/cpp/algorithm/move

Can you check if the header files has "#include "? if not maybe add that will solve the issue.

Thanks, Hongyi

On Thu, Jan 19, 2017 at 5:11 AM, Leszek notifications@github.com wrote:

this can be specific to newer versions of g++ (I have 6.2).

http://stackoverflow.com/questions/15792462/g-error- expected-primary-expression http://stackoverflow.com/questions/610245/where-and- why-do-i-have-to-put-the-template-and-typename-keywords

anyidea how to solve it? I'm not c++ developer...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/amplab/snap/issues/78#issuecomment-273732995, or mute the thread https://github.com/notifications/unsubscribe-auth/AD9rdGB7VunINdWcPes7A4yPaJVE-PIzks5rTzbrgaJpZM4Lg2F2 .

-- Hongyi Xin

Computer Science Department Carnegie Mellon University 5000 Forbes ave. Pittsburgh PA 15213 http://xinhongyi.me

bolosky commented 7 years ago

I don’t have a repro easily, since I don’t have the same version of Ubunto/gcc here.

Could you try what Hongyi suggests and add

include

into SNAPLib/stdafx.h at the end of the common includes (right after stdarg.h and before #ifdef _MSC_VER). It doesn’t break the compilation on Windows. If it fixes your problem, then submit a pull request and I’ll pick it up.

--Bill

From: Hongyi Xin [mailto:notifications@github.com] Sent: Thursday, January 19, 2017 1:35 PM To: amplab/snap snap@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [amplab/snap] Compiling on Ubuntu 16.10 fails (#78)

Hi sorry for the late reply.

While I'm not sure what exactly caused it but It does seems to be a gcc version issue. For some reason the compiler doesn't sort out the overloading of http://en.cppreference.com/w/cpp/utility/move but instead, had http://en.cppreference.com/w/cpp/algorithm/move

Can you check if the header files has "#include "? if not maybe add that will solve the issue.

Thanks, Hongyi

On Thu, Jan 19, 2017 at 5:11 AM, Leszek notifications@github.com<mailto:notifications@github.com> wrote:

this can be specific to newer versions of g++ (I have 6.2).

http://stackoverflow.com/questions/15792462/g-error- expected-primary-expression http://stackoverflow.com/questions/610245/where-and- why-do-i-have-to-put-the-template-and-typename-keywords

anyidea how to solve it? I'm not c++ developer...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/amplab/snap/issues/78#issuecomment-273732995, or mute the thread https://github.com/notifications/unsubscribe-auth/AD9rdGB7VunINdWcPes7A4yPaJVE-PIzks5rTzbrgaJpZM4Lg2F2 .

-- Hongyi Xin

Computer Science Department Carnegie Mellon University 5000 Forbes ave. Pittsburgh PA 15213 http://xinhongyi.me

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Famplab%2Fsnap%2Fissues%2F78%23issuecomment-273905806&data=02%7C01%7Cbolosky%40microsoft.com%7C4def9f33262e4e30f85508d440b30c1b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636204585129443541&sdata=HE3aFR21OYL56E5YF55zZohzZabulG0qaywvtqACvbU%3D&reserved=0, or mute the threadhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA752W85WyhCSRvwV7A_bKhsCd60QuY4ks5rT9cMgaJpZM4Lg2F2&data=02%7C01%7Cbolosky%40microsoft.com%7C4def9f33262e4e30f85508d440b30c1b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636204585129453555&sdata=ObbpYdrmpdGixjsQ%2FE5zjoOASB%2FaxdiV8yUSaC3ROhU%3D&reserved=0.

lpryszcz commented 7 years ago

Dear @bolosky ,

I've added #include <utility> in SNAPLib/stdafx.h and rerun compilation (cd bin/snap && make clean && make), but exactly the same error occurs. Let me know if there is something else I can try.

xhongyi commented 7 years ago

I will investigate into the gcc-6.2 problem. For the time being, can you apt-get install gcc-5.4? Is there a feature that you would prefer with version 6.2? SNAP doesn't use too much of c++-11 or c++-14 features so gcc versions as low as 4.9 should work just fine.

It has happened to me before that the newest gcc had problems and subsequent releases of the same branch resolves the issue. I would recommend use version 5.4 for the time being as it has been proven to work.

Hongyi

On Mon, Jan 23, 2017 at 5:09 AM, Leszek notifications@github.com wrote:

Dear @bolosky https://github.com/bolosky ,

I've added #include in SNAPLib/stdafx.h and rerun compilation (cd bin/snap && make clean && make), but exactly the same error occurs. Let me know if there is something else I can try.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/amplab/snap/issues/78#issuecomment-274446855, or mute the thread https://github.com/notifications/unsubscribe-auth/AD9rdAlZ_A19mmh-V88LlNOO8Z8t2Tz5ks5rVHxPgaJpZM4Lg2F2 .

-- Hongyi Xin

Computer Science Department Carnegie Mellon University 5000 Forbes ave. Pittsburgh PA 15213 http://xinhongyi.me

lpryszcz commented 7 years ago

thanks Hongyi, in meantime I've installed snap through bioconda. it works like charm!

lpryszcz commented 6 years ago

The problem still persists with Ubuntu 18.04 (gcc 7.3.0)

rokyo401 commented 5 years ago

The problem still persists with Ubuntu 18.04 (gcc 7.3.0)

I have the same issue on Ubuntu 18.04 with gcc 7.

The files compile correctly if you compile them individually with the option

-std=c++98
added. I'm sure you can tell gcc to use C++98 for ALL files in the MAKEFILE somehow, but I have no idea how, so I just compiled all .cpp files manually with that option.

This only works up until the file

SNAPLib/Compat.cpp
, though. That file throws a different error, namely:

user@desktop:~/Downloads/snap-master$ g++ -std=c++98 -O3 -Wno-format -MMD -ISNAPLib -msse   -c -o SNAPLib/Compat.o SNAPLib/Compat.cpp
In file included from /usr/include/fcntl.h:290:0,
                 from SNAPLib/stdafx.h:40,
                 from SNAPLib/Compat.cpp:25:
In function ‘int open(const char*, int, ...)’,
    inlined from ‘MemoryMappedFile* OpenMemoryMappedFile(const char*, size_t, size_t, void**, bool, bool)’ at SNAPLib/Compat.cpp:1282:64:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:24: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
    __open_missing_mode ();

Which I don't know how to get rid of ^^

robinengler commented 5 years ago

I had the same problem as @rokyo401 on a centOS 7.x machine with gcc 6.1.1. Adding the -std=c++98 flag fully solved the problem for me. This is how you can apply -std=c++98 to the entire makefile:

CXXFLAGS="-O3 -Wno-format -std=c++98" make

or

export CXXFLAGS="-O3 -Wno-format -std=c++98"
make

or if you want to permanently edit the makefile:

sed -i 's@\(^[[:space:]]*CXXFLAGS = .*\)@\1 -std=c++98@' Makefile
make
rokyo401 commented 5 years ago

I had the same problem as @rokyo401 on a centOS 7.x machine with gcc 6.1.1. Adding the -std=c++98 flag fully solved the problem for me. This is how you can apply -std=c++98 to the entire makefile:

CXXFLAGS="-O3 -Wno-format -std=c++98" make

or

export CXXFLAGS="-O3 -Wno-format -std=c++98"
make

or if you want to permanently edit the makefile:

sed -i 's@\(^[[:space:]]*CXXFLAGS = .*\)@\1 -std=c++98@' Makefile
make

Perfect! Thanks! Putting it in the makefile makes it a lot easier! :)

bolosky commented 5 years ago

I added this to the Makefile in both the main and dev branches.

--Bill

From: rokyo401 notifications@github.com Sent: Thursday, January 10, 2019 3:39 AM To: amplab/snap snap@noreply.github.com Cc: Bill Bolosky bolosky@microsoft.com; Mention mention@noreply.github.com Subject: Re: [amplab/snap] Compiling on Ubuntu 16.10 fails (#78)

I had the same problem as @rokyo401https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frokyo401&data=02%7C01%7Cbolosky%40microsoft.com%7C7a543ff69e6047199ac108d676f02598%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636827171124662458&sdata=BDp%2BBDnGtZxRBGzspNySNztO33LjmAndH9q6LGOOh7s%3D&reserved=0 on a centOS 7.x machine with gcc 6.1.1. Adding the -std=c++98 flag fully solved the problem for me. This is how you can apply -std=c++98 to the entire makefile:

CXXFLAGS="-O3 -Wno-format -std=c++98" make

or

export CXXFLAGS="-O3 -Wno-format -std=c++98"

make

or if you want to permanently edit the makefile:

sed -i 's@(^[[:space:]]CXXFLAGS = .)@\1 -std=c++98@' Makefile

make

Perfect! Thanks! Putting it in the makefile makes it a lot easier! :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Famplab%2Fsnap%2Fissues%2F78%23issuecomment-453066170&data=02%7C01%7Cbolosky%40microsoft.com%7C7a543ff69e6047199ac108d676f02598%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636827171124662458&sdata=hoeQmtkThriA2ga5mWq9pdklZtfrXDNHLPSxmLxh5IA%3D&reserved=0, or mute the threadhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAA752SA2YZ23mSKXWGq1pV4QNEy7jldlks5vByY3gaJpZM4Lg2F2&data=02%7C01%7Cbolosky%40microsoft.com%7C7a543ff69e6047199ac108d676f02598%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636827171124662458&sdata=U40rxClZQUB9i7agq5slZ%2BJOqwBlN4K8PnvDqaDmZjA%3D&reserved=0.

bolosky commented 5 years ago

Closed.