From 25a0896e99bfe7a2321b006ea76b6b746d851e60 Mon Sep 17 00:00:00 2001 From: Yang Chen Date: Tue, 3 Jul 2018 13:55:57 -0700 Subject: [PATCH] use system CXX for building Multiverso on Linux We used to set CXX to mpic++, which was then used for building Multiverso. Unfortunately, this kind of configuration conflicted with find_package(MPI), and hence caused failure. This commit fixed the issue by using system CXX for building Multiverso. It also fixed two other issues: * EVAL_LIB depends on libmultiverso, so we had to set MULTIVERSO_LIB before the EVAL_LIB rule * cmake variable doesn't have a "PATHNAME" type, we used PATH instead. We also replace FILEPATH with PATH because BOOST_LIBRARY_DIRS points to a path rather than a file. --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 72d98dbfb..171327643 100644 --- a/Makefile +++ b/Makefile @@ -76,6 +76,8 @@ endif #### Configure based on options above +DEFAULT_CXX:= $(CXX) + # The mpic++ wrapper only adds MPI specific flags to the g++ command line. # The actual compiler/linker flags added can be viewed by running 'mpic++ --showme:compile' and 'mpic++ --showme:link' ifneq ($(HAS_MPI),0) @@ -692,7 +694,9 @@ EVAL_LIB:=$(LIBDIR)/lib$(EVAL).so ALL_LIBS+=$(EVAL_LIB) SRC+=$(EVAL_SRC) -$(EVAL_LIB): $(EVAL_OBJ) | $(CNTKMATH_LIB) +MULTIVERSO_LIB:=$(LIBDIR)/libmultiverso.so + +$(EVAL_LIB): $(EVAL_OBJ) | $(CNTKMATH_LIB) $(MULTIVERSO_LIB) @echo $(SEPARATOR) @mkdir -p $(dir $@) @echo Building $(EVAL_LIB) for $(ARCH) with build type $(BUILDTYPE) @@ -1113,7 +1117,7 @@ lMULTIVERSO:=-lmultiverso INCLUDEPATH += $(SOURCEDIR)/Multiverso/include COMMON_FLAGS += -DASGD_PARALLEL_SUPPORT -MULTIVERSO_LIB:=$(LIBDIR)/libmultiverso.so +# MULTIVERSO_LIB has been set above ALL_LIBS+=$(MULTIVERSO_LIB) ifeq ("$(BUILDTYPE)","release") @@ -1130,13 +1134,13 @@ $(MULTIVERSO_LIB): @mkdir -p $(BINDIR) @mkdir -p $(SOURCEDIR)/Multiverso/build/$(BUILDTYPE) @cmake -DCMAKE_VERBOSE_MAKEFILE=TRUE \ - -DCMAKE_CXX_COMPILER=$(CXX) \ + -DCMAKE_CXX_COMPILER=$(DEFAULT_CXX) \ -DOpenMP_CXX_FLAGS="" \ -DOpenMP_C_FLAGS="" \ -DBoost_NO_BOOST_CMAKE=TRUE \ -DBoost_NO_SYSTEM_PATHS=TRUE \ - -DBOOST_ROOT:PATHNAME=$(BOOST_PATH) \ - -DBOOST_LIBRARY_DIRS:FILEPATH=$(BOOST_PATH) \ + -DBOOST_ROOT:PATH=$(BOOST_PATH) \ + -DBOOST_LIBRARY_DIRS:PATH=$(BOOST_PATH) \ -DLIBRARY_OUTPUT_PATH=$(shell readlink -f $(LIBDIR)) \ -DEXECUTABLE_OUTPUT_PATH=$(shell readlink -f $(BINDIR)) \ -DCMAKE_BUILD_TYPE=$(MULTIVERSO_CMAKE_BUILDTYPE) \