This is an archive of the discontinued LLVM Phabricator instance.

Add @loader_path to rpath on mac
AbandonedPublic

Authored by dschuff on Oct 7 2016, 3:11 PM.

Details

Reviewers
beanz
Summary

Currently @executable_path/../lib is used as the rpath for mac builds.
When using LLVM_LINK_LLVM_DYLIB, libLTO.dylib is linked against libLLVM.dylib,
just like all the executables. However libLTO fails to load because in this
case the executable is ld (instead of one of the LLVM tools) which is in a
different location. Adding @loader_path to the rpath list fixes this
problem.

Event Timeline

dschuff updated this revision to Diff 73994.Oct 7 2016, 3:11 PM
dschuff retitled this revision from to Add @loader_path to rpath on mac.
dschuff updated this object.
dschuff added a subscriber: llvm-commits.

So this seems to work but I'm not sure if it's the best solution; I'm hoping an OSX and/or CMake expert can help. Should I make it conditional on -DLLVM_LINK_LLVM_DYLIB? Can/should it be done just for libLTO and not for the executable tools? Something else?

dschuff updated this revision to Diff 73996.Oct 7 2016, 3:15 PM
  • ../lib is redundant
beanz edited edge metadata.Oct 7 2016, 7:55 PM

There is actually a refactoring of this code being reviewed at the moment, which should address this issue. See D25304.

Great, thanks! I'll try that one then.

dschuff abandoned this revision.Nov 11 2016, 4:47 PM

Fixed in rL285714, thanks!