Skip to content

Commit 338ac3e

Browse files
shelhamerzouxiaochuan
authored andcommitted
fix library install name on OSX for relative path linking
for linking of the caffe tools, tests, etc. the library install name needs to include the @rpath set for the executables and interfaces this was broken on OSX by BVLC#3311
1 parent 040fed2 commit 338ac3e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Makefile

+2-3
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,8 @@ ifeq ($(OSX), 1)
283283
# boost::thread is called boost_thread-mt to mark multithreading on OS X
284284
LIBRARIES += boost_thread-mt
285285
# we need to explicitly ask for the rpath to be obeyed
286-
DYNAMIC_FLAGS := -install_name @rpath/libcaffe.so
287286
ORIGIN := @loader_path
288-
VERSIONFLAGS += -Wl,-install_name,$(DYNAMIC_VERSIONED_NAME_SHORT) -Wl,-rpath,$(ORIGIN)/../../build/lib
287+
VERSIONFLAGS += -Wl,-install_name,@rpath/$(DYNAMIC_VERSIONED_NAME_SHORT) -Wl,-rpath,$(ORIGIN)/../../build/lib
289288
else
290289
ORIGIN := \$$ORIGIN
291290
endif
@@ -552,7 +551,7 @@ $(ALL_BUILD_DIRS): | $(BUILD_DIR_LINK)
552551

553552
$(DYNAMIC_NAME): $(OBJS) | $(LIB_BUILD_DIR)
554553
@ echo LD -o $@
555-
$(Q)$(CXX) -shared -o $@ $(OBJS) $(VERSIONFLAGS) $(LINKFLAGS) $(LDFLAGS) $(DYNAMIC_FLAGS)
554+
$(Q)$(CXX) -shared -o $@ $(OBJS) $(VERSIONFLAGS) $(LINKFLAGS) $(LDFLAGS)
556555
@ cd $(BUILD_DIR)/lib; rm -f $(DYNAMIC_NAME_SHORT); ln -s $(DYNAMIC_VERSIONED_NAME_SHORT) $(DYNAMIC_NAME_SHORT)
557556

558557
$(STATIC_NAME): $(OBJS) | $(LIB_BUILD_DIR)

0 commit comments

Comments
 (0)