@@ -156,12 +156,15 @@ if '${WITH_MKL}' == 'ON':
156
156
shutil.copy('${MKLML_IOMP_LIB}', libs_path)
157
157
package_data['paddle.libs']+=['libmklml_intel.so','libiomp5.so']
158
158
if '${WITH_MKLDNN}' == 'ON':
159
+ # TODO(typhoonzero): use install_name_tool to patch mkl libs once
160
+ # we can support mkl on mac.
161
+ #
159
162
# change rpath of libmkldnn.so.0, add $ORIGIN/ to it.
160
163
# The reason is that all thirdparty libraries in the same directory,
161
164
# thus, libmkldnn.so.0 will find libmklml_intel.so and libiomp5.so.
162
165
command = "patchelf --set-rpath '$ORIGIN/' ${MKLDNN_SHARED_LIB}"
163
166
if os.system(command) != 0:
164
- raise Exception("patchelf --set-rpath for libmkldnn.so.0 fails" )
167
+ raise Exception("patch libmkldnn.so failed, command: %s" % command )
165
168
package_data['paddle.libs']+=['libmkldnn.so.0']
166
169
shutil.copy('${MKLDNN_SHARED_LIB}', libs_path)
167
170
# remove unused paddle/libs/__init__.py
@@ -172,9 +175,12 @@ package_dir['paddle.libs']=libs_path
172
175
# The reason is that libwarpctc.so, libiomp5.so etc are in paddle.libs, and
173
176
# core.so is in paddle.fluid, thus paddle/fluid/../libs will pointer to above libraries.
174
177
# This operation will fix https://github.com/PaddlePaddle/Paddle/issues/3213
175
- command = "patchelf --set-rpath '$ORIGIN/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/core.so"
178
+ if "@APPLE@" == "1":
179
+ command = "install_name_tool -id \"@loader_path/../libs/\" ${PADDLE_BINARY_DIR}/python/paddle/fluid/core.so"
180
+ else:
181
+ command = "patchelf --set-rpath '$ORIGIN/../libs/' ${PADDLE_BINARY_DIR}/python/paddle/fluid/core.so"
176
182
if os.system(command) != 0:
177
- raise Exception("patchelf --set-rpath for core.so fails" )
183
+ raise Exception("patch core.so failed, command: %s" % command )
178
184
179
185
setup(name='${PACKAGE_NAME}',
180
186
version='${PADDLE_VERSION}',
0 commit comments