fhormoz / caviar

50 stars 25 forks source link

Compiling CAVIAR on Mac OS X M1 chip computer with homebrew installed GNU scientific library #29

Open DesmondSmith opened 1 year ago

DesmondSmith commented 1 year ago

If the GNU scientific library (https://www.gnu.org/software/gsl/) is installed using the homebrew package manager on a macOS X M1 chip computer :

brew install gsl

The gsl folder containing the relevant header files are in "/opt/homebrew/Cellar/gsl/2.7.1/include/"

The CAVIAR packages can be successfully compiled using "make" if the following line is added to "Makefile":

LDFLAGS += -I /opt/homebrew/Cellar/gsl/2.7.1/include/

I added the line on line 4, below

CFLAGS=-c -Wall -g -I $(DIC)

and above

LDFLAGS += -I $(DIC)/armadillo/include/ -DARMA_DONT_USE_WRAPPER -llapack -lblas -lgslcblas -lgsl

That is:

CC=g++ DIC=$(PWD) CFLAGS=-c -Wall -g -I $(DIC) LDFLAGS += -I /opt/homebrew/Cellar/gsl/2.7.1/include/ LDFLAGS += -I $(DIC)/armadillo/include/ -DARMA_DONT_USE_WRAPPER -llapack -lblas -lgslcblas -lgsl SOURCES1=caviar.cpp PostCal.cpp Util.cpp TopKSNP.cpp ... etc.

phyllip3 commented 1 year ago

To get this working I had to include the library paths too. I added this to the Makefile: LDFLAGS += -I /opt/homebrew/include/ -L /opt/homebrew/lib/

laleoarrow commented 2 months ago

To get this working I had to include the library paths too. I added this to the Makefile: LDFLAGS += -I /opt/homebrew/include/ -L /opt/homebrew/lib/

Thanks it does help in my case.

The makefile head is as below:

 🍎  ~/p/s/caviar/CAVIAR-C++  master !1 ?4  head makefile 
CC=g++
DIC=$(PWD)
CFLAGS=-c -Wall -g  -I $(DIC)
LDFLAGS += -I /opt/homebrew/Cellar/gsl/2.7.1/include/
LDFLAGS += -I /opt/homebrew/include/ -L /opt/homebrew/lib/
LDFLAGS += -I $(DIC)/armadillo/include/ -DARMA_DONT_USE_WRAPPER -llapack -lblas -lgslcblas  -lgsl
SOURCES1=caviar.cpp PostCal.cpp Util.cpp TopKSNP.cpp
SOURCES2=ecaviar.cpp PostCal.cpp Util.cpp
SOURCES3=setcaviar.cpp PostCal.cpp Util.cpp
SOURCES4=multipop.cpp PostCalMultiPop.cpp Util.cpp