liulab-dfci / TRUST4

TCR and BCR assembly from RNA-seq data
MIT License
272 stars 47 forks source link

GNU C++ compilation issue #308

Open asahama-takara opened 3 weeks ago

asahama-takara commented 3 weeks ago

Hi, we use trust4 v1.0.4 in our Cogent Analysis Pipeline (CogentAP). Recently, one of our clients ran into a compilation error problem while installing trust4 (as part of CogentAP package). Specifically the error happened when the following command was executed:

g++ -O3 -I/path/to/CogentAP_tools/include -L/path/to/CogentAP_tools/lib -c -o main.o main.cpp

And the on-screen output looked something like

^M TRUST4 : \ ^M TRUST4 : md5.c: In function ‘MD5Final’: md5.c:155:26: warning: argument to ‘sizeof’ in ‘memset’ call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess] 155 memset(ctx, 0, sizeof(ctx)); / In case it's sensitive / ^ md5.c: In function ‘MD5Final’: md5.c:155:26: warning: argument to ‘sizeof’ in ‘memset’ call is the same expression as the destination; did you mean to dereference it? [-Wsizeof-pointer-memaccess] 155 memset(ctx, 0, sizeof(ctx)); / In case it's sensitive / ^ ^M TRUST4 : / ^M TRUST4 : - ace2sam.c: In function ‘main’: ace2sam.c:162:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] 162 if (write_cns) puts(t[4].s); t[4].l = 0; ^~ ace2sam.c:162:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 162 if (write_cns) puts(t[4].s); t[4].l = 0; ^ ^M TRUST4 : \ ^M TRUST4 : ^M TRUST4 : / ^M TRUST4 : - ^M TRUST4 : \ ^M TRUST4 : ^M TRUST4 : / ^M TRUST4 : - ^M TRUST4 : \ ^M TRUST4 : ^M TRUST4 : / ^M TRUST4 : - In file included from /usr/local/include/assert.h:5, from SimpleVector.hpp:10, from SeqSet.hpp:12, from main.cpp:12: /usr/local/include/except.h:15:32: error: conflicting declaration ‘typedef struct Except_Frame_T* Except_Frame_T’ 15 typedef struct Except_Frame_T *Except_Frame_T; ^~~~~~ /usr/local/include/except.h:15:16: note: previous declaration as ‘struct Except_Frame_T’ 15 typedef struct Except_Frame_T *Except_Frame_T; ^~~~~~ /usr/local/include/except.h:17:18: error: field ‘prev’ has incomplete type ‘Except_Frame_T’ 17 Except_Frame_T prev; ^~~~ /usr/local/include/except.h:16:8: note: definition of ‘struct Except_Frame_T’ is not complete until the closing brace 16 struct Except_Frame_T { ^~~~~~ In file included from main.cpp:12: SeqSet.hpp: In member function ‘double _overlap::UpdateSimilarity(int, int, int)’: SeqSet.hpp:117:2: warning: no return statement in function returning non-void [-Wreturn-type] 117 } ^ ^M TRUST4 : \ In file included from main.cpp:12: SeqSet.hpp: In member function ‘void SeqSet::BreakFalseAssembly(std::vector<_Read>)’: SeqSet.hpp:7939:27: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘std::vector<_seqWrapper>::size_type’ {aka ‘long unsigned int’} [-Wformat=] 7939 printf( "Break %d to %d.\n", i, seqs.size() - 1 ) ; ~^ ~~~
int std::vector<_seqWrapper>::size_type {aka long unsigned int}
%ld
^M TRUST4 : In file included from main.cpp:11:

KmerCount.hpp: In member function ‘void KmerCount::AddCountFromFile(char)’: KmerCount.hpp:82:10: warning: ignoring return value of ‘int fscanf(FILE, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] 82 | fscanf( fp, "%s", buffer ) ; | ~~^~~~~~~~ make: *** [: main.o] Error 1 ^M TRUST4 : Error Unable to install TRUST4

Is this something you could help with? Thanks and much appreciated.

mourisl commented 3 weeks ago

Do you know which gcc version or system is the client using? I think it is mainly some other module may already create/install the "except.h" file, and the compiler gets conflict versions.

asahama-takara commented 3 weeks ago

@mourisl We have this information

gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

mourisl commented 3 weeks ago

It should work on the ubuntu system with this gcc version. Does any other package on your package also install the except.h file?

asahama-takara commented 3 weeks ago

@mourisl The CogentAP package does set up its conda environment and installs system tools (g++, gcc compilers) inside the directory CogentAP_tools. One location I found the except.h file was CogentAP_tools/lib/gcc/x86_64-conda-linux-gnu/7.5.0/plugin/include/except.h

mourisl commented 3 weeks ago

I think TRUST4 utilized the system gcc to compile the source code and have the access to the system's except.h. However, since you specify CogentAP's header files through -I option, then there are two conflict versions of except.h. Can you force TRUST4 to use the conda's GCC to compile the source code? The system you mentioned has gcc 9.4, and the conda version is 7.5, so I think TRUST4 is compiled by a non-conda gcc.