Hi everyone, I came across some code which uses the samtools library. Together with seqan there is an error which seems to come from samtools but I do not know why. Since I am not the author of the samtools include I cannot say much about the corresponding lines in the CMakeLists.txt But since commenting out seqan from the main.cpp solves the error, I imagined this has something to do with seqan. I provided a minimal example with a main.cpp and a CMakeLists, which hopefully (on my pc it does) reproduces the error. Please note, that I did use absolute paths for CMAKE_MODULE_PATH and SEQAN_INCLUDE_PATH. You would need to change these accordingly. Best Regards, Jakob PS: Any progress on my last question concerning BamTagsDict? PPS: terminal output with error message (inside build directory) ================================================================================================================== $ cmake .. -- The C compiler identification is GNU 4.9.2 -- The CXX compiler identification is GNU 4.9.2 -- 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 -- Detecting C compile features -- Detecting C compile features - 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 -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for include file execinfo.h -- Looking for include file execinfo.h - found -- Looking for BZ2_bzCompressInit in /usr/lib/x86_64-linux-gnu/libbz2.so -- Looking for BZ2_bzCompressInit in /usr/lib/x86_64-linux-gnu/libbz2.so - found -- Determined version is 2.0.2 bam_reheader.c: In function ‘bam_reheader’: bam_reheader.c:36:19: warning: variable ‘old’ set but not used [-Wunused-but-set-variable] bam_header_t *old; ^ kprobaln.c: In function ‘kpa_glocal’: kprobaln.c:78:21: warning: variable ‘is_diff’ set but not used [-Wunused-but-set-variable] int bw, bw2, i, k, is_diff = 0, is_backward = 1, Pr; ^ misc/md5.c: In function ‘MD5Final’: misc/md5.c:151:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint32_t *) ctx->in)[14] = ctx->bits[0]; ^ misc/md5.c:152:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint32_t *) ctx->in)[15] = ctx->bits[1]; ^ misc/md5.c: In function ‘MD5Final’: misc/md5.c:151:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint32_t *) ctx->in)[14] = ctx->bits[0]; ^ misc/md5.c:152:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] ((uint32_t *) ctx->in)[15] = ctx->bits[1]; ^ -- Configuring done -- Generating done -- Build files have been written to: /home/schulzeja/masterthesis/workDir/seqanTestForReport2/build $ make Scanning dependencies of target main [100%] Building CXX object CMakeFiles/main.dir/main.cpp.o In file included from /home/schulzeja/masterthesis/workDir/seqanTestForReport2/build/samtools-1.2/bam.h:48:0, from /home/schulzeja/masterthesis/workDir/seqanTestForReport2/build/samtools-1.2/sam.h:29, from /home/schulzeja/masterthesis/workDir/seqanTestForReport2/main.cpp:1: /home/schulzeja/masterthesis/workDir/seqanTestForReport2/build/samtools-1.2/htslib-1.2.1/htslib/bgzf.h:38:29: error: expected unqualified-id before numeric constant #define BGZF_MAX_BLOCK_SIZE 0x10000 ^ /home/schulzeja/masterthesis/tools/seqan-src/include/seqan/stream/iostream_bgzf.h:25:16: note: in expansion of macro ‘BGZF_MAX_BLOCK_SIZE’ const unsigned BGZF_MAX_BLOCK_SIZE = 64 * 1024; ^ /home/schulzeja/masterthesis/workDir/seqanTestForReport2/build/samtools-1.2/htslib-1.2.1/htslib/bgzf.h:37:29: error: expected unqualified-id before numeric constant #define BGZF_BLOCK_SIZE 0xff00 // make sure compressBound(BGZF_BLOCK_SIZE) < BGZF_MAX_BLOCK_SIZE ^ /home/schulzeja/masterthesis/tools/seqan-src/include/seqan/stream/iostream_bgzf.h:32:16: note: in expansion of macro ‘BGZF_BLOCK_SIZE’ const unsigned BGZF_BLOCK_SIZE = BGZF_MAX_BLOCK_SIZE - BGZF_BLOCK_HEADER_LENGTH - BGZF_BLOCK_FOOTER_LENGTH - ZLIB_BLOCK_OVERHEAD; ^ /home/schulzeja/masterthesis/workDir/seqanTestForReport2/main.cpp:5:14: warning: unused parameter ‘argc’ [-Wunused-parameter] int main(int argc, char* argv[]) { ^ /home/schulzeja/masterthesis/workDir/seqanTestForReport2/main.cpp:5:31: warning: unused parameter ‘argv’ [-Wunused-parameter] int main(int argc, char* argv[]) { ^ CMakeFiles/main.dir/build.make:54: recipe for target 'CMakeFiles/main.dir/main.cpp.o' failed make[2]: *** [CMakeFiles/main.dir/main.cpp.o] Error 1 CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/main.dir/all' failed make[1]: *** [CMakeFiles/main.dir/all] Error 2 Makefile:75: recipe for target 'all' failed make: *** [all] Error 2 ====================================================================================================================
#include "sam.h" #include <seqan/bam_io.h> using namespace seqan; int main(int argc, char* argv[]) { return 1; }
############## ### Header ### cmake_minimum_required (VERSION 2.8) project (Main) # Set the version number set (Main_VERSION_MAJOR 0) set (Main_VERSION_MINOR 2) # Set flags for compilation set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -g -pthread -W -Wall -std=gnu++11 -O2") # add the binary tree to the search path for include files include_directories("${PROJECT_BINARY_DIR}") ############################# ### setup seqan libraries ### set (CMAKE_MODULE_PATH "/home/schulzeja/masterthesis/tools/seqan-src/util/cmake") set (SEQAN_INCLUDE_PATH "/home/schulzeja/masterthesis/tools/seqan-src/include/") # Configure SeqAn, enabling features for libbz2 and zlib. set (SEQAN_FIND_DEPENDENCIES ZLIB BZip2) find_package (SeqAn REQUIRED) # Add include directories, defines, and flags for SeqAn (and its dependencies). include_directories (${SEQAN_INCLUDE_DIRS}) add_definitions (${SEQAN_DEFINITIONS}) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SEQAN_CXX_FLAGS}") ############################################# ### download & build the Samtools library ### file(DOWNLOAD "http://downloads.sourceforge.net/project/samtools/samtools/1.2/samtools-1.2.tar.bz2" ${CMAKE_CURRENT_BINARY_DIR}/samtools-1.2.tar.bz2) execute_process(COMMAND tar xf ${CMAKE_CURRENT_BINARY_DIR}/samtools-1.2.tar.bz2 ) execute_process(COMMAND make -s -C samtools-1.2 ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/samtools-1.2 ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/samtools-1.2/htslib-1.2.1 ) LINK_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/samtools-1.2 ${CMAKE_CURRENT_BINARY_DIR}/samtools-1.2/htslib-1.2.1 ) ############################# ### Build the executables ### add_executable (main main.cpp) target_link_libraries (main ${SEQAN_LIBRARIES} hts)