Question: Cannot build cufflinks 2.2.1 from source (possible problem with samtools 1.3.1)
gravatar for jp
4.5 years ago by
jp110 wrote:

Platform Ubuntu 16.04

I followed all the instructions in and I am pretty sure this isn't something huge. I am using samtools 1.3.1. In the include dir for samtools I had to copy the htslib dir (from samtools_instalation/htslib-1.3.1/) as bam/sam.h in samtools/include contains an include to htslib/sam.h. I have added the library libhts.a in samtools/lib (together with libbam.a)

I export (--with-eigen= doesn't seem to work)

export EIGEN_CPPFLAGS="-I/opt/eigen3"

I configure

./configure --prefix=/opt/cufflinks-2.2.1 --with-boost=/opt/boost_1_61_0 --with-bam=/opt/samtools-1.3.1

Which gives me the following:

  C++ compiler:        g++ -Wall -Wno-strict-aliasing -g -gdwarf-2 -Wunused -Wuninitialized -ftemplate-depth-1024 -m64 -O3  -DNDEBUG  -pthread -I/opt/boost_1_61_0/include -I/opt/samtools-1.3.1/include -I/opt/eigen3/include  
  GCC version:         gcc (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413
  Host System type:    x86_64-unknown-linux-gnu
  Install prefix:      /opt/cufflinks-2.2.1
  Install eprefix:     ${prefix}

and I make (and after a ton of warnings) - I get to this error

g++  -Wall -Wno-strict-aliasing -g -gdwarf-2 -Wunused -Wuninitialized -ftemplate-depth-1024 -m64 -O3  -DNDEBUG  -pthread -I/opt/boost_1_61_0/include -I/opt/samtools-1.3.1/include -I/opt/eigen3   -o cufflinks  -L/opt/boost_1_61_0/lib -L/opt/samtools-1.3.1/lib  cufflinks.o libcufflinks.a libgc.a -lboost_thread -lboost_system  -lboost_serialization  -lbam  -lz 
libcufflinks.a(hits.o): In function `samread':
/opt/samtools-1.3.1/include/bam/sam.h:95: undefined reference to `sam_read1'
libcufflinks.a(hits.o): In function `BAMHitFactory::get_hit_from_buf(char const*, ReadHit&, bool, char*, char*)':
/home/jp/Downloads/installations/cufflinks-2.2.1/src/hits.cpp:557: undefined reference to `bam_aux_get'
/home/jp/Downloads/installations/cufflinks-2.2.1/src/hits.cpp:560: undefined reference to `bam_aux2A'
/home/jp/Downloads/installations/cufflinks-2.2.1/src/hits.cpp:567: undefined reference to `bam_aux_get'
/home/jp/Downloads/installations/cufflinks-2.2.1/src/hits.cpp:570: undefined reference to `bam_aux2i'
/home/jp/Downloads/installations/cufflinks-2.2.1/src/hits.cpp:573: undefined reference to `bam_aux_get'
/home/jp/Downloads/installations/cufflinks-2.2.1/src/hits.cpp:576: undefined reference to `bam_aux2i'
/home/jp/Downloads/installations/cufflinks-2.2.1/src/hits.cpp:580: undefined reference to `bam_aux_get'
/home/jp/Downloads/installations/cufflinks-2.2.1/src/hits.cpp:583: undefined reference to `bam_aux2i'
libcufflinks.a(hits.o): In function `BAMHitFactory::undo_hit()':

Note that method sam_read1 is commented out in samtools header ./bam/bam.h line 224, it is called from ./bam/sam.h line 95 and is declared in (samtools/include) htslib/sam.h line 365.

~/Downloads/installations/samtools-1.3.1/bam.h:224:    // int sam_read1(tamFile fp, bam_header_t *header, bam1_t *b);
~/Downloads/installations/samtools-1.3.1/htslib-1.3.1/htslib/sam.h:365:    int sam_read1(samFile *fp, bam_hdr_t *h, bam1_t *b) HTS_RESULT_USED;
~/Downloads/installations/samtools-1.3.1/htslib-1.3.1/sam.c:1030:int sam_read1(htsFile *fp, bam_hdr_t *h, bam1_t *b)

Can someone shed some light on this please? Or try to point me in the right direction? How to I get this to build?

ADD COMMENTlink modified 3.7 years ago by Biostar ♦♦ 20 • written 4.5 years ago by jp110

Try samtools-0.1.19, or better yet just download the precompiled version of cufflinks.

ADD REPLYlink written 4.5 years ago by Devon Ryan97k

Your suggested change in samtools version (1.3.1 -> 0.1.19) helped! Finally it compiled (not without a lot of other tweaking). For posterity, I recorded the whole process here:

ADD REPLYlink modified 4.4 years ago • written 4.4 years ago by jp110

The link doesn't working : (

ADD REPLYlink written 5 months ago by sina.majidian0

Add -lhts to that link command to satisfy all those undefined references. It is a pity that cufflinks still requires ancient samtools; ideally it would be updated to use HTSlib directly (

And I see you also filed this build failure as .

ADD REPLYlink written 4.1 years ago by John Marshall2.1k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 670 users visited in the last hour