dylib not discovered in Application Package

I have a dylib that is required by a third party unit and is deployed to my application's contents/macos folder. When compiling to MacOS 64 bit, the application runs fine from the IDE but when I run the application stand alone on the mac, it fails to see the dylib and I get a "Library Missing" error report. If I physically put the dylib into my mac root folder the application runs again. I have tried placing the dylib into usr/lib but this also fails. Any ideas what is going on here? Why does it run from the IDE and not standalone? Any pointers greatly appreciated.

  • So after a lot more investigation it would appear that when compiling to a MacOS 32 bit build, the compiler links to the dylib using the prefix "@rpath/" which I guess tells the application to look in the path relative to the application. But when compiling to Mac OS 64 bit this prefix is not included so the application is looking for the dylib in the root directory. Surely this is a bug with the 64 bit compiler! It is certainly different behavior to the 32 bit compiler. I have to use Install_Name_Tool to manually fix this bug.