staden-2.0.0b4 compilation error: samtools

2010-02-04
2013-04-18
  • I attempted to compile the Staden package on a machine with
    Centos 5.3, x86_64, Kernel 2.6.18-164.11.1.el5xen

    last lines of
    ../configure -with-samtools=/opt/samtools-0.1.7a

    External packages used:
    curl:      via /usr/bin/curl-config
    zlib:      DIR (system)
    liblzma:   DIR
    samtools:  DIR /opt/samtools-0.1.7a
    io_lib:    via /usr/local/bin/staden-io_lib-config
    Tcl:       via /usr/lib64/tclConfig.sh
    Tk:        via /usr/lib64/tkConfig.sh
    tklib:     /usr/share/tklib0.4
    Iwidgets:  /usr/share/iwidgets4.0.1
    Itcl:      /usr/lib64/itcl3.3
    Itk:       /usr/lib64/itk3.3

    bu then make fails with

    /usr/bin/ld: /opt/samtools-0.1.7a/libbam.a(bam_import.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
    /opt/samtools-0.1.7a/libbam.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make: ***  Error 1
    make: Leaving directory `/opt/staden-2.0.0b4-src/build.morogoro/gap5'
    make: ***  Error 2

    any help? thanks!

     
  • James Bonfield
    James Bonfield
    2010-02-05

    This stems from a problem of how samtools was built. You will need to rebuild samtools after adding -fPIC to its Makefile (and doing a full rebuild). The problem arises because I link against samtools from within a dynamic library rather than an application, so it has to be code that is relocatable. (The PIC here refers to Position Independent Code.)

    I'll add a note to this effect in the Staden Package README file.

    James

     
  • André Bertran
    André Bertran
    2010-03-18

    Hy,

    I'm also having trouble with samtools. I have extracted the gz.tar file and moved it to /opt/samtools-0.1.7_x86_64-linux/. Then I used ./configure -with-samtools=/opt/samtools-0.1.7_x86_64-linux/ and the result is:

    External packages used:
    curl:      via /usr/local/bin/curl-config
    zlib:      DIR (system)
    liblzma:   DIR
    samtools:  ***NOT FOUND***
    io_lib:    via /usr/local/bin/io_lib-config
    Tcl:       via /opt/ActiveTcl-8.5/lib/tclConfig.sh
    Tk:        via /opt/ActiveTcl-8.5/lib/tkConfig.sh
    tklib:     /usr/share/tcltk/tklib0.5
    Iwidgets:  /usr/share/tcltk/iwidgets4.0.1
    Itcl:      /usr/share/tcltk/itcl3.2
    Itk:       /usr/share/tcltk/itk3.2

    I didn't even run make yet, because I want to have all necessary optional software so I can use Staden in its full functionality.

    Can anyone help me, please?

    Thank you!

     
  • James Bonfield
    James Bonfield
    2010-03-19

    I assume samtools has been built too?

    Because it's a bit unsure whether the -with-samtools refers to an installation root (like /usr/local) or a compilation root, the configure script tries both. From my config.log produced using a -with-samtools=/nfs/disk54/badger/packages/samtools-0.1.7a:

    configure:6023: gcc -o conftest -g -O2  -I/include -I/nfs/users/nfs_j/jkb/sys/x86_64/include -I/include -I/nfs/disk54/badger/packages/samtools-0.1.7a/include  -L/lib -L/nfs/disk54/badger/packages/samtools-0.1.7a/lib -lbam -lz conftest.c  >&5
    /usr/bin/ld: cannot find -lbam


    configure:6267: gcc -o conftest -g -O2  -I/include -I/nfs/users/nfs_j/jkb/sys/x86_64/include -I/include -I/nfs/disk54/badger/packages/samtools-0.1.7a  -L/lib -L/nfs/disk54/badger/packages/samtools-0.1.7a -lbam -lz conftest.c  >&5
    /tmp/ccqxgheA.o: In function `main': /nfs/users/nfs_j/jkb/staden/trunk/src/build.seq1q/conftest.c:47: undefined reference to `bam_header_read'


    configure:6267: gcc -o conftest -g -O2  -I/include -I/nfs/users/nfs_j/jkb/sys/x86_64/include -I/include -I/nfs/disk54/badger/packages/samtools-0.1.7a  -L/lib -L/nfs/disk54/badger/packages/samtools-0.1.7a -lbam -lz conftest.c -lbam   >&5
    configure:6273: $? = 0
    configure:6301: result: -lbam
    configure:6316: checking bam.h usability
    configure:6333: gcc -c -g -O2  -I/include -I/nfs/users/nfs_j/jkb/sys/x86_64/include -I/include -I/nfs/disk54/badger/packages/samtools-0.1.7a conftest.c >&5
    configure:6339: $? = 0
    configure:6353: result: yes
    configure:6357: checking bam.h presence
    configure:6372: gcc -E  -I/include -I/nfs/users/nfs_j/jkb/sys/x86_64/include -I/
    include -I/nfs/disk54/badger/packages/samtools-0.1.7a conftest.c
    configure:6378: $? = 0
    configure:6392: result: yes
    configure:6420: checking for bam.h
    configure:6427: result: yes
    configure:6687: checking if samtools version >= 0.1.3
    configure:6712: result: yes

    (ie success on the last try, in this case using the -with directory as the location as a samtools build directory rather than install prefix.)

    Can you look through the config.log please to see if it gives indications of what's missing?