Search code examples
xcoderpath

Xcode does not set Runpath Search Paths to binary


I build a Xcode Application in Objective C, which uses a lot of libraries using rpath to find dependent dylibs. Now i want to add a few rpath settings to my binary, so that it always finds the corresponding libs.

When i use this command: install_name_tool -add_rpath /Path/to/Lib

It works perfectly.But i don't want to run install name tool after each build to be able to debug. Is it possible to set the rpath settings somewhere in Xcode ?

I found the setting "Runpath Search Paths" in xcode settings. But if i set the pathes there, xcode does not write them to the binary. If i run "otool -l" after building there is no rpath set. If i check with otool after using install_name_tool all is fine and the rpath is set up.

Could anyone tell me how i can tell xcode to set up the rpath things correctly ?

At the moment i use Xcode 7.3.1 due to compatibility reasons in our company.


Solution

  • I found the solution meanwhile.

    I did not add it to Debug or Release in the "Runpath Search Paths" settings. I added it to the "Any architecture" setting which obviously was ignored. After setting it to Debug / Release it worked fine. Maybe it helps someone.