samtools 1.2 compile fail - Mac
2
0
Entering edit mode
9.8 years ago
Mike Axtell ▴ 250

I am failing to compile samtools 1.2 on a Mac Desktop. Following INSTALL instructions, I am simply calling 'make' to compile, but if fails. The funny thing is, it is no problem on my Mac laptop, and both machines appear to me to have identical environments ... both are x86_64-apple-darwin13, and both are using gnu make 3.81, and running OSX 10.9.5.

Here is the tail end of the output of the failed make attempt from the desktop:

clang: warning: argument unused during compilation: '-pthread'
Undefined symbols for architecture x86_64:
  "_gzgetc_", referenced from:
      _zfpeek in libhts.a(zfio.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [samtools] Error 1

The full STDOUT and STDERR from this failed attempt are here and here.

Would appreciate any suggestions especially since my knowledge of Makefiles and compilers is very poor.

samtools • 7.0k views
ADD COMMENT
2
Entering edit mode
9.8 years ago

The gzgetc() function is part of zlib, which is a dependency of samtools. From the INSTALL doc:

Samtools and HTSlib depend on the zlib library http://zlib.net. Building them requires zlib development files to be installed on the build machine; you may need to ensure a package such as zlib1g-dev (on Debian or Ubuntu Linux) or zlib-devel (on RPM/yum-based distributions) is installed.

You might check that you have libz.a or libz.dylib in /usr/lib and the associated header file zlib.h in /usr/include, where the samtools build tools can find them.

If you don't have these files, then you might manually install zlib components to /usr:

$ cd /tmp
$ wget http://zlib.net/zlib-1.2.8.tar.gz
$ tar zxvf zlib-1.2.8.tar.gz
$ cd zlib-1.2.8
$ ./configure --prefix=/usr --static
$ sudo make install

I'd think a normal OS X installation should have these zlib components available, however - at least the dylib. So if you're missing the library and header files, that might suggest some other issue with your computer. Or perhaps samtools is dependent on a static zlib library, in which case the manual build steps above should get you the static library. Be careful.

ADD COMMENT
1
Entering edit mode

Thanks Alex! Library was fine. Somehow I had multiple zlib headers at /usr/include, /usr/local/include, and /usr/local/include/ezlib (and one from EMBOSS that may have been related at /usr/local/include/ezlib/zlibemboss.h). I moved all of them except the header at /usr/include, and it compiled just fine. I think there some kind of version conflict with different zlib.h headers around. Anyway, issue solved, thanks!

ADD REPLY
3
Entering edit mode
9.8 years ago
vavrusa ▴ 80

You might also want to try homebrew to escape the shared library hell with different versions of software requiring/bundling different libraries and headers. Pretty much everything I use is covered by it.

$ brew tap homebrew/science
$ brew install homebrew/science/samtools

If you don't use Homebrew already, check it out at http://brew.sh, or here's a good article on how to set up your Mac of scientific computations: http://alejandrosoto.net/blog/2014/01/22/setting-up-my-mac-for-scientific-research/

ADD COMMENT
0
Entering edit mode

Homebrew-science would install samtools 1.1, not 1.2, until the recipe gets updated.

ADD REPLY
0
Entering edit mode

The recipe was updated more than a week ago.

$ brew install homebrew/science/samtools
==> Installing samtools
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/science/samtools-1.2.yosemite.bottle.tar.g
######################################################################## 100.0%
==> Pouring samtools-1.2.yosemite.bottle.tar.gz
🍺  /usr/local/Cellar/samtools/1.2: 44 files, 1.2M
ADD REPLY
0
Entering edit mode

My mistake.

ADD REPLY

Login before adding your answer.

Traffic: 1597 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6