Replies: 3 comments 1 reply
-
Preventing
|
Beta Was this translation helpful? Give feedback.
-
Pull request #335 submitted as possible resolution. |
Beta Was this translation helpful? Give feedback.
-
Decided to go a much simpler way to resolve this. See d1c2312 |
Beta Was this translation helpful? Give feedback.
-
Thanks to Nikita Kniazev's work on marrying
clang-darwin
intogcc
(#281), clang on Darwin now also enjoys the delights of-rpath
linking.Below:
Overview - B2 functionality
Refer to B2 documentation for:
dll-path
&hardcode-dll-paths
, and also to FAQ 9.9. Why are the dll-path and hardcode-dll-paths properties useful?The
hardcode-dll-paths
documentation states:Overview - MacOS linking
From
man ld
(On a macOS 10.13.6);Options when creating a dynamic library (dylib)
-install_name name
Options that control symbol resolution
-rpath path
From
man dyld
;DYNAMIC LIBRARY LOADING
@executable_path/
@loader_path/
@rpath/
Observations & Deductions
At least since (unify clang-darwin linking with gcc #281) - and perhaps earlier for
gcc
- B2 do support the<dll-path>
&<hardcode-dll-paths>
features for macOS (or OSX, before rebranding). The mechanism works as follows:The host shared library is linked with an
-install_name "@rpath/library_name"
.This results in any other binary linked with it, to be predestined to use it's "run path list" to find it.
(Apparently consistent with other "Unix-type" platforms.)
The client binary (executable or other library) is linked with optional
-rpath
options.These options are determined by (in order):
Automatic (development) paths of linked shared libraries -
only for
exe
targets, and only for<hardcode-dll-paths>true
properties (default forexe
).Any
<dll-path>
properties set (explicitly) for the target.MacOS also supports
dylib @xxx/
placeholders for the-rpath
option - these provide additional flexibility for shared library locations.- but-
@xxx/
placeholders passed via<dll-path>
, to the resulting directory in the filesystem - just like a regular path.Beta Was this translation helpful? Give feedback.
All reactions