theshadow124
theshadow124

Reputation: 671

Dyld Error Message: Library not loaded: /usr/lib/libusb-1.0.2.dylib OSX

I am trying to release an app for OSX but every time someone runs the app on their machine they get:

Dyld Error Message:
  Library not loaded: /usr/lib/libusb-1.0.2.dylib
  Referenced from: /Users/USER/Desktop/____.app/Contents/MacOS/____
  Reason: image not found

The guy on this post suggests it is the path that the package was built with Dyld: Library not Loaded Error Mac OS But even if I build the app with no prefix I still have the issue.

Then I tried to build using:

./configure --disable-dependency-tracking --disable-static --prefix=@executable_path/../Frameworks/

But that gave a error of an invalid path. I am including the dylib in the package. I have to use libusb 1.0.16RC10 because there is a bug in the newest stable release that breaks mouse and keyboard functionality on the MBP for a short period of time ever time you scan for devices.

Please tell me there is a way to have it included that every use doesnt have to compile their own libUSB.

Upvotes: 1

Views: 3838

Answers (1)

Michael Dautermann
Michael Dautermann

Reputation: 89509

So if you're including your .dylib within the framework directory, now you just need to run the "install_name_tool" to point your app to that dylib within the application package, instead of "/usr/lib".

To do this, add a "Run Script" build step after the compiling and linking has finished. And in this build phase, the script will be as simple as:

install_name_tool -id @executable_path/../Frameworks/libusb-1.0.2.dylib path/to/your/project/libusb-1.0.2.dylib

The tutorial I'm looking at can be found here. I hope this helps you out!

Upvotes: 2

Related Questions