This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Installing Bam-Readcount

I'm installing bam-readcount for my analysis. However, when I came to the last step in executing the command "make", error appeared as:

bamreadcount.cpp:4:17: fatal error: sam.h: No such file or directory compilation terminated.

make[2]: * [build/src/exe/bam-readcount/CMakeFiles/bam-readcount.dir/bamreadcount.cpp.o] Error 1

make[1]: * [build/src/exe/bam-readcount/CMakeFiles/bam-readcount.dir/all] Error 2

make: * [all] Error 2

Could anyone advice on how to proceed?

Thanks

3 answers

Hi,

I'm trying to install bam-readcount too. I followed the instructions but i keep getting an error at the last step: 'make' after the cmake command. Until that everything works fine.

The error appears as:

/home/schwessi/samtools-0.1.19/libbam.a(bgzf.o): In function `bgzf_mt':
/home/schwessi/samtools-0.1.19/bgzf.c:445: undefined reference to `pthread_create'
/home/schwessi/samtools-0.1.19/libbam.a(bgzf.o): In function `mt_destroy':
/home/schwessi/samtools-0.1.19/bgzf.c:458: undefined reference to `pthread_join'
collect2: ld returned 1 exit status
make[2]: *** [bin/bam-readcount] Error 1
make[1]: *** [build/src/exe/bam-readcount/CMakeFiles/bam-readcount.dir/all] Error 2
make: *** [all] Error 2

Any advice would be nice.

Thanks
Ron

Nevermind, fixed the problem. Apparently the installion doesnt work with samtools 0.1.19. Tried 0.1.17 and it worked.

Thanks for letting us know. I'll update the README to mention that 0.1.19 may not work.

I updated the code to always link the platform threading library (pthreads on linux), so this shouldn't be an issue in the future.

The error message is complaining that you have not included the samtools library header (sam.h). Follow these instructions, and see if they help.

I have followed the instructions but seems have problem linking with samtools

To help us troubleshoot, please provide more information:

  • your operating system version
  • the sequence of steps performed before running make

It is ubuntu linux (Linux version 3.2.0-26-generic (buildd@batsu) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #41-Ubuntu SMP Thu Jun 14 17:49:24 UTC 2012).

I just follow the instruction of bam-readcount. After exporting SAMTOOLS_ROOT, I recursively clone the bam-readcount repository without error.

When I execute the cmake command, there was a warning:

WARNING: Target "bam-readcount" requests linking to directory "/software/sequencing/samtools_latest".  Targets may link only to libraries.  CMake is dropping the item.

When I further execute the make command, error appeared as:

[100%] Building CXX object build/src/exe/bam-readcount/CMakeFiles/bam-readcount.dir/bamreadcount.cpp.o
/home/danielho/bam-readcount/src/exe/bam-readcount/bamreadcount.cpp:1:0: warning: "_GNU_SOURCE" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
/home/danielho/bam-readcount/src/exe/bam-readcount/bamreadcount.cpp:4:17: fatal error: sam.h: No such file or directory
compilation terminated.
make[2]: *** [build/src/exe/bam-readcount/CMakeFiles/bam-readcount.dir/bamreadcount.cpp.o] Error 1
make[1]: *** [build/src/exe/bam-readcount/CMakeFiles/bam-readcount.dir/all] Error 2
make: *** [all] Error 2

Can you append to your reply what you are setting SAMTOOLS_ROOT to and what the contents are, e.g. ls $SAMTOOLS_ROOT.

export SAMTOOLS_root=/software/sequencing/samtools_latest

The contents are:

AUTHORS   ChangeLog  examples  Makefile        misc  samtools    win32
bcftools  COPYING    INSTALL   Makefile.mingw  NEWS  samtools.1

I believe you should see sam.h in SAMTOOLS_ROOT so I suspect you may need to set it as, export SAMTOOLS_ROOT=/software/sequencing/samtools_latest/samtools.

Log in to answer this question.