capenalo / xuggle

Automatically exported from code.google.com/p/xuggle
3 stars 1 forks source link

OSX: Setting DYLD_LIBRARY_PATH breaks everything that uses the dynamic linker #311

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
For example, https://trac.macports.org/ticket/42188

-- What steps will reproduce the problem?

1. Install Xuggler on OSX

2. Use Terminal to run any program which requires a newer version of any dylib 
in /usr/local/xuggler/lib

-- What is the expected output?

Unchanged from before installing Xuggler

-- What do you see instead?

An error message about an incompatible library version.
For exmple, from macports ffmpeg:

dyld: Library not loaded: /opt/local/lib/libogg.0.dylib
  Referenced from: /opt/local/bin/ffmpeg
  Reason: Incompatible library version: ffmpeg requires version 9.0.0 or later, but libogg.0.dylib provides version 6.0.0
Trace/BPT trap: 5

-- What operating system and JVM version are you using.

Mac OS X 10.7.5

java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

-- Attach relevant log/output files.

man page for dyld: 
https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/
man1/dyld.1.html
Note that DYLD_LIBRARY_PATH "allows you to test new versions of existing 
libraries"; it tells the loader to overrides the paths given in executables 
with the path in DYLD_LIBRARY_PATH.  This makes sense for developer testing, 
not for deployment.

man page for install_name_tool: 
http://www.unix.com/man-page/OSX/1/install_name_tool/
If the Xuggler executables can't be distributed with references to the dynamic 
library paths used by the installer, the installer should use install_name_tool 
to change the references to the paths used by the installer.
(Apple doesn't have this man page on their site, but does have the source code: 
https://www.opensource.apple.com/source/cctools/cctools-750/misc/install_name_to
ol.c )

an example of using install_name_tool for bundled libraries: 
http://ynniv.com/blog/2006/02/deploying-app-that-use-dylibs-on-mac.html

an example of using install_name_tool in an xcode Run Script Build Phase: 
http://lessons.runrev.com/s/lessons/m/4071/l/15029-linking-an-osx-external-bundl
e-with-a-dylib-library

install_name_tool can only change names within the space allocated at build 
time: stackoverflow.com/questions/13495315

Original issue reported on code.google.com by polyergic on 19 Jan 2014 at 3:07