Closed pcarbo closed 3 years ago
BOOST_ROOT
may be undefined.
Ah, right---please fix as needed.
I had a lot of problems with this as well. Here's the make file that worked for me eventually:
#COMPILER MODE C++11
CXX=g++ -std=c++11
HTSLIB_ROOT=/home/ubuntu/programs/htslib-1.9
HTSLIB_INC=$(HTSLIB_ROOT)/include
HTSLIB_LIB=-L$(HTSLIB_ROOT)/lib -lhts
BOOST_ROOT=/usr/lib/x86_64-linux-gnu
BOOST_INC=$(BOOST_ROOT)/include
BOOST_LIB_IO=-L$(BOOST_ROOT)/lib -lboost_iostreams
BOOST_LIB_PO=-L$(BOOST_ROOT)/lib -lboost_program_options
#Best performance is achieved with this. Use it if running on the same plateform you're compiling, it's definitely worth it!
CXXFLAG=-O3 -march=native
LDFLAG=-O3
#DYNAMIC LIBRARIES
DYN_LIBS=-lz -lbz2 -lm -lpthread -llzma
#SHAPEIT SOURCES & BINARY
BFILE=bin/shapeit4
HFILE=$(shell find src -name *.h)
CFILE=$(shell find src -name *.cpp)
OFILE=$(shell for file in `find src -name *.cpp`; do echo obj/$$(basename $$file .cpp).o; done)
VPATH=$(shell for file in `find src -name *.cpp`; do echo $$(dirname $$file); done)
#COMPILATION RULES
all: $(BFILE)
$(BFILE): $(OFILE)
$(CXX) $(LDFLAG) $^ $(HTSLIB_LIB) $(BOOST_LIB_IO) $(BOOST_LIB_PO) -o $@ $(DYN_LIBS)
obj/%.o: %.cpp $(HFILE)
$(CXX) $(CXXFLAG) -c $< -o $@ -Isrc -I$(HTSLIB_INC) -I$(BOOST_INC)
clean:
rm -f obj/*.o $(BFILE)
Quite similar to @pcarbo - just with BOOST_ROOT defined. Thanks a lot for the solution! Also when doing it, I afterwards had to export
export LD_LIBRARY_PATH=/home/ubuntu/programs/htslib-1.9/
Because it had trouble linking it otherwise (I think, I'm no makefile expert)
Thanks guys! This fixed compiling errors with htslib for me on release 4.1.3 .
This isn't really an issue---just an FYI in case it's useful. I wasn't able to compile SHAPEIT 4.1 on our system (Centos 7) using the static htslib, but it worked with the dynamic libraries. Perhaps others will find this information useful. Below is the exact Makefile used. Feel free to incorporate this information into your installation instructions.