error loading R_io.so

Hello,

I’m having issues with R programs because R_io.so is not loading. I’m using a MacBook pro M1 Max and zsh.

    Error in dyn.load(ll) :
      unable to load shared object '/Users/ccg/abin/R_io.so':
      dlopen(/Users/ccg/abin/R_io.so, 0x0006): tried: '/Users/ccg/abin/R_io.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
    Calls: source ... withVisible -> eval -> eval -> set_R_io -> dyn.load
    Ejecución interrumpida

Do you have any suggestions? Thanks very much in advance,

Best wishes,
Cesar

Ps. Below is the output of afni_system_check.py -check_all

afni_system_check.py -check_all
-------------------------------- general ---------------------------------
architecture: 64bit
system: Darwin
release: 21.6.0
version: Darwin Kernel Version 21.6.0: Sat Jun 18 17:07:22 PDT 2022; root:xnu-8020.140.41~1/RELEASE_ARM64_T6000
distribution: 12.5
number of CPUs: 10
apparent login shell: zsh
shell RC file: .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni : /Users/ccg/abin/afni
afni version : Precompiled binary macos_10.12_local: Sep 18 2022
: AFNI_22.2.12 ‘Marcus Aurelius’
AFNI_version.txt : AFNI_22.2.12, macos_10.12_local, Sep 18 2022
which python : /Users/ccg/.pyenv/versions/3.9.10/bin/python
python version : 3.9.10
which R : /usr/local/bin/R
R version : R version 4.1.3 (2022-03-10) – “One Push-Up”
which tcsh : /bin/tcsh

instances of various programs found in PATH:
afni : 1 (/Users/ccg/abin/afni)
R : 1 (/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/bin/R)
python : 2
/Users/ccg/.pyenv/versions/3.9.10/bin/python3.9
/Users/ccg/.pyenv/shims/python
python2 : 0
python3 : 4
/Users/ccg/.pyenv/versions/3.9.10/bin/python3.9
/Users/ccg/.pyenv/shims/python3
/opt/homebrew/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/bin/python3.9
/usr/bin/python3

** 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 : FAILURE
Error in dyn.load(ll) :
unable to load shared object ‘/Users/ccg/abin/R_io.so’:
dlopen(/Users/ccg/abin/R_io.so, 0x0006): tried: ‘/Users/ccg/abin/R_io.so’ (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
Calls: source … withVisible → eval → eval → set_R_io → dyn.load
Ejecución interrumpida

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 : /Users/ccg/.pyenv/versions/3.9.10/lib/python3.9/site-packages/matplotlib/pyplot.py
matplotlib version : 3.5.2

-------------------------------- env vars --------------------------------
PATH = /Users/ccg/.pyenv/versions/3.9.10/bin:/opt/homebrew/Cellar/pyenv/2.2.5/libexec:/opt/homebrew/Cellar/pyenv/2.2.5/plugins/python-build/bin:/usr/local/opt/python/libexec/bin:/usr/local/bin:/Users/ccg/Downloads/y/bin:/Users/ccg/.pyenv/shims:/Users/ccg/.pyenv/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/Visual Studio Code.app/Contents/Resources/app/bin:/usr/local/texlive/2020/bin/x86_64-darwin:/Users/ccg/abin

PYTHONPATH =
R_LIBS =
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH =
DYLD_FALLBACK_LIBRARY_PATH =

------------------------------ data checks -------------------------------
data dir : found AFNI_data6 under $HOME/cesar_data/data (948584M Avail)
top history: 19 Mar 2015 [rickr]: enhanced unix_tutorial
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : found afni_handouts under $HOME/cesar_data (948584M Avail)
atlas : found TT_N27+tlrc under /Users/ccg/abin

------------------------------ OS specific -------------------------------
XQuartz version : 2.8.1

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

– for PyQt4 under brew, consider running:
brew install cartr/qt4/pyqt
++ found 1 dylib files under ‘/opt/X11/lib/flat_namespace’
– found ‘libXt’ dylib files:
/opt/X11/lib/flat_namespace/libXt.6.dylib
** 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’
  • AFNI programs show FAILURE
  • insufficient data for AFNI bootcamp
    (see “Prepare for Bootcamp” on install pages)
  • OS X version might be old
  • consider setting DYLD_LIBRARY_PATH to /opt/X11/lib/flat_namespace

~ took 2s

Hi Cesar,

This might be another reason for you to consider compiling on your ARM system.

The R programs (like 3dMVM) are scripts that run R and load our compiled R_io.so library for dataset I/O. That version of AFNI has R_io.so linked to an Intel version of the build machine’s R library.

But since 3dMVM is a script, in your case it is running an ARM version of R, and that is refusing to load Intel shared libraries. In order to use R_io.so, you would need to be running an Intel version of R.

Given that, the R version itself, and difficulty with our signing the complete package, you should probably consider compiling AFNI locally on an ARM mac.

Unfortunately, someone (with my initials) has not written convenient build scripts, and some are looking into the possibility of making a brew package, which has its own difficulties. But given an AFNI src directory, and assuming you have installed packages according to afni/src/other_builds/OS_notes.macos_11_ARM.txt, it might be enough to run:

cd afni/src
cp Makefile.macos_11_ARM_clang Makefile
make itall

and then sync the results to your abin. Is that something that you might consider?

  • rick

Thank you Rick, I will try that and let you know any updates. I assume it will be useful for other M1 users.
Cesar