Skip to content

System-wide htslib can fail linkage #26

Description

@bricoletc

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions