R_io.so error message: Library not loaded: /sw/lib/libXm.4.dylib

Hi-

I recently installed AFNI on a Mac:


$ afni -ver
Precompiled binary macos_10.12_local: Nov 27 2017 (Version AFNI_17.3.05)

and most things look fine, but when I try to run the following AFNI Bootcamp script that calls 3dANOVA, I get the following error:


$ tcsh MVM.txt 

oo Warning: 
   Failed to load R_io.so with this error message:

Error in dyn.load(ll) : 
  unable to load shared object '/Users/xyz/abin/R_io.so':
  dlopen(/Users/xyz/abin/R_io.so, 6): Library not loaded: /sw/lib/libXm.4.dylib
  Referenced from: /Users/xyz/abin/R_io.so
  Reason: image not found
Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
Execution halted

I get the same error even trying to run “rPkgsInstall -pkgs ALL”.

Any suggestions would be great, thanks.

Could you paste the output of the following command?

afni_system_check.py -check_all

Hi-


-------------------------------- general ---------------------------------
architecture:         64bit 
system:               Darwin
release:              17.2.0
version:              Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64
distribution:         10.13.1 x86_64
number of CPUs:       4
apparent login shell: bash
shell RC file:        .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           : /Users/xyz/abin/afni
afni version         : Precompiled binary macos_10.12_local: Nov 27 2017 
                     : AFNI_17.3.05
AFNI_version.txt     : AFNI_17.3.05, macos_10.12_local, Nov 27 2017
which python         : /usr/bin/python
python version       : 2.7.10
which R              : /usr/local/bin/R
R version            : R version 3.4.2 (2017-09-28) -- "Short Summer"
which tcsh           : /bin/tcsh

instances of various programs found in PATH:
    afni    : 1   (/Users/xyz/abin/afni)
    R       : 1   (/Library/Frameworks/R.framework/Versions/3.4/Resources/bin/R)
    python  : 1   (/usr/bin/python)
    python2 : 1   (/usr/local/Cellar/python/2.7.14/Frameworks/Python.framework/Versions/2.7/bin/python2.7)
    python3 : 1   (/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/bin/python3.6)


testing ability to start various programs...
    afni                 : success
    suma                 : success
    3dSkullStrip         : success
    uber_subject.py      : success
    3dAllineate          : success
    3dRSFC               : success
    SurfMesh             : success
    3dClustSim           : success

checking for R packages...
    rPkgsInstall -pkgs ALL -check : FAILURE
        Error in dyn.load(ll) : 
          unable to load shared object '/Users/xyz/abin/R_io.so':
          dlopen(/Users/xyz/abin/R_io.so, 6): Library not loaded: /sw/lib/libXm.4.dylib
          Referenced from: /Users/xyz/abin/R_io.so
          Reason: image not found
        Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
        Execution halted

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

------------------------------ python libs -------------------------------
** python module not found: PyQt4
-- PyQt4 is no longer needed for an AFNI bootcamp

-------------------------------- env vars --------------------------------
PATH = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/xyz/abin

PYTHONPATH = /usr/local/lib/python2.7/site-packages

R_LIBS = 
LD_LIBRARY_PATH = 
DYLD_LIBRARY_PATH (sub-shell) = /opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) = /Users/xyz/abin

------------------------------ data checks -------------------------------
data dir : found AFNI_data6   under $HOME/CD
           top history: ...PPI scripts are now based on FT_analysis/s05.ap.uber
data dir : found AFNI_demos   under $HOME/CD
           top history: ... [pault]: remove rank from FATCAT_DEMO, FAT_MVM_DEMO
data dir : found suma_demo    under $HOME/CD
           top history: .../SUMA_data/Build_tmp on Wed Aug 20 10:04:23 EDT 2014
data dir : found afni_handouts under $HOME/Documents/AFNI
atlas    : found TT_N27+tlrc  under /Users/xyz/abin

------------------------------ OS specific -------------------------------
which brew           : /usr/local/bin/brew
brew version         : Homebrew 1.3.9

-- for PyQt4 under brew, consider running:
   brew install cartr/qt4/pyqt
++ found valid link /usr/local/lib/libgomp.1.dylib
   to /usr/local/Cellar/gcc/7.2.0/lib/gcc/7/libgomp.1.dylib
++ found valid link /usr/local/lib/libglib-2.0.dylib
   to ../Cellar/glib/2.54.2/lib/libglib-2.0.dylib
++ found 1 dylib files under '/opt/X11/lib/flat_namespace'
   -- found 'libXt' dylib files:
      /opt/X11/lib/flat_namespace/libXt.6.dylib
-- recent OS X, cheating to check DYLD_LIBRARY_PATH in cur shell 'bash'...
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace
-- recent OS X, cheating to check DYLD_LIBRARY_PATH in shell 'tcsh'...
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace

=========================  summary, please fix:  =========================
*  login shell 'bash', trusting user to translate from 'tcsh'
*  shell bash: consider sourcing (non-login) .bashrc from (login) .bash_profile
*  missing R packages (see rPkgsInstall)



Thanks.

R does not like the method we use for loading
libraries that are local to the distribution. I will
look into this.

If you want to try a different package, go with
the 10.7 version:

@update.afni.binaries -package macosx_10.7_local

  • rick

Rick, I wonder if the issue might have something to do with the following line in abin/rPkgsInstall.R:

lop$site ← ‘http://cran.mtu.edu/

If so, would replacing the above line with the following fix the issue?

lop$site ← ‘http://cran.us.r-project.org

Hi Gang,

This seems to be about loading our R_io.so library, which
has its own dependencies, for which we want it to search
in the same directory (abin). Daniel and I have been doing
some searching, but have not found a solution.

So without installing the libraries we are trying to let people
avoid, it seems that no one using the local packages should
be able run the R programs.

The library mechanism for R does not seem to allow for
@executable_dir.

  • rick

Hi Rick,

Thank you very much!

-upps

Hi Gang,

AFNI version 22 Aug 2019 has similar issue.

2086

Hi 2086

To be sure, what is the actual error? That is with the 10.12_local package?

Thanks,

  • rick

Hi Rick,

Thanks for your reply. I have re-installed AFNI to previous version(Jul 25 2019), I remember the error message was:

R_io.so error message: Library not loaded: /sw/lib/libXm.6.dylib

The afni_check of current installation:

-------------------------------- general ---------------------------------
architecture: 64bit
system: Darwin
release: 18.7.0
version: Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64
distribution: 10.14.6 x86_64
number of CPUs: 12
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /usr/local/afni/afni
afni version : Precompiled binary macos_10.12_local: Jul 25 2019
: AFNI_19.2.05 ‘Claudius’
AFNI_version.txt : AFNI_19.2.05, macos_10.12_local, Jul 25 2019
which python : /usr/bin/python
python version : 2.7.10
which R : /usr/local/bin/R
R version : R version 3.5.2 (2018-12-20) – “Eggshell Igloo”
which tcsh : /bin/tcsh

instances of various programs found in PATH:
afni : 1 (/usr/local/afni/afni)
R : 1 (/Library/Frameworks/R.framework/Versions/3.5/Resources/bin/R)
python : 1 (/usr/bin/python)
python2 : 0
python3 : 1 (/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/bin/python3.7)

** have python3 but not python2

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

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

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

------------------------------ python libs -------------------------------
** python module not found: PyQt4
– PyQt4 is no longer needed for an AFNI bootcamp

-------------------------------- env vars --------------------------------
PATH = /usr/local/ants/bin/:/usr/local/fsl/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/usr/local/afni:/Applications/MATLAB_R2019a.app/bin:/Users/z/Documents/OneDrive/Sync/Scripts

PYTHONPATH =
R_LIBS =
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH (sub-shell) = :/opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) =

------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas : found TT_N27+tlrc under /usr/local/afni

------------------------------ OS specific -------------------------------
which brew : /usr/local/bin/brew
brew version : Homebrew 2.1.10

– for PyQt4 under brew, consider running:
brew install cartr/qt4/pyqt
– consider installing gcc under homebrew
++ found valid link /usr/local/lib/libglib-2.0.dylib
to …/Cellar/glib/2.60.6/lib/libglib-2.0.dylib
++ found 1 dylib files under ‘/opt/X11/lib/flat_namespace’
– found ‘libXt’ dylib files:
/opt/X11/lib/flat_namespace/libXt.6.dylib
– recent OS X, cheating to check DYLD_LIBRARY_PATH in cur shell ‘bash’…
++ found evar DYLD_LIBRARY_PATH = :/opt/X11/lib/flat_namespace
– recent OS X, cheating to check DYLD_LIBRARY_PATH in shell ‘tcsh’…
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace

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

  • login shell ‘bash’, trusting user to translate code examples from ‘tcsh’
  • insufficient data for AFNI bootcamp

Thanks,
2086

Hi Rick,

The latest AFNI (version Aug 29 2019) still has this issue:

Error message when source AFNIio.R in R:

source(“/usr/local/afni/AFNIio.R”)

oo Warning:
Failed to load R_io.so with this error message:

Error in dyn.load(ll) :
unable to load shared object ‘/usr/local/afni/R_io.so’:
dlopen(/usr/local/afni/R_io.so, 6): Library not loaded: /sw/lib/libXt.6.dylib
Referenced from: /usr/local/afni/R_io.so
Reason: image not found

afni_check info:

-------------------------------- general ---------------------------------
architecture: 64bit
system: Darwin
release: 18.7.0
version: Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64
distribution: 10.14.6 x86_64
number of CPUs: 12
apparent login shell: bash
shell RC file: .bashrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /usr/local/afni/afni
afni version : Precompiled binary macos_10.12_local: Aug 29 2019
: AFNI_19.2.21 ‘Claudius’
AFNI_version.txt : AFNI_19.2.21, macos_10.12_local, Aug 29 2019
which python : /usr/bin/python
python version : 2.7.10
which R : /usr/local/bin/R
R version : R version 3.5.2 (2018-12-20) – “Eggshell Igloo”
which tcsh : /bin/tcsh

instances of various programs found in PATH:
afni : 1 (/usr/local/afni/afni)
R : 1 (/Library/Frameworks/R.framework/Versions/3.5/Resources/bin/R)
python : 1 (/usr/bin/python)
python2 : 0
python3 : 1 (/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/bin/python3.7)

** have python3 but not python2

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

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

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

++ module loaded: matplotlib.pyplot
module file : /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.pyc

-------------------------------- env vars --------------------------------
PATH = /usr/local/ants/bin/:/usr/local/fsl/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/usr/local/afni:/Applications/MATLAB_R2019a.app/bin:/Users/z/Documents/OneDrive/Sync/Scripts

PYTHONPATH =
R_LIBS =
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH (sub-shell) = :/opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) =

------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas : found TT_N27+tlrc under /usr/local/afni

------------------------------ OS specific -------------------------------
which brew : /usr/local/bin/brew
brew version : Homebrew 2.1.11

– for PyQt4 under brew, consider running:
brew install cartr/qt4/pyqt
– consider installing gcc under homebrew
++ found valid link /usr/local/lib/libglib-2.0.dylib
to …/Cellar/glib/2.60.6/lib/libglib-2.0.dylib
++ found 1 dylib files under ‘/opt/X11/lib/flat_namespace’
– found ‘libXt’ dylib files:
/opt/X11/lib/flat_namespace/libXt.6.dylib
– recent OS X, cheating to check DYLD_LIBRARY_PATH in cur shell ‘bash’…
++ found evar DYLD_LIBRARY_PATH = :/opt/X11/lib/flat_namespace
– recent OS X, cheating to check DYLD_LIBRARY_PATH in shell ‘tcsh’…
++ found evar DYLD_LIBRARY_PATH = /opt/X11/lib/flat_namespace

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

  • login shell ‘bash’, trusting user to translate code examples from ‘tcsh’
  • insufficient data for AFNI bootcamp

Thank you,
2086

What are you doing to get that error, sourcing from R? The system check shows success with 3dMVM.

Thanks,

  • rick

Hi Rick,

Thanks for your reply. Yes, when sourcing from R. I use read.AFNI in R to do some data extraction, then do some calculation with R, and read.AFNI in R works more quickly than in Matlab. AFNI version before Jul 25 2019 works well, I did not test all versions after that, but version 22 Aug 2019 and version Aug 29 2019 showed the same error message.

Thank you,
2086

Hi 2086,

Okay, that is helpful to know. Due to the way macs now restrict dynamic loading, R_io.so will probably not change its style of handling that any time soon. So when loading it directly in R, you should use the method applied in the similar R programs, such as 3dMVM (a very short shell script). See how it sets R_LD_LIBRARY_PATH, and apply that in your own shell.

Hopefully that will work better.

  • rick

It works now, thank you Rick!

Hi Rick,
Is there a way to make source("/usr/local/afni/AFNIio.R") works in RStudio? It did work for R in terminal after add “R_LD_LIBRARY_PATH” in bashrc; but I could not make it work in RStudio. I tried to add lines below into ~/.Renviron file:


PATH=${PATH}:/usr/local/afni
DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH=${R_HOME}/lib:/usr/local/afni:/opt/X11/lib/flat_namespace:/Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server
R_LD_LIBRARY_PATH=${R_HOME}/lib:/usr/local/afni:/opt/X11/lib/flat_namespace

But it show this error when source("/usr/local/afni/AFNIio.R") :


Error in dyn.load(ll) : 
  unable to load shared object '/usr/local/afni/R_io.so':
  dlopen(/usr/local/afni/R_io.so, 6): Library not loaded: /sw/Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libR.dylib
  Referenced from: /usr/local/afni/R_io.so
  Reason: image not found

Thanks,
2086