churchill-lab / emase-zero

C++ Implementation of EMASE
http://churchill-lab.github.io/emase-zero/
MIT License
6 stars 2 forks source link

Issues compiling emase-zero #3

Open jonassibbesen opened 4 years ago

jonassibbesen commented 4 years ago

Hi,

I am running into a problem when I try to compile emase-zero. I get the following error:

g++ -lz -o emase-zero alignment_incidence_matrix.o sample_allelic_expression.o alignment_import.o emase.o
alignment_import.o: In function `getBinFormat(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
alignment_import.cpp:(.text+0x404): undefined reference to `gzopen'
alignment_import.cpp:(.text+0x40f): undefined reference to `gzrewind'
alignment_import.cpp:(.text+0x421): undefined reference to `gzread'
alignment_import.cpp:(.text+0x429): undefined reference to `gzclose'
alignment_import.o: In function `readIntFromFile(gzFile_s*, std::basic_ifstream<char, std::char_traits<char> >&)':
alignment_import.cpp:(.text+0x8f7): undefined reference to `gzread'
alignment_import.o: In function `readCharFromFile(gzFile_s*, std::basic_ifstream<char, std::char_traits<char> >&)':
alignment_import.cpp:(.text+0x977): undefined reference to `gzread'
alignment_import.o: In function `fileSeek(gzFile_s*, std::basic_ifstream<char, std::char_traits<char> >&, long)':
alignment_import.cpp:(.text+0x9f2): undefined reference to `gzrewind'
alignment_import.o: In function `loadNFromBin(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, AlignmentIncidenceMatrix&, int)':
alignment_import.cpp:(.text+0xcfe): undefined reference to `gzopen'
alignment_import.cpp:(.text+0x1006): undefined reference to `gzrewind'
alignment_import.cpp:(.text+0x1016): undefined reference to `gzseek'
alignment_import.cpp:(.text+0x103b): undefined reference to `gzread'
alignment_import.cpp:(.text+0x1064): undefined reference to `gzread'
alignment_import.cpp:(.text+0x1087): undefined reference to `gztell'
alignment_import.cpp:(.text+0x10b6): undefined reference to `gzrewind'
alignment_import.cpp:(.text+0x10c6): undefined reference to `gzseek'
alignment_import.cpp:(.text+0x10ee): undefined reference to `gzread'
alignment_import.cpp:(.text+0x111e): undefined reference to `gzread'
alignment_import.cpp:(.text+0x1165): undefined reference to `gzrewind'
alignment_import.cpp:(.text+0x1177): undefined reference to `gzseek'
alignment_import.cpp:(.text+0x1228): undefined reference to `gzread'
alignment_import.cpp:(.text+0x12a5): undefined reference to `gzrewind'
alignment_import.cpp:(.text+0x12b7): undefined reference to `gzseek'
alignment_import.cpp:(.text+0x1350): undefined reference to `gzread'
alignment_import.o: In function `loadFromBin(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
alignment_import.cpp:(.text+0x1a17): undefined reference to `gzopen'
alignment_import.cpp:(.text+0x1c91): undefined reference to `gzread'
alignment_import.cpp:(.text+0x1cb6): undefined reference to `gzread'
alignment_import.cpp:(.text+0x1ddc): undefined reference to `gzread'
alignment_import.cpp:(.text+0x1e3c): undefined reference to `gzread'
alignment_import.cpp:(.text+0x2016): undefined reference to `gzread'
alignment_import.o:alignment_import.cpp:(.text+0x2361): more undefined references to `gzread' follow
alignment_import.o: In function `loadFromBin(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
alignment_import.cpp:(.text+0x51cb): undefined reference to `gztell'
alignment_import.cpp:(.text+0x5260): undefined reference to `gzread'
alignment_import.o: In function `fileSeek(gzFile_s*, std::basic_ifstream<char, std::char_traits<char> >&, long)':
alignment_import.cpp:(.text+0xa1a): undefined reference to `gzseek'
alignment_import.o: In function `fileTell(gzFile_s*, std::basic_ifstream<char, std::char_traits<char> >&)':
alignment_import.cpp:(.text+0xa93): undefined reference to `gztell'
collect2: error: ld returned 1 exit status
Makefile:9: recipe for target 'emase-zero' failed
make: *** [emase-zero] Error 1

It seems to work when I move the zlib linker flag (-lz) to the end:

g++ -o emase-zero alignment_incidence_matrix.o sample_allelic_expression.o alignment_import.o emase.o -lz

I found this on the topic: https://stackoverflow.com/questions/9417169/why-does-the-library-linker-flag-sometimes-have-to-go-at-the-end-using-gcc

Thank,

Jonas