[Scons-users] gdc on macOS seems to confuse RPATH variable

Louis Wust louiswust at fastmail.fm
Wed Mar 9 02:17:14 EST 2022


Greetings,

I am a macOS and Homebrew user. Recently I needed to install svn /
subversion using homebrew, but ran into problems similar to the one
described here:

  https://github.com/Homebrew/homebrew-core/issues/93294

  /usr/bin/clang -o libserf-1.1.3.0.dylib .......
  [...]
  ld: unknown option: -rpath=/usr/local/Cellar/subversion/1.14.1_4/libexec/serf/lib
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

I was able to get past the error by temporarily removing the
/usr/local/bin/gdc symlink, which pointed to the D language compiler
provided by the gcc homebrew recipe.

Upon further inspection, I believe that some of the scons construction
variables are unexpectedly referenced from the SCons.Tool.gdc class,
despite the build ultimately using the system clang/ld (applelink)
toolchain. Consider the following output with gcc not installed via
Homebrew:

  % which gdc
  gdc not found
  % cat SConstruct
  env = Environment()
  print(env.Dump())
  % scons | grep -E "RPATH.*:"
    'DRPATHPREFIX': '-L-rpath,',
    'DRPATHSUFFIX': '',
    '_DRPATH': '${_concat(DRPATHPREFIX, RPATH, DRPATHSUFFIX, __env__)}',
    '__DRPATH': '$_DRPATH',
    '__RPATH': '$_RPATH',
  %

And then the same commands, this time after running "brew install gcc" :

  % which gdc
  /usr/local/bin/gdc
  % cat SConstruct
  env = Environment()
  print(env.Dump())
  % scons | grep -E "RPATH.*:"
    'RPATHPREFIX': '-Wl,-rpath=',
    'RPATHSUFFIX': '',
    '_RPATH': '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}',
    '__DRPATH': '$_DRPATH',
    '__RPATH': '$_RPATH',
  %

Note how the RPATHSUFFIX changes to include an option format that
applelink / ld does not support.

Does this seem like a bug, that I should file on GitHub? What additional
information should I provide if so?

Thanks,
Louis


More information about the Scons-users mailing list