hellosunking / Msuite2

Msuite2: integrated DNA methylation data analysis toolkit with enhanced performance
9 stars 2 forks source link

make clean && make failed to compile #6

Open ikaramichali opened 1 year ago

ikaramichali commented 1 year ago

I could not compile the program using make clean && make

../Programs/Msuite2-master$ make clean && make

rm -f bin/preprocessor.pe bin/preprocessor.se bin/T2C.pe.m3 bin/T2C.pe.m4 bin/T2C.se.m3 bin/T2C.se.m4 bin/rmdup.w.pe bin/rmdup.c.pe bin/rmdup.w.se bin/rmdup.c.se bin/meth.caller.CpG bin/meth.caller.CpH bin/pair.CpG bin/pair.CpH bin/profile.DNAm.around.TSS util/bed2wig util/extract.meth.in.region g++ -std=c++11 -O3 -march=native -fopenmp -lz -o bin/preprocessor.pe src/preprocessor.pe.cpp src/util.cpp /usr/bin/ld: /tmp/ccG4OA9r.o: in function load_read_batch_gz(gzFile_s*&, char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)': preprocessor.pe.cpp:(.text+0x2c9): undefined reference togzgets' /usr/bin/ld: preprocessor.pe.cpp:(.text+0x2f5): undefined reference to gzgets' /usr/bin/ld: preprocessor.pe.cpp:(.text+0x305): undefined reference togzgets' /usr/bin/ld: preprocessor.pe.cpp:(.text+0x38e): undefined reference to gzgets' /usr/bin/ld: /tmp/ccG4OA9r.o: in functionmain': preprocessor.pe.cpp:(.text.startup+0x141a): undefined reference to gzeof' /usr/bin/ld: preprocessor.pe.cpp:(.text.startup+0x142f): undefined reference togzclose' /usr/bin/ld: preprocessor.pe.cpp:(.text.startup+0x143c): undefined reference to gzclose' /usr/bin/ld: preprocessor.pe.cpp:(.text.startup+0x1d5b): undefined reference togzopen' /usr/bin/ld: preprocessor.pe.cpp:(.text.startup+0x1d83): undefined reference to `gzopen' collect2: error: ld returned 1 exit status make: *** [makefile:11: bin/preprocessor.pe] Error 1


Solution!

I changed the makefile so that -lz comes after the list of object files, and it compiled succesfully.

Makefile_new

Msuite2: bin/preprocessor.pe bin/preprocessor.se bin/T2C.pe.m3 bin/T2C.pe.m4 bin/T2C.se.m3 bin/T2C.se.m4 bin/rmdup.w.pe bin/rmdup.c.pe bin/rmdup.w.se bin/rmdup.c.se bin/meth.caller.CpG bin/meth.caller.CpH bin/pair.CpG bin/pair.CpH bin/profile.DNAm.around.TSS util/bed2wig util/extract.meth.in.region @echo Build Msuite2 done.

cc=g++

note that the g++ MUST support c++11 standard (i.e., version 4.8 or higher)

options=-std=c++11 -O3 -march=native multithread=-fopenmp gzsupport=-lz

bin/preprocessor.pe: src/preprocessor.pe.cpp src/common.h src/util.h $(cc) $(options) $(multithread) -o bin/preprocessor.pe src/preprocessor.pe.cpp src/util.cpp $(gzsupport)

bin/preprocessor.se: src/preprocessor.se.cpp src/common.h src/util.h $(cc) $(options) $(multithread) -o bin/preprocessor.se src/preprocessor.se.cpp src/util.cpp $(gzsupport)

bin/T2C.pe.m3: src/T2C.pe.mode3.cpp src/common.h src/util.h src/util.cpp $(cc) $(options) $(multithread) -o bin/T2C.pe.m3 src/T2C.pe.mode3.cpp src/util.cpp

bin/T2C.pe.m4: src/T2C.pe.mode4.cpp src/common.h src/util.h src/util.cpp $(cc) $(options) $(multithread) -o bin/T2C.pe.m4 src/T2C.pe.mode4.cpp src/util.cpp

bin/T2C.se.m3: src/T2C.se.mode3.cpp src/common.h src/util.h src/util.cpp $(cc) $(options) $(multithread) -o bin/T2C.se.m3 src/T2C.se.mode3.cpp src/util.cpp

bin/T2C.se.m4: src/T2C.se.mode4.cpp src/common.h src/util.h src/util.cpp $(cc) $(options) $(multithread) -o bin/T2C.se.m4 src/T2C.se.mode4.cpp src/util.cpp

bin/rmdup.w.pe: src/rmdup.w.pe.cpp src/util.h src/util.cpp $(cc) $(options) -o bin/rmdup.w.pe src/rmdup.w.pe.cpp src/util.cpp

bin/rmdup.w.se: src/rmdup.w.se.cpp src/util.h src/util.cpp $(cc) $(options) -o bin/rmdup.w.se src/rmdup.w.se.cpp src/util.cpp

bin/rmdup.c.pe: src/rmdup.c.pe.cpp src/util.h src/util.cpp $(cc) $(options) -o bin/rmdup.c.pe src/rmdup.c.pe.cpp src/util.cpp

bin/rmdup.c.se: src/rmdup.c.se.cpp src/util.h src/util.cpp $(cc) $(options) -o bin/rmdup.c.se src/rmdup.c.se.cpp src/util.cpp

bin/meth.caller.CpG: src/meth.caller.CpG.cpp src/common.h src/util.h $(cc) $(options) -o bin/meth.caller.CpG src/meth.caller.CpG.cpp src/util.cpp

bin/meth.caller.CpH: src/meth.caller.CpH.cpp src/common.h src/util.h $(cc) $(options) -o bin/meth.caller.CpH src/meth.caller.CpH.cpp src/util.cpp

bin/pair.CpG: src/pair.CpG.cpp src/common.h src/util.h src/util.cpp $(cc) $(options) -o bin/pair.CpG src/pair.CpG.cpp src/util.cpp

bin/pair.CpH: src/pair.CpH.cpp src/common.h src/util.h src/util.cpp $(cc) $(options) -o bin/pair.CpH src/pair.CpH.cpp src/util.cpp

bin/profile.DNAm.around.TSS: src/profile.DNAm.around.TSS.cpp $(cc) $(options) -o bin/profile.DNAm.around.TSS src/profile.DNAm.around.TSS.cpp

util/bed2wig: util/bed2wig.cpp $(cc) $(options) -o util/bed2wig util/bed2wig.cpp

util/extract.meth.in.region: util/extract.meth.in.region.cpp $(cc) $(options) -o util/extract.meth.in.region util/extract.meth.in.region.cpp

clean: rm -f bin/preprocessor.pe bin/preprocessor.se bin/T2C.pe.m3 bin/T2C.pe.m4 bin/T2C.se.m3 bin/T2C.se.m4 bin/rmdup.w.pe bin/rmdup.c.pe bin/rmdup.w.se bin/rmdup.c.se bin/meth.caller.CpG bin/meth.caller.CpH bin/pair.CpG bin/pair.CpH bin/profile.DNAm.around.TSS util/bed2wig util/extract.meth.in.region

hellosunking commented 1 year ago

Hi ikaramichali,

Thanks for your sharing. Actually I have not encountered this issue before, but I will update the makefile accordingly.

Kun