Problems running Lensed

The program cannot find the MultiNest library.

When MultiNest was not installed to a default system path such as /usr/lib, it is possible that the linker cannot find the shared library (Linux) or libmultinest.dylib (Mac OS X).

The easiest fix is to link the shared library into the bin/ folder of Lensed, side by side with the program executable.

$ # in Lensed's root directory
$ cd bin
$ ls
$ ln -s /path/to/ # .dylib on Mac OS X

After this, the program should be able to load the shared library.

The program crashes when loading the MultiNest library.

This error usually occurs when the program tries to load a version of MultiNest that is not binary-compatible with the one Lensed was linked against.

For binary releases, please take a careful look at the version requirements for the MultiNest library. For maintainability, releases are not linked against a particular shared library version of MultiNest (i.e. on Linux or libmultinest.3.9.dylib on Mac OS X), but rather against the generic or libmultinest.dylib library. This is because MultiNest's shared library version increases by default with every new version, even though the libraries might be binary-compatible. To prevent either having to link the binaries against many versions of MultiNest, or forcing users to recompile the MultiNest library even though it is binary-compatible, the program links with the version-less shared library name.

The program complains that other shared libraries cannot be loaded.

Note: When building Lensed, this can be fixed at the compiler level, see here.

This error occurs when the dynamic library loader cannot find shared libraries on which parts of Lensed (for example MultiNest) depends. These libraries are usually the Fortran runtime, LAPACK or BLAS, or system libraries.

To diagnose which libraries cannot be found, use (on Linux)

$ ldd bin/lensed => /usr/local/lib/ => /usr/lib/fglrx/ => /lib/x86_64-linux-gnu/ => /lib/x86_64-linux-gnu/ => /lib/x86_64-linux-gnu/ => /usr/lib/x86_64-linux-gnu/ => /lib/x86_64-linux-gnu/

or (on Mac OS X)

$ otool -L bin/lensed 

If any libraries result as not found, it is necessary to make their location explicitly known. This can be done using the respective environment variables LD_LIBRARY_PATH (on Linux) or DYLD_LIBRARY_PATH (on Mac OS X).

For example, in order to make known the location of a shared library located at $HOME/lib, one could call Lensed as (Linux)


or (Mac OS X)


After finding the correct setting, it is possible to create a small script that automatically calls Lensed with this environment variable set. The following snippet should be saved as bin/


export LD_LIBRARY_PATH=... # your settings here

$(dirname $0)/lensed $@

Make sure to edit the line containing LD_LIBRARY_PATH appropriately for your system, changing the name to DYLD_LIBRARY_PATH on Mac OS X. Then, make the script executable using

$ chmod +x bin/

and call the wrapper script bin/ whenever you would normally call Lensed directly.

Problems building Lensed

Some of Lensed's dependencies cannot be resolved.

Please see the section on configuring Lensed's build system.

The linker complains that shared libraries cannot be loaded.

Note: This is different from required libraries that cannot be found.

This issue usually occurs when some of the successfully linked shared libraries depend dynamically on further shared libraries which cannot be resolved.

After locating the unresolved files, e.g. /opt/lib/, the search path for dynamic linking can be augmented as follows:

$ make EXTRA_LIBS="-Wl,-rpath,/opt/lib" # plus eventual other EXTRA_LIBS flags

This instructs the linker to look into /opt/lib when trying to resolve shared libraries.