#41749: gdb: dyld: Library not loaded @rpath/libCore.so --------------------------+---------------------- Reporter: alkulakov@… | Owner: dweber@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: Port: gdb | --------------------------+---------------------- Comment (by cal@…): Replying to [comment:4 moo@…]:
I'm working on a project where we have to build our own versions of common things like openssl, as well as our own libraries. To run these programs from the command line, it's necessary to set the DYLD_LIBRARY_PATH, but once that is done everything works fine.
It is '''not''' necessary to set `DYLD_LIBRARY_PATH` in this case. If you ensure the binary you are running contains the correct absolute path of the library it will work just fine without `DYLD_LIBRARY_PATH` set. To do this, use `install_name_tool -change` on the binary, or ensure the libraries you link against contain the correct absolute path to themselves as the ID load command (the first line printed in `otool -L` output) before linking the binary. You can change the ID using `install_name_tool -id` or using the `-install_name` option of the `ld64` linker at link time of the library. Please read - `install_name_tool(1)`, - `ld64(1)`, section "Options when creating a dynamic library (dylib)" and - `dyld(1)`, section "DYLD_LIBRARY_PATH", especially the part where is says what `DYLD_LIBRARY_PATH` is supposed to do: "It allows you to test new versions of existing libraries." -- Ticket URL: <https://trac.macports.org/ticket/41749#comment:6> MacPorts <http://www.macports.org/> Ports system for OS X