Yandell-Lab/VVP-pub

can't build with gcc

brentp opened this issue · 7 comments

I was able to build this with clang, but building with gcc (v 5.4.0) fails with the messages below.

CMakeFiles/VVP.dir/score_variants.c.o: In function `main':
score_variants.c:(.text+0xf1c): undefined reference to `gzdopen'
score_variants.c:(.text+0xf39): undefined reference to `gzopen'
score_variants.c:(.text+0x1076): undefined reference to `gzgets'
score_variants.c:(.text+0x111a): undefined reference to `gzgets'
CMakeFiles/VVP.dir/score_variant.c.o: In function `compute_score':
score_variant.c:(.text+0x175): undefined reference to `log'
score_variant.c:(.text+0x198): undefined reference to `log'
score_variant.c:(.text+0x1ab): undefined reference to `log'
score_variant.c:(.text+0x1ce): undefined reference to `log'
score_variant.c:(.text+0x1e1): undefined reference to `log'
CMakeFiles/VVP.dir/score_variant.c.o:score_variant.c:(.text+0x204): more undefined references to `log' follow
CMakeFiles/VVP.dir/parse_vcf.c.o: In function `parse_allele_frequency_line':
parse_vcf.c:(.text+0x4661): undefined reference to `gsl_rng_env_setup'
parse_vcf.c:(.text+0x4668): undefined reference to `gsl_rng_taus'
parse_vcf.c:(.text+0x4670): undefined reference to `gsl_rng_alloc'
parse_vcf.c:(.text+0x46a7): undefined reference to `gsl_rng_uniform_int'
parse_vcf.c:(.text+0x47ad): undefined reference to `gsl_rng_uniform_int'
parse_vcf.c:(.text+0x48ad): undefined reference to `gsl_rng_uniform_int'
parse_vcf.c:(.text+0x49a4): undefined reference to `gsl_rng_uniform_int'
parse_vcf.c:(.text+0x4a7a): undefined reference to `gsl_rng_free'
collect2: error: ld returned 1 exit status
CMakeFiles/VVP.dir/build.make:250: recipe for target 'VVP' failed
make[2]: *** [VVP] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/VVP.dir/all' failed
make[1]: *** [CMakeFiles/VVP.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

It looks like you need to install zlib and the gsl (gnu scientific library) prior to building. If you are on red hat / centos it should be as easy as yum install for both

those are both installed. this builds fine for me with the same machine with clang, just not with gcc.

I noticed that you don't include, e.g. zlib.h in some of those files. I think that might be the culprit as newer versions of gcc are more strict about that.

Huh. I just built with gcc v4.4.7 (older version of gcc) from scratch just to double check and it builds just fine. zlib.h is actually included in all of those files, it is included in vvp_headers.h which is in turn included by these files. If you have different compilers on the particular machine you are trying to build, are you sure zlib.h and the gsl header directory is in your compiler header search path?

yeah. it's in /usr/include/ and as you can imagine, I build stuff that depends on zlib all the time with GCC. This is not a pressing issue as I got it to build with clang, just wanted to let you know.

for sure, thanks for letting me know about this issue. I'll give the build a try on a system with gcc 5.4 and see if I can replicate the problem

Hi Brent, I just pushed the solution to this build issue. I ended up writing a simple makefile (in place of cmake) and rearranged some of the arguments for gcc 5.4.0 and now its building great with gcc 5.4.0, 4.4.7 and with clang (after commenting out the -fopenmp flag). FWIW -- building with gcc 5.4.0 I was on an ubuntu machine and ended up installing zlib from source.

thank you.