Re: [Seqan-dev] CMake and ZLIB
In the meantime, I have gotten this to compile/run on our server, so I am guessing that the problem is not with the CMake script but rather with my local setup.
The CMake script has these lines
target_link_libraries (motify ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(motify ${SEQAN_LIBRARIES})
target_link_libraries(motify ${ZLIB})
and it is trying to link to libz
/usr/bin/cmake -E cmake_link_script CMakeFiles/motify.dir/link.txt --verbose=1
/usr/bin/c++ -g -Wall -pedantic -std=c++14 -rdynamic CMakeFiles/motify.dir/main.cpp.o CMakeFiles/motify.dir/ArgParse.cpp.o CMakeFiles/motify.dir/NmerCounter.cpp.o CMakeFiles/motify.dir/NucOdometer.cpp.o -o motify -lpthread -lrt -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -lz mafParse/libmafParse.a
but I get this
/home/robinp/GIT/jax-egtk/build/seqan/include/seqan/stream/stream_compressor.h:382: undefined reference to `inflateInit2_'
mafParse/libmafParse.a(TargetedRegions.cpp.o): In function `zlib_stream::basic_unzip_streambuf<char, std::char_traits<char>, std::allocator<char>, unsigned char, std::allocator<unsigned char> >::~basic_unzip_streambuf()':
/home/robinp/GIT/jax-egtk/build/seqan/include/seqan/stream/iostream_zip_impl.h:282: undefined reference to `inflateEnd'
mafParse/libmafParse.a(TargetedRegions.cpp.o): In function `zlib_stream::basic_unzip_streambuf<char, std::char_traits<char>, std::allocator<char>, unsigned char, std::allocator<unsigned char> >::basic_unzip_streambuf(std::istream&, unsigned long, unsigned long, unsigned long)':
/home/robinp/GIT/jax-egtk/build/seqan/include/seqan/stream/iostream_zip_impl.h:268: undefined reference to `inflateInit2_'
mafParse/libmafParse.a(TargetedRegions.cpp.o): In function `unsigned long seqan::_decompressBlock<char, unsigned long, char, unsigned int>(char*, unsigned long, char*, unsigned int, seqan::CompressionContext<seqan::Tag<seqan::BgzfFile_> >&)':
/home/robinp/GIT/jax-egtk/build/seqan/include/seqan/stream/stream_compressor.h:473: undefined reference to `inflate'
/home/robinp/GIT/jax-egtk/build/seqan/include/seqan/stream/stream_compressor.h:476: undefined reference to `inflateEnd'
/home/robinp/GIT/jax-egtk/build/seqan/include/seqan/stream/stream_compressor.h:480: undefined reference to `inflateEnd'
/home/robinp/GIT/jax-egtk/build/seqan/include/seqan/stream/stream_compressor.h:489: undefined reference to `crc32'
/home/robinp/GIT/jax-egtk/build/seqan/include/seqan/stream/stream_compressor.h:489: undefined reference to `crc32'
mafParse/libmafParse.a(TargetedRegions.cpp.o): In function `zlib_stream::basic_unzip_streambuf<char, std::char_traits<char>, std::allocator<char>, unsigned char, std::allocator<unsigned char> >::unzip_from_stream(char*, long)':
/home/robinp/GIT/jax-egtk/build/seqan/include/seqan/stream/iostream_zip_impl.h:336: undefined reference to `inflate'
/home/robinp/GIT/jax-egtk/build/seqan/include/seqan/stream/iostream_zip_impl.h:339: undefined reference to `inflateReset'
collect2: error: ld returned 1 exit status
CMakeFiles/motify.dir/build.make:174: recipe for target 'motify' failed
make[2]: *** [motify] Error 1
make[2]: Leaving directory '/home/robinp/GIT/jax-egtk/build'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/motify.dir/all' failed
make[1]: *** [CMakeFiles/motify.dir/all] Error 2
make[1]: Leaving directory '/home/robinp/GIT/jax-egtk/build'
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
-> As far as I can see now, I have all of the libz libraries installed, but I am going to explore here. I would like to be able to get CMake to give an error message before using make....
thanks!
Peter Robinson
Professor and Donald A. Roux Chair, Genomics and Computational Biology
The Jackson Laboratory for Genomic Medicine
860.837.2095 t | peter.robinson@jax.org | https://robinsongroup.github.io/
Peter Robinson
________________________________________
From: Leon Kuchenbecker <lkuchenb@inf.fu-berlin.de>
Sent: Friday, January 25, 2019 10:15 AM
To: seqan-dev@lists.fu-berlin.de
Cc: Peter Robinson
Subject: Re: [Seqan-dev] CMake and ZLIB
Hi Nick,
do you have a 'target_link_libraries' statement anywhere which adds the
required libraries to the linker step?
Something like
> target_link_libraries (my_project ${SEQAN_LIBRARIES})
IIRC this also contains linking zlib.
When you're debugging this, try using "make VERBOSE=1" to see if the
linker flag is included or not.
You seem to be building a cmake file that automatically obtains SeqAn.
I've done something similar on other projects, maybe check out
https://github.com/lkuchenb/imseq/blob/master/cmake/SeqAn.cmake
it worked pretty well for me. If the include syntax hasn't changed from
2.3.2 to 2.4.0, it should work for the latest release as well. This
won't work if you need the current development version from the git repo
though.
Cheers
Leon
---
The information in this email, including attachments, may be confidential and is intended solely for the addressee(s). If you believe you received this email by mistake, please notify the sender by return email as soon as possible.