🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

Commit 96cb1d0

Browse files
authored
Merge pull request #2897 from swt2c/use_rpath_link_arg
Set rpath in link arguments rather than LD_RUN_PATH
2 parents 857b1b1 + 5cdc264 commit 96cb1d0

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎build.py‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,16 +1770,11 @@ def _getWxCompiler(flag, compName, flagName):
17701770
build_options.append('--gtk3')
17711771
wafBuildDir = posixjoin(wafBuildBase, 'gtk3')
17721772

1773+
if options.no_magic:
1774+
build_options.append('--no_magic')
17731775
build_options.append('--python="%s"' % PYTHON)
17741776
build_options.append('--out=%s' % wafBuildDir) # this needs to be the last option
17751777

1776-
if not isWindows and not isDarwin and not options.no_magic and not options.use_syswx:
1777-
# Using $ORIGIN in the rpath will cause the dynamic linker to look
1778-
# for shared libraries in a folder relative to the loading binary's
1779-
# location. Here we'll use just $ORIGIN so it should look in the same
1780-
# folder as the wxPython extension modules.
1781-
os.environ['LD_RUN_PATH'] = '$ORIGIN'
1782-
17831778
# Regenerate the _sysconfigdata module?
17841779
if options.regenerate_sysconfig:
17851780
do_regenerate_sysconfig()

‎wscript‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def configure(conf):
193193
conf.env.CXXFLAGS_WXPY = list()
194194

195195
# Check wx-config exists and fetch some values from it
196-
rpath = ' --no-rpath' if not conf.options.no_magic else ''
196+
rpath = ' --no-rpath'
197197
conf.check_cfg(path=conf.options.wx_config, package='',
198198
args='--cxxflags --libs core,net' + rpath,
199199
uselib_store='WX', mandatory=True,
@@ -325,6 +325,13 @@ def configure(conf):
325325
conf.env.LIBPATH_PYEXT = []
326326
conf.env.LIB_PYEXT = []
327327

328+
# Use an explicit -Wl,-rpath,$ORIGIN linker flag rather than relying on
329+
# LD_RUN_PATH. GNU ld silently ignores LD_RUN_PATH whenever any explicit
330+
# -rpath flag appears on the command line (e.g. one injected by pyenv
331+
# Python via sysconfig LDFLAGS). Explicit -rpath entries accumulate, so
332+
# both the pyenv path and $ORIGIN will be present in the final binary.
333+
if not isDarwin and not conf.options.no_magic:
334+
conf.env.append_value('LINKFLAGS_WXPY', ['-Wl,-rpath,$ORIGIN'])
328335

329336
# Use the same compilers that wxWidgets used
330337
if cfg.CC:

0 commit comments

Comments
 (0)