I am trying to install a solver written in C++ on my Mac (OS X), for use with code I have written in XCode.

The solver documentation says this:

Be sure to have "." in your DYLD_LIBRARY_PATH in order to

  • run the ready-built executables
  • link with the libamg.dylib (and the gfortran RTSlibs)

I don't really understand what this means. Where and what do I need to change what?

I have done some googling, but haven't come across anything that is simple enough for a newbie like me! If there are any patient people out there who wouldn't mind directing me to an online resource or giving me the a-b-cs of how and where to set environment variables, I would be very grateful.

link|improve this question
feedback

1 Answer

up vote 2 down vote accepted

It's an environment variable and as such is usually set in Terminal by

export DYLD_LIBRARY_PATH=someValue

man dyld says:

DYLD_LIBRARY_PATH

This is a colon separated list of directories that contain libraries. The dynamic linker searches these directories before it searches the default locations for libraries. It allows you to test new versions of existing libraries.

For each library that a program uses, the dynamic linker looks for it in each directory in DYLD_LIBRARY_PATH in turn. If it still can't find the library, it then searches DYLD_FALLBACK_FRAMEWORK_PATH and DYLD_FALLBACK_LIBRARY_PATH in turn.

Use the -L option to otool(1). to discover the frameworks and shared libraries that the executable is linked against.


You'd probably want something like

export DYLD_LIBRARY_PATH=.:$DYLD_LIBRARY_PATH

to prepend . (current directory) to the list of locations searched. On my unmodified OS X, DYLD_LIBRARY_PATH has no current value though:

$ echo $DYLD_LIBRARY_PATH

$

Depending on how you intent to run your program, you'd need to set this differently, e.g. in Xcode (I don't know where though).

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.