Bug 10791 - Shared libraries installed with wrong install_name on Mac OS X (Darwin)
Shared libraries installed with wrong install_name on Mac OS X (Darwin)
Status: NEW
Product: TALLOC
Classification: Unclassified
Component: libtalloc
unspecified
x64 Mac OS X
: P5 major
: ---
Assigned To: Simo Sorce
Samba QA Contact
:
Depends on: 10885
Blocks:
  Show dependency treegraph
 
Reported: 2014-08-29 20:14 UTC by J. Lewis Muir
Modified: 2015-10-28 12:40 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description J. Lewis Muir 2014-08-29 20:14:11 UTC
=Overview=

When building and installing talloc 2.1.1 on Mac OS X Mavericks (10.9.4) (Darwin 13.3.0), the shared libraries are installed with the wrong install_name.  That is, the install_name refers to the path where the library was built rather than the path where the library is installed.  This makes programs unable to find and load these shared libraries.

=Steps to Reproduce=

To reproduce the problem (assuming the user has write permissions to /opt) we do:

$ cd /Users/jlmuir/tmp
$ curl -O http://www.samba.org/ftp/talloc/talloc-2.1.1.tar.gz
$ tar xzf talloc-2.1.1.tar.gz
$ cd talloc-2.1.1
$ ./configure --prefix=/opt/talloc-2.1.1
$ make
$ make install

=Actual Results=

Now, using otool to examine the shared libraries, we see that the install_name entries are wrong; that is, they reference paths under the build location (/Users/jlmuir/tmp), but they should only reference paths under the install location (/opt/talloc-2.1.1):

$ otool -L /opt/talloc-2.1.1/lib/libtalloc.dylib 
/opt/talloc-2.1.1/lib/libtalloc.dylib:
	/Users/jlmuir/tmp/talloc-2.1.1/bin/default/libtalloc.inst.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

$ otool -L /opt/talloc-2.1.1/lib/libpytalloc-util.dylib 
/opt/talloc-2.1.1/lib/libpytalloc-util.dylib:
	/Users/jlmuir/tmp/talloc-2.1.1/bin/default/libpytalloc-util.inst.dylib (compatibility version 0.0.0, current version 0.0.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.17.0)
	/Users/jlmuir/tmp/talloc-2.1.1/bin/default/libtalloc.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
	/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)

$ otool -L /opt/talloc-2.1.1/lib/python2.7/site-packages/talloc.so 
/opt/talloc-2.1.1/lib/python2.7/site-packages/talloc.so:
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.17.0)
	/Users/jlmuir/tmp/talloc-2.1.1/bin/default/libpytalloc-util.dylib (compatibility version 0.0.0, current version 0.0.0)
	/Users/jlmuir/tmp/talloc-2.1.1/bin/default/libtalloc.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
	/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)

=Expected Results=

$ otool -L /opt/talloc-2.1.1/lib/libtalloc.dylib 
/opt/talloc-2.1.1/lib/libtalloc.dylib:
	/opt/talloc-2.1.1/lib/libtalloc.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

Similarly for /opt/talloc-2.1.1/lib/libpytalloc-util.dylib and /opt/talloc-2.1.1/lib/python2.7/site-packages/talloc.so.

=Additional Information=

May be related to bug 9665.

How to build a shared library on Mac OS X: <http://www.finkproject.org/doc/porting/porting.en.html#shared.build-lib>.