Commit dd2cf303 authored by Mehul Tikekar's avatar Mehul Tikekar

Use @rpath as install_name prefix on MacOS

@loader_path prefix requires dependent libraries to be in the same
directory or to use install_name_tool to change the name after linking.
With this fix, linker's -rpath can be used instead.
parent 5e889a62
...@@ -140,7 +140,9 @@ class dso2libmixin: ...@@ -140,7 +140,9 @@ class dso2libmixin:
else: else:
raise RuntimeError("Something wierd happened. Please report. %s"%full) raise RuntimeError("Something wierd happened. Please report. %s"%full)
self._osx_changes.append(('@loader_path/'+fullname, '@loader_path/%s/%s'%(os.path.relpath(dsopath, mypath), fullname))) p = os.path.relpath(dsopath, mypath)
if p != '.':
soargs.add('-Wl,-rpath,@loader_path/%s' % p)
# In theory '-dylib_file A:B' asks the linker to do the equivlaent of: # In theory '-dylib_file A:B' asks the linker to do the equivlaent of:
# install_name_tool -change A B # install_name_tool -change A B
...@@ -341,7 +343,7 @@ class build_dso(dso2libmixin, Command): ...@@ -341,7 +343,7 @@ class build_dso(dso2libmixin, Command):
if sys.platform == 'darwin': if sys.platform == 'darwin':
# we always want to produce relocatable (movable) binaries # we always want to produce relocatable (movable) binaries
# this install_name will be replaced below (cf. 'install_name_tool') # this install_name will be replaced below (cf. 'install_name_tool')
extra_args.extend(['-install_name', '@loader_path/%s'%solibbase]) extra_args.extend(['-install_name', '@rpath/%s'%solibbase, '-Wl,-rpath,@loader_path'])
elif sys.platform == "win32": elif sys.platform == "win32":
# The .lib is considered "temporary" for extensions, but not for us # The .lib is considered "temporary" for extensions, but not for us
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment