Failure to find libraries for

Dear friends in AFNI,

I have been having trouble with R loading Namely, dyn.load(‘~/abin/’) returns the message below. Setting ‘DYLD_LIBRARY_PATH’ in my shell environment (zsh) has no effect. Similarly, setting DYLD_LIBRARY_PATH in my .Rprofile does not change the outcome.

The library in question (here libjpeg.9.dylib) is in under ~/abin/ . How can I make dyn.load abide by the library paths set for AFNI’s programs?

I am also attaching the output of -check_all. The output shows DYLD_LIBRARY_PATH to be empty, even though on the command line the variable points to the right path, and afni/suma launch fine.

Thanks in advance.

> dyn.load(‘~/abin/’)
Error in dyn.load(“~/abin/”) :
unable to load shared object ‘/Users/zsaad/abin/’:
dlopen(/Users/zsaad/abin/, 0x0006): Library not loaded: /sw/lib/libjpeg.9.dylib
Referenced from: /Users/zsaad/abin/
Reason: tried: ‘/sw/lib/libjpeg.9.dylib’ (no such file), ‘/Library/Frameworks/R.framework/Resources/lib/libjpeg.9.dylib’ (no such file), ‘/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjpeg.9.dylib’ (no such file)

Output of -check_all:
-------------------------------- general ---------------------------------
architecture: 64bit
system: Darwin
release: 21.5.0
version: Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101
distribution: 12.4
number of CPUs: 8
apparent login shell: zsh
shell RC file: .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /Users/zsaad/abin/afni
afni version : Precompiled binary macos_10.12_local: Aug 5 2022
: AFNI_22.2.05 ‘Marcus Aurelius’
AFNI_version.txt : AFNI_22.2.05, macos_10.12_local, Aug 05 2022
which python : /opt/homebrew/opt/python/libexec/bin/python
python version : 3.10.6
which R : /Library/Frameworks/R.framework/Resources/R
R version : R version 3.6.3 (2020-02-29) – “Holding the Windsock”
which tcsh : /bin/tcsh

instances of various programs found in PATH:
afni : 1 (/Users/zsaad/abin/afni)
R : 1 (/Library/Frameworks/R.framework/Versions/3.6/Resources/bin/R)
python : 1 (/opt/homebrew/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/bin/python3.10)
python2 : 0
python3 : 2

** have python3 but not python2

testing ability to start various programs…
afni : success
suma : success
3dSkullStrip : success : success
3dAllineate : success
3dRSFC : success
SurfMesh : success
3dClustSim : success
3dMVM : success

checking for R packages…
rPkgsInstall -pkgs ALL -check : FAILURE

    oo Warning: 
       These packages are not installed on the computer: paran!
    These packages are not installed on the computer: brms!
    These packages are not installed on the computer: corrplot!
    These packages are not installed on the computer: metafor!

R RHOME : /Library/Frameworks/R.framework/Resources

checking for $HOME files…
.afnirc : found
.sumarc : found
.afni/help/all_progs.COMP : found

------------------------------ python libs -------------------------------
** failed to load module PyQt4
– PyQt4 is no longer needed for an AFNI bootcamp

** failed to load module matplotlib.pyplot
– matplotlib.pyplot is required

-------------------------------- env vars --------------------------------
PATH = /opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/X11/bin:/opt/homebrew/opt/python/libexec/bin:/Library/Frameworks/R.framework/Resources:/usr/local/gfortran/bin:/Users/zsaad/abin:/opt/homebrew/opt/python/libexec/bin:/Library/Frameworks/R.framework/Resources:/usr/local/gfortran/bin:/Users/zsaad/abin:/opt/homebrew/opt/python/libexec/bin:/Library/Frameworks/R.framework/Resources:/usr/local/gfortran/bin:/Users/zsaad/OD/zbin_PlatInd:/Users/zsaad/gproj/nsbiom/scr:/Users/zsaad/software/


------------------------------ data checks -------------------------------
data dir : found AFNI_data6 under $HOME (233752M Avail)
top history: 20 Feb 2020 [rickr]: updated FT_analysis examples
data dir : found AFNI_demos under $HOME
top history: …ct 2020 [taylorp]: updated scripts under FATCAT_DEMO
data dir : found suma_demo under $HOME
top history: …s_New/data/Build_tmp on Mon Mar 4 11:56:45 EST 2013
data dir : found afni_handouts under $HOME
atlas : found TT_N27+tlrc under /Users/zsaad/abin

------------------------------ OS specific -------------------------------
XQuartz version : 2.8.2

which brew : /opt/homebrew/bin/brew
brew version : Homebrew 3.5.9

– for PyQt4 under brew, consider running:
brew install cartr/qt4/pyqt
++ found 2 dylib files under ‘/opt/X11/lib/flat_namespace’
– found ‘libXt’ dylib files:
** env var DYLD_LIBRARY_PATH is not set to contain /opt/X11/lib/flat_namespace
(so afni and suma may fail)

========================= summary, please fix: =========================

  • just be aware: login shell ‘zsh’, but our code examples use ‘tcsh’
  • missing R packages (see rPkgsInstall)
  • python library matplotlib is required
    (see AFNI install docs for details)
  • OS X version might be old
  • consider setting DYLD_LIBRARY_PATH to /opt/X11/lib/flat_namespace

Hey there Z,

Set the R version of it, R_LD_LIBRARY_PATH, as in scripts like 3dMVM.

export R_LD_LIBRARY_PATH=$(R RHOME)/lib:$HOME/abin:/opt/X11/lib/flat_namespace

Hopefully I have that syntax correct…

  • rick

Thank you, Rick!

BTW: I love the new AFNI installation process for macs.


Thanks. That has been quite the group effort, and is still a work in progress for the moving target that is macos… :slight_smile:

  • rick