Problems with runtime linking of R-extension
Am 23.02.2018 um 11:14 schrieb Keith O'Hara <keith.ohara at nyu.edu>: Try adding '/usr/local/lib' to DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH.
Unfortunately setting these variables (or LD_LIBRARY_PATH) to /usr/local/lib does not help with the error message.
If that doesn't fix the problem, try modifying the install name of libaf to include /usr/local/lib. Something like: sudo install_name_tool -id /usr/local/lib/libaf.dylib /usr/local/lib/libaf.dylib or sudo install_name_tool -id /usr/local/lib/libaf.3.dylib /usr/local/lib/libaf.3.dylib
This helps to some extend, similar to adding ?-rpath /usr/local/lib? to PKG_LIBS. I am then able to load the library. However, ArrayFire does not find/load its backend libraries libafcpu.dynlib and libafopencl.dynlib, which are also located in /usr/local/lib and therefore reports ?backends: 0". This does not happen with the plain C program that correctly finds two available backends. To make things even stranger, the above is true when I start R from the Terminal. When using R.app or RStudio, I can load minimal.so (even without rpath option or manipulating the install name) and calling the count_backends function gives the correct result. What does R.app and RStudio to differently from R in the Terminal? Thanks Ralf