Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System-wide htslib can fail linkage #26

Open
bricoletc opened this issue May 6, 2020 · 1 comment
Open

System-wide htslib can fail linkage #26

bricoletc opened this issue May 6, 2020 · 1 comment

Comments

@bricoletc
Copy link
Collaborator

When running make NUM_COLS=1 cortex_var I got the following:

mkdir -p bin; gcc -Iinclude/cortex_var/core -Iinclude/basic -Iinclude/hash_table -Iinclude/cortex_var/many_colours -Iinclude/basic/event_encoding/base_encoding -L/usr/local/lib -Ilibs/htslib/htslib -Ilibs/seq_file -Ilibs/string_buffer -Llibs/htslib/htslib -Llibs/seq_file -Llibs/string_buffer -O3 -m64 -Wall  -DVERSION_STR='""' -DNUMBER_OF_BITFIELDS_IN_BINARY_KMER=1 -DNUMBER_OF_COLOURS=1   -o bin/cortex_var_""31"_c"1 src/obj/cortex_var/many_colours/genotyping_element.o src/obj/cortex_var/many_colours/little_hash_for_genotyping.o src/obj/cortex_var/many_colours/model_info.o src/obj/cortex_var/many_colours/genome_complexity.o src/obj/cortex_var/many_colours/global.o src/obj/cortex_var/many_colours/db_complex_genotyping.o src/obj/cortex_var/many_colours/cortex_var.o src/obj/cortex_var/many_colours/binary_kmer.o src/obj/cortex_var/many_colours/element.o src/obj/cortex_var/many_colours/seq.o src/obj/cortex_var/many_colours/hash_value.o src/obj/cortex_var/many_colours/hash_table.o src/obj/cortex_var/many_colours/dB_graph.o src/obj/cortex_var/many_colours/dB_graph_population.o src/obj/cortex_var/many_colours/dB_graph_supernode.o  src/obj/cortex_var/many_colours/db_variants.o src/obj/cortex_var/many_colours/cmd_line.o src/obj/cortex_var/many_colours/event_encoding.o src/obj/cortex_var/many_colours/graph_info.o src/obj/cortex_var/many_colours/db_differentiation.o src/obj/cortex_var/many_colours/model_selection.o src/obj/cortex_var/many_colours/maths.o src/obj/cortex_var/many_colours/seq_error_rate_estimation.o src/obj/cortex_var/many_colours/file_reader.o src/obj/cortex_var/many_colours/error_correction.o -lseqfile -lstrbuf -lhts -lpthread -lz -lm
libs/seq_file/libseqfile.a(seq_file.o): In function `seq_file_close':
seq_file.c:(.text+0xeae): undefined reference to `bam_hdr_destroy'
collect2: error: ld returned 1 exit status

On a system with an installation of htslib 1.10.2 system wide, in /usr/local/lib and /bin. I suspected cortex was linking against that installation not the bundled htslib. Indeed if you remove

-L /usr/local/lib from the top-level Makefile it then compiles fine. I think if we just put that at the end of

# Add -L/usr/local/lib/ to satisfy some systems that struggle to link libz
LIBINCS = -L/usr/local/lib -I$(IDIR_BAM) \
          -I$(IDIR_SEQ) -I$(IDIR_STRS)  \
          -L$(IDIR_BAM) -L$(IDIR_SEQ) -L$(IDIR_STRS)

in the Makefile, instead of beginning, it should be fine.

@carolynzy
Copy link

Thanks! Your post saved me a lot time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants