This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Trouble Installing Bamtools On Ubuntu

I'm not sure if BioStars is the place to post this type of question, please let me know if I should have put it elsewhere.

I'm running Ubuntu 11.10 and am trying to install BAMTools.

I'm following the instructions but I seem to be getting a CMake error when running the 'Make' command:

> [  4%] Building CXX object
> src/api/CMakeFiles/BamTools.dir/BamReader.cpp.o In file included from
> /home/karen1/Downloads/bamtools-1.0.2/src/api/internal/BamReader_p.h:29:0,
>                  from /home/karen1/Downloads/bamtools-1.0.2/src/api/BamReader.cpp:11:
> /home/karen1/Downloads/bamtools-1.0.2/src/api/internal/BgzfStream_p.h:27:18:
> fatal error: zlib.h: No such file or directory compilation terminated.
> make[2]: *** [src/api/CMakeFiles/BamTools.dir/BamReader.cpp.o] Error 1
> make[1]: *** [src/api/CMakeFiles/BamTools.dir/all] Error 2 make: ***
> [all] Error 2

I saw this issue was posted previously and tried following the instructions by editing 'bamtools/src/api/CMakeLists.txt' and adding the line 'includedirectories(usr/lib/syslinux/com32/include)', which contains a zlib.h file, under the existing 'includedirectories' line (is zlib.h a system file? I saw several copies when I ran a search).

I ran 'Make' again and got a similar error at 7%:

> [  7%] Building CXX object
> src/api/CMakeFiles/BamTools.dir/BamReader.cpp.o In file included from
> /home/karen1/Downloads/bamtools-1.0.2/src/api/internal/BamReader_p.h:29:0,
>                  from /home/karen1/Downloads/bamtools-1.0.2/src/api/BamReader.cpp:11:
> /home/karen1/Downloads/bamtools-1.0.2/src/api/internal/BgzfStream_p.h:27:18:
> fatal error: zlib.h: No such file or directory compilation terminated.
> make[2]: *** [src/api/CMakeFiles/BamTools.dir/BamReader.cpp.o] Error 1
> make[1]: *** [src/api/CMakeFiles/BamTools.dir/all] Error 2 make: ***
> [all] Error 2 [1]+  Done                    gedit
> ../src/api/CMakeLists.txt

I'm clueless at this point. Any help or redirection to help would be appreciated.

Try 'sudo apt-get install build-essential' and check if you have kernel headers installed.

2 answers

You need zlib development headers, which are not installed by default (just the runtime library is typically installed).

On ubuntu: sudo apt-get install libz-dev

Don't hack the Makefile to use the syslinux version, as it may vary from the /usr/lib/libz.so implementation being linked to - the header must match the library.

this solved it for me. Thanks!

check that the zlib library and its developpement files (e.g. /usr/include/zlib.h or /usr/local/include/zlib.h ) is installed on your computer. http://zlib.net/

Log in to answer this question.