[Xapian-tickets] [Xapian] #732: Consider using @rpath on OS X

Xapian nobody at xapian.org
Mon Aug 15 09:28:08 BST 2016


#732: Consider using @rpath on OS X
--------------------------+-----------------------------
 Reporter:  james         |             Owner:  olly
     Type:  defect        |            Status:  new
 Priority:  normal        |         Milestone:
Component:  Build system  |           Version:
 Severity:  normal        |        Resolution:
 Keywords:                |        Blocked By:
 Blocking:                |  Operating System:  Mac OS X
--------------------------+-----------------------------
Description changed by james:

Old description:

> OS X library linkage is by full path, but with an override using
> DYLD_LIBRARY_PATH (and friends) so that you can change the exact location
> of the library in use at runtime. However SIP (the system integrity
> protection) system on recent versions of OS X prevents DYLD_* environment
> variables from affecting "system" binaries, such as those in /usr/bin.
>
> There's an alternative way of linking OS X dynamic libraries. By setting
> the library name to "@rpath/<leafname>" (eg `install_name_tool -id
> '@rpath/libxapian.30.dylib' .libs/libxapian.30.dylib`, or `-install_name
> '@rpath/libxapian.30.dylib'` to the linker), the RPATH segments of binary
> objects is used instead. This then has to be set (using `-rpath` to the
> linker command), and edited (using `install_name_tool`).
>
> Either we could add both the build and install paths to all binaries
> built in-tree, or we could add the build version and then use
> `install_name_tool` on installation to change that to the install path.
> This would then allow us to drop all the DYLD_* use in -bindings, and
> should allow tests to run against system libraries (which is impossible
> at the moment because of DYLD_* pruning).
>
> `xapian-config --ldflags` would then have to include `-rpath <install-
> lib-path>` so that clients can link with the installed version of Xapian.
> (Allow out-tree binaries to link with the in-tree uninstalled version
> seems unnecessary and prone to complication.)
>
> Note that libtool already sets `-install_name`, and there doesn't seem to
> be a way of overriding it. (OS X ships with its own thing called
> 'libtool', but I've no idea how compatible / what version it is.)

New description:

 OS X library linkage is by full path, but with an override using
 DYLD_LIBRARY_PATH (and friends) so that you can change the exact location
 of the library in use at runtime. However SIP (the system integrity
 protection) system on recent versions of OS X prevents DYLD_* environment
 variables from affecting "system" binaries, such as those in /usr/bin.

 There's an alternative way of linking OS X dynamic libraries. By setting
 the library name to "@rpath/<leafname>" (eg `install_name_tool -id
 '@rpath/libxapian.30.dylib' .libs/libxapian.30.dylib`, or `-install_name
 '@rpath/libxapian.30.dylib'` to the linker), the RPATH segments of binary
 objects is used instead. This then has to be set (using `-rpath` to the
 linker command), and edited (using `install_name_tool`).

 Either we could add both the build and install paths to all binaries built
 in-tree, or we could add the build version and then use
 `install_name_tool` on installation to change that to the install path.
 This would then allow us to drop all the DYLD_* use in -bindings, and
 should allow tests to run against system libraries (which is impossible at
 the moment because of DYLD_* pruning).

 `xapian-config --ldflags` would then have to include `-rpath <install-lib-
 path>` so that clients can link with the installed version of Xapian.
 (Allow out-tree binaries to link with the in-tree uninstalled version
 seems unnecessary and prone to complication.)

 Note that GNU libtool on OS X already sets `-install_name`, and there
 doesn't seem to be a way of overriding it.

--

--
Ticket URL: <https://trac.xapian.org/ticket/732#comment:2>
Xapian <//xapian.org/>
Xapian



More information about the Xapian-tickets mailing list