This is an automated email from the ASF dual-hosted git repository.
zhasheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new bf0185c Fix cpp examples build on Mac. (#13826)
bf0185c is described below
commit bf0185c501a5c6620ad5b655cacc59e75c50dbbf
Author: Frank Liu <[email protected]>
AuthorDate: Mon Jan 14 12:33:16 2019 -0800
Fix cpp examples build on Mac. (#13826)
This is a regression of addning @rpath name to libmxnet.so on Mac,
example executable is not able to find libmxnet.so anymore.
Add @rpath search path to fix this issue.
---
cpp-package/example/Makefile | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/cpp-package/example/Makefile b/cpp-package/example/Makefile
index 58d4c82..237ab96 100644
--- a/cpp-package/example/Makefile
+++ b/cpp-package/example/Makefile
@@ -15,6 +15,12 @@
# specific language governing permissions and limitations
# under the License.
+ifeq ($(OS),Windows_NT)
+ UNAME_S := Windows
+else
+ UNAME_S := $(shell uname -s)
+endif
+
prebuild :
@mkdir -p build
$(shell ./get_data.sh)
@@ -30,6 +36,7 @@ endif
# CPPEX_CFLAGS += -I../include
CPPEX_EXTRA_LDFLAGS := -L../../lib -lmxnet
+MXNET_LIB_PATH := $(shell cd ../../lib; pwd)
.PHONY: all clean
@@ -38,10 +45,12 @@ all: prebuild $(CPPEX_EXE)
debug: CPPEX_CFLAGS += -DDEBUG -g
debug: prebuild all
-
-
$(CPPEX_EXE):% : %.cpp
$(CXX) -std=c++11 $(CFLAGS) $(CPPEX_CFLAGS) -o build/$@ $(filter %.cpp
%.a, $^) $(CPPEX_EXTRA_LDFLAGS)
+ifeq ($(UNAME_S), Darwin)
+ install_name_tool -add_rpath @loader_path build/$@
+ install_name_tool -add_rpath $(MXNET_LIB_PATH) build/$@
+endif
clean:
@rm -rf build