Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Build failure when using non-system zlib #7

Open
d-cameron opened this issue Oct 7, 2015 · 1 comment
Open

Build failure when using non-system zlib #7

d-cameron opened this issue Oct 7, 2015 · 1 comment

Comments

@d-cameron
Copy link

When building on Linux version 2.6.32-358.el6.x86_64 (mockbuild@c6b8.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ), build fails due to attempt to link samtools against the system zlib version (1.2.3) when a different version is specified using all of CPATH LIBRARY_PATH CMAKE_LIBRARY_PATH CMAKE_INCLUDE_PATH.

cmake .. outputs

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
No CMAKE_BUILD_TYPE specified, defaulting to release
-- Found ZLIB: /usr/local/bioinfsoftware/zlib/zlib_1.2.8/lib/libz.so (found version "1.2.8")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/users/allstaff/cameron.d/src/somatic-sniper/1.0.5.0/build

which shows that cmake is detecting the correct library version. But make deps outputs

[  3%] Creating directories for 'samtools-lib'
[  7%] Performing download step (verify and extract) for 'samtools-lib'
-- verifying file...
     file='/home/users/allstaff/cameron.d/src/somatic-sniper/1.0.5.0/vendor/samtools-0.1.6.tar.gz'
-- verifying file... warning: did not verify file - no URL_MD5 checksum argument? corrupt file?
-- extracting...
     src='/home/users/allstaff/cameron.d/src/somatic-sniper/1.0.5.0/vendor/samtools-0.1.6.tar.gz'
     dst='/home/users/allstaff/cameron.d/src/somatic-sniper/1.0.5.0/build/vendor/samtools'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 10%] Performing patch step for 'samtools-lib'
patching file Makefile
[ 14%] No update step for 'samtools-lib'
[ 17%] Performing configure step for 'samtools-lib'
Building samtools, build log at /home/users/allstaff/cameron.d/src/somatic-sniper/1.0.5.0/build/vendor/samtools/build.log
[ 21%] Performing build step for 'samtools-lib'
make[2]: *** [vendor/src/samtools-lib-stamp/samtools-lib-build] Error 2
make[1]: *** [CMakeFiles/samtools-lib.dir/all] Error 2
make: *** [all] Error 2

Looking for details, cd vendor/samtools ; make results in

make[1]: Entering directory `/wehisan/home/allstaff/c/cameron.d/src/somatic-sniper/1.0.5.0/build/vendor/samtools'
gcc -g -Wall -O2  -o samtools bam_tview.o bam_maqcns.o bam_plcmd.o sam_view.o bam_rmdup.o bam_rmdupse.o bam_mate.o bam_stat.o bam_color.o bamtk.o -lm  -lcurses  -L. -lbam -lz
./libbam.a(bam_import.o): In function `__bam_get_lines':
/home/users/allstaff/cameron.d/src/somatic-sniper/1.0.5.0/build/vendor/samtools/bam_import.c:75: undefined reference to `gzopen64'
./libbam.a(bam_import.o): In function `sam_open':
/home/users/allstaff/cameron.d/src/somatic-sniper/1.0.5.0/build/vendor/samtools/bam_import.c:502: undefined reference to `gzopen64'
./libbam.a(bam_import.o): In function `sam_header_read2':
/home/users/allstaff/cameron.d/src/somatic-sniper/1.0.5.0/build/vendor/samtools/bam_import.c:125: undefined reference to `gzopen64'
collect2: ld returned 1 exit status
make[1]: *** [samtools] Error 1
make[1]: Leaving directory `/wehisan/home/allstaff/c/cameron.d/src/somatic-sniper/1.0.5.0/build/vendor/samtools'
make: *** [all-recur] Error 1

Indicating samtools is being linked against the system zlib, not the zlib detected by cmake.

Manually editing the samtools Makefile to explicitly add zlib via -L works for the samtools build, but results in a link error when building bam-somaticsniper.

Are you able to update your build process to respect the zlib library path detected by cmake?

@leiendeckerlu
Copy link

Is there a solution for this error? Just encountered the same error with no immediate solution...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants