1

I followed the installation instructions (Mac OS) here:

https://gitlab.com/conradsnicta/armadillo-code/#5-linux-and-macos-installation

I successfully compiled the example code, as given here:

http://arma.sourceforge.net/docs.html#example_prog

by

g++ example1.cpp -o example1 -O2 -larmadillo

then I tried to run the output, but got the following error:

dyld: Library not loaded: @rpath/libhdf5.101.dylib
  Referenced from: /usr/local/lib/libarmadillo.9.dylib
  Reason: image not found
Abort trap: 6

Any ideas how to make it work?

Tom83B
  • 2,059
  • 4
  • 18
  • 28
  • https://stackoverflow.com/questions/8514783/what-is-the-exact-equivalent-to-ld-preload-on-osx – stark Sep 14 '18 at 11:18

2 Answers2

0

You need the -rpath linker option when building your application to tell the loader where to look for that library.

Usually a Mac application is it’s own folder tree known as a bundle. In there, you would put your library file and then list @executable_path/relative_path_to_library in your application binary as a place to look when the loader sees @rpath.

Further reading: Run-Path Dependent Libraries

Khouri Giordano
  • 1,426
  • 15
  • 17
0

I had the exact same error with Armadillo. What I did was first uninstall Armadillo (this might not be necessary). Then I did brew install armadillo --with-hdf5. Since this is a linking issue (Armadillo is looking for libhdf5.101.dylib in the wrong place) I next did brew link armadillo. Then if you get a conflicting file error, just do brew link --overwrite armadillo. Good luck!