statgen / ruth

Robust Unified Hardy-Weinberg Equilibrium Test
Apache License 2.0
6 stars 2 forks source link

Trouble compiling RUTH #4

Open ElizabethBlue opened 4 years ago

ElizabethBlue commented 4 years ago

Hi,

Our lab is having trouble installing RUTH, and have tried different gcc compilers and older versions of htslib. We're wondering if it is related to the recent updates to RUTH, but we don't have an older copy to try. I've put the command and error messages below, do you have any advice?

Thanks for your time,

Liz

compiling RUTH

git clone https://github.com/statgen/ruth.git cd ruth mkdir build cd build cmake -DHTS_INCLUDE_DIRS=/home/src/htslib/include/ -DHTS_LIBRARIES=/home/src/htslib/lib/libhts.a .. make

error message:

[  4%] Building CXX object CMakeFiles/ruth.dir/Error.cpp.o In file included from /acct/em27/programs/ruth/Error.cpp:18:0: /acct/em27/programs/ruth/Error.h:36:14: error: variable or field ‘verbose’ declared void  void verbose(int32_t priority, const char msg, ...);               ^ /acct/em27/programs/ruth/Error.h:36:14: error: ‘int32_t’ was not declared in this scope /acct/em27/programs/ruth/Error.h:36:32: error: expected primary-expression before ‘const’  void verbose(int32_t priority, const char msg, ...);                                 ^ /acct/em27/programs/ruth/Error.h:36:50: error: expected primary-expression before ‘...’ token  void verbose(int32_t priority, const char * msg, ...);                                                   ^ /acct/em27/programs/ruth/Error.h:39:8: error: ‘int32_t’ does not name a type  extern int32_t globalVerbosityThreshold;         ^ make[2]: [CMakeFiles/ruth.dir/Error.cpp.o] Error 1 make[1]: [CMakeFiles/ruth.dir/all] Error 2 make: *** [all] Error 2

amkwong commented 4 years ago

Hi,

From what I can see, it looks like the error is caused by a difference in compiler implementation in your system, where it does not include the

library as part of #include in the declared header in Error.h -- which you may be able to fix quickly by adding the line #include in Error.h, in a new line after #include . I think this should fix the listed compilation problem. Please let us know if that works, and if you see any further compilation errors. We will try to update RUTH to solve those problems as they pop up, so it will be useful to hear whether this addition fixes your problem. Thank you, -Alan On Fri, Oct 23, 2020 at 12:47 PM ElizabethBlue wrote: > Hi, > > Our lab is having trouble installing RUTH, and have tried different gcc > compilers and older versions of htslib. We're wondering if it is related to > the recent updates to RUTH, but we don't have an older copy to try. I've > put the command and error messages below, do you have any advice? > > Thanks for your time, > > Liz > compiling RUTH > > git clone https://github.com/statgen/ruth.git > cd ruth > mkdir build > cd build > cmake -DHTS_INCLUDE_DIRS=/home/src/htslib/include/ > -DHTS_LIBRARIES=/home/src/htslib/lib/libhts.a .. > make > > error message: > > [ 4%] Building CXX object CMakeFiles/ruth.dir/Error.cpp.o > In file included from /acct/em27/programs/ruth/Error.cpp:18:0: > /acct/em27/programs/ruth/Error.h:36:14: error: variable or field ‘verbose’ > declared void > void verbose(int32_t priority, const char * msg, ...); > ^ > /acct/em27/programs/ruth/Error.h:36:14: error: ‘int32_t’ was not declared > in this scope > /acct/em27/programs/ruth/Error.h:36:32: error: expected primary-expression > before ‘const’ > void verbose(int32_t priority, const char * msg, ...); > ^ > /acct/em27/programs/ruth/Error.h:36:50: error: expected primary-expression > before ‘...’ token > void verbose(int32_t priority, const char * msg, ...); > ^ > /acct/em27/programs/ruth/Error.h:39:8: error: ‘int32_t’ does not name a > type > extern int32_t globalVerbosityThreshold; > ^ > make[2]: *** [CMakeFiles/ruth.dir/Error.cpp.o] Error 1 > make[1]: *** [CMakeFiles/ruth.dir/all] Error 2 > make: *** [all] Error 2 > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > , or unsubscribe > > . >
ElizabethBlue commented 4 years ago

Thank you for your quick reply!

We amended the Error.h file and compiled the program, but then another error came up, and the compilation stopped. I've pasted the error message below, for what it is worth.

/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

It looks like there are multiple differences between our compilers. Can you send me more information on the compilers/compiler settings you are using so I can try to mimic them here?

Thanks again,

Liz

hyunminkang commented 4 years ago

Please edit CMakeLists.txt from

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -pthread")

to

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -pthread")

and redo the compilation, and it will work ok. Some version of cmake/compiler compilations may not recognize CXX_STANDARD correctly.

Hyun.

On Mon, Oct 26, 2020 at 3:06 PM ElizabethBlue notifications@github.com wrote:

Thank you for your quick reply!

We amended the Error.h file and compiled the program, but then another error came up, and the compilation stopped. I've pasted the error message below, for what it is worth.

/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

It looks like there are multiple differences between our compilers. Can you send me more information on the compilers/compiler settings you are using so I can try to mimic them here?

Thanks again,

Liz

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/statgen/ruth/issues/4#issuecomment-716761158, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPY5OMXWI3KC6LSOEES2H3SMXCCBANCNFSM4S4ZKI3A .

ElizabethBlue commented 4 years ago

Thanks for your quick reply! In good news, we made some progress with the compilation. In bad news, we encountered another error. Looks like the compiler is grumpy about the forward declaration of faidx_t? Please see below for details.

[ 43%] Building CXX object CMakeFiles/ruth.dir/hts_utils.cpp.o In file included from /home/temp/ruth/ruth/ruth-master/hts_utils.h:43:0, from /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:24: /home/temp/ruth/ruth/ruth-master/hts_utils.cpp: In function ‘char faidx_fetch_uc_seq(const faidx_t, const char, int, int, int)’: /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:51:25: error: invalid use of incomplete type ‘const faidx_t {aka const struct faidx_t}’ iter = kh_get(s, fai->hash, c_name); ^ /home/src/htslib/include/htslib/khash.h:511:42: note: in definition of macro ‘kh_get’

define kh_get(name, h, k) khget##name(h, k)

                                      ^

In file included from /home/temp/ruth/ruth/ruth-master/hts_utils.h:48:0, from /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:24: /home/src/htslib/include/htslib/faidx.h:69:8: error: forward declaration of ‘const faidx_t {aka const struct faidx_t}’ struct faidx_t; ^ In file included from /home/temp/ruth/ruth/ruth-master/hts_utils.h:43:0, from /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:24: /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:52:26: error: invalid use of incomplete type ‘const faidx_t {aka const struct faidx_t}’ if(iter == kh_end(fai->hash)) return 0; ^ /home/src/htslib/include/htslib/khash.h:563:21: note: in definition of macro ‘kh_end’

define kh_end(h) ((h)->n_buckets)

                 ^

In file included from /home/temp/ruth/ruth/ruth-master/hts_utils.h:48:0, from /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:24: /home/src/htslib/include/htslib/faidx.h:69:8: error: forward declaration of ‘const faidx_t {aka const struct faidx_t}’ struct faidx_t; ^ In file included from /home/temp/ruth/ruth/ruth-master/hts_utils.h:43:0, from /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:24: /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:53:23: error: invalid use of incomplete type ‘const faidx_t {aka const struct faidx_t}’ val = kh_value(fai->hash, iter); ^ /home/src/htslib/include/htslib/khash.h:549:26: note: in definition of macro ‘kh_value’

define kh_value(h, x) ((h)->vals[x])

                      ^

In file included from /home/temp/ruth/ruth/ruth-master/hts_utils.h:48:0, from /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:24: /home/src/htslib/include/htslib/faidx.h:69:8: error: forward declaration of ‘const faidx_t {aka const struct faidx_t}’ struct faidx_t; ^ /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:61:29: error: invalid use of incomplete type ‘const faidx_t {aka const struct faidx_t}’ int ret = bgzf_useek(fai->bgzf, val.offset + p_beg_i / val.line_blen * val.line_len + p_beg_i % val.line_blen, SEEK_SET); ^ In file included from /home/temp/ruth/ruth/ruth-master/hts_utils.h:48:0, from /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:24: /home/src/htslib/include/htslib/faidx.h:69:8: error: forward declaration of ‘const faidx_t {aka const struct faidx_t}’ struct faidx_t; ^ /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:70:29: error: invalid use of incomplete type ‘const faidx_t {aka const struct faidx_t}’ while ( (c=bgzf_getc(fai->bgzf))>=0 && l < p_end_i - p_beg_i + 1) ^ In file included from /home/temp/ruth/ruth/ruth-master/hts_utils.h:48:0, from /home/temp/ruth/ruth/ruth-master/hts_utils.cpp:24: /home/src/htslib/include/htslib/faidx.h:69:8: error: forward declaration of ‘const faidx_t {aka const struct faidx_t}’ struct faidx_t; ^ make[2]: [CMakeFiles/ruth.dir/hts_utils.cpp.o] Error 1 make[1]: [CMakeFiles/ruth.dir/all] Error 2 make: *** [all] Error 2

hyunminkang commented 4 years ago

Are you sure that you are using the latest versions of htslib and ruth? You may encounter such problems if one of the versions are outdated.

ElizabethBlue commented 4 years ago

Thanks again for your patience and interest in helping to resolve this problem.

I'm using htslib-1.11 and a version of ruth download using this command on Oct 23rd:

git clone https://github.com/statgen/ruth.git

Another person in my group has run into the same errors on a different machine using a ruth download dated Oct 19th. Just for fun, I deleted my htslib and ruth files, and just performed a fresh installation, using these commands:

Installing htslib

wget https://github.com/samtools/htslib/releases/download/1.11/htslib-1.11.tar.bz2 tar jxvf htslib-1.11.tar.bz2 cd htslib-1.11vim ./configure --prefix=/home/src/htslib make make install

Compiling RUTH

git clone https://github.com/statgen/ruth.git cd ruth mkdir build cd build cmake -DHTS_INCLUDE_DIRS=/home/src/htslib/include/ -DHTS_LIBRARIES=/home/src/htslib/lib/libhts.a .. make

I ran into the same errors we've discussed before, applied the same solutions you recommended, and came to the same error I described three days ago.

I then moved the files that changed fifteen days ago into a separate directory, manually downloaded their replacements from github to make sure I had the latest versions,, and end at nearly the same error described three days ago:

[ 39%] Building CXX object CMakeFiles/ruth.dir/hts_utils.cpp.o In file included from /acct/em27/programs/ruth/hts_utils.h:43:0, from /acct/em27/programs/ruth/hts_utils.cpp:24: /acct/em27/programs/ruth/hts_utils.cpp: In function ‘char faidx_fetch_uc_seq(const faidx_t, const char, int, int, int)’: /acct/em27/programs/ruth/hts_utils.cpp:51:25: error: invalid use of incomplete type ‘const faidx_t {aka const struct faidx_t}’ iter = kh_get(s, fai->hash, c_name); ^ /home/src/htslib/include/htslib/khash.h:511:42: note: in definition of macro ‘kh_get’

define kh_get(name, h, k) khget##name(h, k)

                                      ^

In file included from /acct/em27/programs/ruth/hts_utils.h:48:0, from /acct/em27/programs/ruth/hts_utils.cpp:24: /home/src/htslib/include/htslib/faidx.h:69:8: error: forward declaration of ‘const faidx_t {aka const struct faidx_t}’ struct faidx_t; ^ In file included from /acct/em27/programs/ruth/hts_utils.h:43:0, from /acct/em27/programs/ruth/hts_utils.cpp:24: /acct/em27/programs/ruth/hts_utils.cpp:52:26: error: invalid use of incomplete type ‘const faidx_t {aka const struct faidx_t}’ if(iter == kh_end(fai->hash)) return 0; ^ /home/src/htslib/include/htslib/khash.h:563:21: note: in definition of macro ‘kh_end’

define kh_end(h) ((h)->n_buckets)

                 ^

In file included from /acct/em27/programs/ruth/hts_utils.h:48:0, from /acct/em27/programs/ruth/hts_utils.cpp:24: /home/src/htslib/include/htslib/faidx.h:69:8: error: forward declaration of ‘const faidx_t {aka const struct faidx_t}’ struct faidx_t; ^ In file included from /acct/em27/programs/ruth/hts_utils.h:43:0, from /acct/em27/programs/ruth/hts_utils.cpp:24: /acct/em27/programs/ruth/hts_utils.cpp:53:23: error: invalid use of incomplete type ‘const faidx_t {aka const struct faidx_t}’ val = kh_value(fai->hash, iter); ^ /home/src/htslib/include/htslib/khash.h:549:26: note: in definition of macro ‘kh_value’

define kh_value(h, x) ((h)->vals[x])

                      ^

In file included from /acct/em27/programs/ruth/hts_utils.h:48:0, from /acct/em27/programs/ruth/hts_utils.cpp:24: /home/src/htslib/include/htslib/faidx.h:69:8: error: forward declaration of ‘const faidx_t {aka const struct faidx_t}’ struct faidx_t; ^ /acct/em27/programs/ruth/hts_utils.cpp:61:29: error: invalid use of incomplete type ‘const faidx_t {aka const struct faidx_t}’ int ret = bgzf_useek(fai->bgzf, val.offset + p_beg_i / val.line_blen * val.line_len + p_beg_i % val.line_blen, SEEK_SET); ^ In file included from /acct/em27/programs/ruth/hts_utils.h:48:0, from /acct/em27/programs/ruth/hts_utils.cpp:24: /home/src/htslib/include/htslib/faidx.h:69:8: error: forward declaration of ‘const faidx_t {aka const struct faidx_t}’ struct faidx_t; ^ /acct/em27/programs/ruth/hts_utils.cpp:70:29: error: invalid use of incomplete type ‘const faidx_t {aka const struct faidx_t}’ while ( (c=bgzf_getc(fai->bgzf))>=0 && l < p_end_i - p_beg_i + 1) ^ In file included from /acct/em27/programs/ruth/hts_utils.h:48:0, from /acct/em27/programs/ruth/hts_utils.cpp:24: /home/src/htslib/include/htslib/faidx.h:69:8: error: forward declaration of ‘const faidx_t {aka const struct faidx_t}’ struct faidx_t; ^ make[2]: [CMakeFiles/ruth.dir/hts_utils.cpp.o] Error 1 make[1]: [CMakeFiles/ruth.dir/all] Error 2 make: *** [all] Error 2

hyunminkang commented 4 years ago

I made some changes to avoid possible errors, and I also think you need to run cmake with different configurations

cmake -DHTS_INCLUDE_DIRS=/home/src/htslib/ -DHTS_LIBRARIES=/home/src/htslib/libhts.a ..

ElizabethBlue commented 4 years ago

Hi Hyun,

We downloaded your new files this morning and have successfully compiled RUTH on multiple machines!!! Thank you again for all your help with this, I really appreciate it.

Best, Liz