• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Simple question on locating dynamic libraries at runtime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple question on locating dynamic libraries at runtime


  • Subject: Simple question on locating dynamic libraries at runtime
  • From: Chris Goedde <email@hidden>
  • Date: Wed, 4 Aug 2010 14:25:37 -0500

Hi all,

I'm adapting an existing Cocoa project to interface with Matlab, which requires linking to a dynamic library supplied by The Mathworks. I have it all set up so that compiling and linking works, but I can't figure out how to tell Xcode how to tell my app where to look for the dynamic library at run time. The library itself [libeng.dylib] lives in /Applications/MATLAB_R2009a.app/bin/maci, and I've created a sym link to this folder at /usr/local/matlab/bin.

The story so far:

If I go into the terminal and tunnel down into my app's bundle to the folder where the executable lives, set DYLD_LIBRARY_PATH to /usr/local/matlab/bin, and launch from the command line, then it works. If I double click the app in the Finder, however, it fails to launch because it can't find the library:

Dyld Error Message:
  Library not loaded: @loader_path/libeng.dylib
  Referenced from: /Volumes/Files/blah/blah/blah
  Reason: image not found

I tried setting "Runpath Search Paths" to /usr/local/matlab/bin under the Build panel for my target, but that doesn't work.

I set DYLD_LIBRARY_PATH to /usr/local/matlab/bin under the "Arguments" tab for my executable. With that setting, it launches fine from within Xcode, but not when double-clicked from the finder.

I guess I could copy the library itself into my project, but I would rather not do that because I'm afraid it'll create more work for me every time I upgrade Matlab. So my question is, how do I tell Xcode to tell my app to look in /usr/local/matlab/bin for this dynamic library? Or is that the wrong question?

Thanks.

Chris Goedde

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Simple question on locating dynamic libraries at runtime
      • From: Chris Goedde <email@hidden>
    • Re: Simple question on locating dynamic libraries at runtime
      • From: Marc Epard <email@hidden>
    • Re: Simple question on locating dynamic libraries at runtime
      • From: Sherm Pendley <email@hidden>
    • Re: Simple question on locating dynamic libraries at runtime
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: Only some breakpoints hit
  • Next by Date: Re: Simple question on locating dynamic libraries at runtime
  • Previous by thread: ld: warning: can't add line info to anonymous symbol
  • Next by thread: Re: Simple question on locating dynamic libraries at runtime
  • Index(es):
    • Date
    • Thread