** ERROR: Failed to load R_io.so during installation

I am installing AFNI on a M1 Mac. During the final installation step, I get the following error. When running "tcsh OS_notes.macos_12_ARM_b_user.tcsh".

rPkgsInstall -pkgs ALL
tee out.rPkgsInstall.txt

** ERROR: Failed to load R_io.so

Checking R version reports this.
R --version

R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Platform: x86_64-apple-darwin15.6.0 (64-bit)

Appreciate the help

Looks like you may have installed the Intel (x86_64) version of R. If you can install the arm64 version or R that should fix it. You'll need to re-run the *b_user.tcsh script after you install R.

Thanks for your help.

Ah, I used the M1 R version first that is built in but I ran into this problem. I read in the forum that some users were resolving this issue with the R 3.6 version so I installed that one (but again, same problem). It looks like there isn't a R 3.6 version for the m1 Mac. I reinstalled the M1 R, but I still have the same problem.

When checking R version.
R version 4.4.1 (2024-06-14)

When running *b_user.tcsh afterward.

build_afni.py -build_root /Users/andymac/afni_build -package macos_13_ARM_clang

-- current AFNI: AFNI_24.2.03, anyos_text, Aug 20 2024
-- cleaning old build root dir, /Users/andymac/afni_build
-- backing up dir build_src
-- preparing build_root dir, /Users/andymac/afni_build
-- have default git tag LAST_TAG, will checkout AFNI_24.2.03
-- checking out git tag AFNI_24.2.03
-- using repo branch (detached), tag AFNI_24.2.03
-- removing old atlas dir, prev/afni_atlases_dist
-- moving old atlas dir afni_atlases_dist to prev/afni_atlases_dist
-- downloading AFNI atlas package, afni_atlases_dist.tgz
-- unpacking atlas package, afni_atlases_dist
-- removing old NiiVue backup, prev/niivue_afni.umd.js
-- moving old niivue niivue_afni.umd.js to prev/niivue_afni.umd.js
-- downloading NiiVue, niivue_afni.umd.js

-- preparing to run 'make' build of package macos_13_ARM_clang
-- copying README files
-- copying other_builds/Makefile.macos_13_ARM_clang to Makefile
-- building make target 'itall'

-- consider monitoring the build in a separate window with:
       cd /Users/andymac
       tail -f /Users/andymac/afni_build/build_src/log_make.txt
       # use ctrl-c to terminate 'tail' command (not the build)
++ building (please be patient)...
** error: failed run_cmd: make AFNI_WHOMADEIT=build itall >& log_make.txt
-- status: building FAILURE
   see 'make' log file /Users/andymac/afni_build/build_src/log_make.txt
** error: tail from log_make.txt:
   --------------------------------------------------
   *** GLIB 1.2.8 or better is required. The latest version of GLIB
   *** is always available from ftp://ftp.gtk.org/.
   make[2]: *** No rule to make target `clean'.  Stop.
   make[2]: *** No targets specified and no makefile found.  Stop.
   error: /Library/Developer/CommandLineTools/usr/bin/ranlib: can't open file: src/.libs/libgts.a (No such file or directory)
   cp: src/.libs/libgts.a: No such file or directory
   make[1]: *** [libgts.a] Error 1
   cp: SUMA/libgts.a: No such file or directory
   cp: SUMA/libgts.a: No such file or directory
   make: *** [libgts.a] Error 1
   --------------------------------------------------

** warning: in conda environment
   CONDA_SHLVL = 0

-- shell/system command history is in:
      /Users/andymac/afni_build/hist_commands.txt

++ screen text history is in:
      /Users/andymac/afni_build/hist_messages.txt

rehash
setenv R_LIBS /Users/andymac/sw/R-4.4.1
echo export R_LIBS=/Users/andymac/sw/R-4.4.1
echo export R_LIBS=/Users/andymac/sw/R-4.4.1
echo setenv R_LIBS /Users/andymac/sw/R-4.4.1
mkdir -p /Users/andymac/sw/R-4.4.1
rPkgsInstall -pkgs ALL
tee out.rPkgsInstall.txt

** ERROR: Failed to load R_io.so

It looks like your build is failing so R_io wouldn't be built either way.

Did you get errors when running the other installation scripts?

OS_notes.macos_12_ARM_a_admin_pt1.tcsh
OS_notes.macos_12_ARM_a_admin_pt2.tcsh

Nope no errors. I just tried again from Step 1 and same thing.

This seems to often come from the environment setup. What does the system check show?

afni_system_check.py -check_all

If it is not clear from that, I may ask to communicate more directly.

  • rick

Hi Rick. I get the following.

afni_system_check.py -check_all

-sh: afni_system_check.py: command not found

Also, ~/abin/afni_system_check.py -check_all gets me the following.

-------------------------------- general ---------------------------------
architecture:         64bit 
cpu type:             arm (uname -m == arm64)
system:               Darwin
release:              23.6.0
version:              Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000
distribution:         14.6.1
number of CPUs:       10
apparent login shell: sh
shell RC file:        .profile (does not exist)

--------------------- AFNI and related program tests ---------------------
which afni           :
                     : 
AFNI_version.txt     : AFNI_24.2.03, anyos_text, Aug 20 2024, local
which python         : /usr/local/bin/python
python version       : 3.12.1
which R              : /usr/local/bin/R
R version            : R version 4.3.1 (aarch64-apple-darwin20)

instances of various programs found in PATH:
    afni    : 0 
    R       : 1   (/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/bin/R)
    python  : 1   (/Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12)
    python2 : 0 
    python3 : 2 
      /Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12
      /usr/bin/python3

** have python3 but not python2

testing ability to start various programs...
    afni                 : FAILURE
        /bin/sh: afni: command not found
    suma                 : FAILURE
        /bin/sh: suma: command not found
    3dSkullStrip         : FAILURE
        /bin/sh: 3dSkullStrip: command not found
    3dAllineate          : FAILURE
        /bin/sh: 3dAllineate: command not found
    3dRSFC               : FAILURE
        /bin/sh: 3dRSFC: command not found
    SurfMesh             : FAILURE
        /bin/sh: SurfMesh: command not found
    3dClustSim           : FAILURE
        /bin/sh: 3dClustSim: command not found
    uber_subject.py      : FAILURE
        /bin/sh: uber_subject.py: command not found
    3dMVM                : FAILURE
        /bin/sh: 3dMVM: command not found

have failures, testing programs under implied /Users/andymac/abin...
    afni                 : FAILURE
        /bin/sh: /Users/andymac/abin/afni: No such file or directory
    suma                 : FAILURE
        /bin/sh: /Users/andymac/abin/suma: No such file or directory
    3dSkullStrip         : FAILURE
        /bin/sh: /Users/andymac/abin/3dSkullStrip: No such file or directory
    3dAllineate          : FAILURE
        /bin/sh: /Users/andymac/abin/3dAllineate: No such file or directory
    3dRSFC               : FAILURE
        /bin/sh: /Users/andymac/abin/3dRSFC: No such file or directory
    SurfMesh             : FAILURE
        /bin/sh: /Users/andymac/abin/SurfMesh: No such file or directory
    3dClustSim           : FAILURE
        /bin/sh: /Users/andymac/abin/3dClustSim: No such file or directory
    uber_subject.py      : success
    3dMVM                : success

------------------------ dependent program tests -------------------------
checking for dependent programs...

which tcsh           : /bin/tcsh
tcsh version         : 6.21.00
which Xvfb           : /opt/X11/bin/Xvfb

checking for R packages...
    rPkgsInstall -pkgs ALL -check : FAILURE
        /bin/sh: rPkgsInstall: command not found

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

------------------------------ python libs -------------------------------

++ module loaded: matplotlib.pyplot
   module file : /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/matplotlib/pyplot.py
   matplotlib version : 3.8.1

** failed to load module flask
-- flask is not required, but is desirable

** failed to load module flask_cors
-- flask_cors is not required, but is desirable

-- python binaries under /usr/local/bin:
    /usr/local/bin/python (sym link to /Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12)
    /usr/local/bin/python3 (sym link to /Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12)

-------------------------------- env vars --------------------------------
PATH                       = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/MATLAB_R2022a.app/bin/maci64:/usr/local/lib:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin

PYTHONPATH                 = 
R_LIBS                     = 
LD_LIBRARY_PATH            = 
DYLD_LIBRARY_PATH (sub-shell) = 
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) = 
CONDA_SHLVL                = 
CONDA_DEFAULT_ENV          = 
CC                         = 

----------------------------- eval dot files -----------------------------

----------- AFNI $HOME files -----------

    .afnirc                   : missing
    .sumarc                   : missing
    .afni/help/all_progs.COMP : missing

--------- shell startup files ----------

   init_user_dotfiles.py: Command not found.
------------------------------ data checks -------------------------------
data dir : missing AFNI_data6
data dir : missing AFNI_demos
data dir : missing suma_demo
data dir : missing afni_handouts
atlas    : did not find TT_N27+tlrc

------------------------------ OS specific -------------------------------
XQuartz version      : 2.8.5


** no package manager found (okay for bootcamp)

=========================  summary, please fix:  =========================
*  CPU differs between python and uname?
*  just be aware: login shell 'sh', but our code examples use 'tcsh'
*  shell sh : MISSING login shell setup file .profile
*  missing program: afni
*  failure under initial "AFNI and related program tests"
*  AFNI programs show FAILURE
*  consider adding /Users/andymac/abin to your PATH
*  missing R packages (see rPkgsInstall)
*  please run: cp /Users/andymac/abin/AFNI.afnirc ~/.afnirc
*  please run: "suma -update_env" for .sumarc
*  please run: apsearch -update_all_afni_help
*  failure running init_user_dotfiles.py -test
*  insufficient data for AFNI bootcamp
   (see "Prepare for Bootcamp" on install pages)
*  possibly missing atlases

I don't see any homebrew in your PATH, which should be under /opt/homebrew/bin, since that is an ARM system.

This might stem from having 'sh' as your login shell, which is fairly uncommon. The install scripts might need to be adjusted for it. Is that a shell that you chose?
What is the output from:

/opt/homebrew/bin/brew shellenv
  • rick
export HOMEBREW_PREFIX="/opt/homebrew";

export HOMEBREW_CELLAR="/opt/homebrew/Cellar";

export HOMEBREW_REPOSITORY="/opt/homebrew";

export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}";

[ -z "${MANPATH-}" ] || export MANPATH=":${MANPATH#:}";

export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";

I can switch to tcsh and try the install again. I didn't purposefully make sh my login shell.

I get the same error after switching to tcsh and retrying all install steps.

tcsh OS_notes.macos_12_ARM_b_user.tcsh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3521  100  3521    0     0   8527      0 --:--:-- --:--:-- --:--:--  8525
set os = `uname -s`
uname -s
if ( 0 ) then
if ( Darwin != Darwin ) then
set cpu = `uname -m`
uname -m
if ( 0 ) then
set rver = `R --version | head -n 1 | cut -d ' ' -f 3`
R --version
cut -d   -f 3
head -n 1
if ( 0 ) then
echo OS    : Darwin
OS    : Darwin
echo CPU   : arm64
CPU   : arm64
echo R ver : 4.3.1
R ver : 4.3.1
echo 

defaults write org.macosforge.xquartz.X11 wm_ffm -bool true
defaults write org.x.X11 wm_ffm -bool true
defaults write com.apple.Terminal FocusFollowsMouse -string YES
curl -O https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 53097  100 53097    0     0  65603      0 --:--:-- --:--:-- --:--:-- 65551
tcsh @update.afni.binaries -no_recur -package anyos_text_atlas -bindir /Users/andymac/abin
-- running @update.afni.binaries version 3.24, December 7, 2023
-- no current AFNI package found in path...
-- any downloads will be from https://afni.nimh.nih.gov via curl -O -f

-- attempting to install package anyos_text_atlas under
   install dir: /Users/andymac/abin...
-- have install dir
++ working in new temp dir, .tmp.install
-- skipping update of @update.afni.binaries
++ downloading test file: curl -O -f anyos_text_atlas/AFNI_version.txt ...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    42  100    42    0     0     69      0 --:--:-- --:--:-- --:--:--    70
++ no update needed
/Users/andymac/abin/init_user_dotfiles.py -shell_list bash zsh tcsh -do_updates path apsearch -dir_bin /Users/andymac/abin
** warning: .tcshrc does NOT seem to contain 'source .cshrc'
-- (csh and tcsh will use different files)
-- considered operations: path, apsearch

-- note: followers should not need edits, so edit flags should be 0
   (have 0 follower(s), which can be ignored)

no modifications needed across 4 dot files

source ~/.cshrc
set filec
set autolist
set nobeep
alias ls ls -G
alias ll ls -lG
alias ltr ls -lGtr
setenv PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/MATLAB_R2022a.app/bin/maci64:/usr/local/lib:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Users/andymac/abin:/Users/andymac/abin
if ( 0 ) then
setenv R_LIBS /Users/andymac/sw/R-4.3.1
setenv R_LIBS /Users/andymac/sw/R-3.6.3
setenv R_LIBS /Users/andymac/sw/R-3.6.3
setenv R_LIBS /Users/andymac/sw/R-4.4.1
setenv R_LIBS /Users/andymac/sw/R-4.4.1
setenv R_LIBS /Users/andymac/sw/R-4.4.1
setenv R_LIBS /Users/andymac/sw/R-4.3.1
if ( arm64 == x86_64 ) then
set package = macos_13_ARM_clang
endif
build_afni.py -build_root /Users/andymac/afni_build -package macos_13_ARM_clang

-- current AFNI: AFNI_24.2.03, anyos_text, Aug 20 2024
-- cleaning old build root dir, /Users/andymac/afni_build
-- preparing build_root dir, /Users/andymac/afni_build
-- have default git tag LAST_TAG, will checkout AFNI_24.2.03
-- checking out git tag AFNI_24.2.03
-- using repo branch (detached), tag AFNI_24.2.03
-- downloading AFNI atlas package, afni_atlases_dist.tgz
-- unpacking atlas package, afni_atlases_dist
-- removing old NiiVue backup, prev/niivue_afni.umd.js
-- moving old niivue niivue_afni.umd.js to prev/niivue_afni.umd.js
-- downloading NiiVue, niivue_afni.umd.js

-- preparing to run 'make' build of package macos_13_ARM_clang
-- copying README files
-- copying other_builds/Makefile.macos_13_ARM_clang to Makefile
-- building make target 'itall'

-- consider monitoring the build in a separate window with:
       cd /Users/andymac
       tail -f /Users/andymac/afni_build/build_src/log_make.txt
       # use ctrl-c to terminate 'tail' command (not the build)
++ building (please be patient)...
** error: failed run_cmd: make AFNI_WHOMADEIT=build itall >& log_make.txt
-- status: building FAILURE
   see 'make' log file /Users/andymac/afni_build/build_src/log_make.txt
** error: tail from log_make.txt:
   --------------------------------------------------
   *** GLIB 1.2.8 or better is required. The latest version of GLIB
   *** is always available from ftp://ftp.gtk.org/.
   make[2]: *** No rule to make target `clean'.  Stop.
   make[2]: *** No targets specified and no makefile found.  Stop.
   error: /Library/Developer/CommandLineTools/usr/bin/ranlib: can't open file: src/.libs/libgts.a (No such file or directory)
   cp: src/.libs/libgts.a: No such file or directory
   make[1]: *** [libgts.a] Error 1
   cp: SUMA/libgts.a: No such file or directory
   cp: SUMA/libgts.a: No such file or directory
   make: *** [libgts.a] Error 1
   --------------------------------------------------

** warning: in conda environment
   CONDA_SHLVL = 0

-- shell/system command history is in:
      /Users/andymac/afni_build/hist_commands.txt

++ screen text history is in:
      /Users/andymac/afni_build/hist_messages.txt

rehash
setenv R_LIBS /Users/andymac/sw/R-4.3.1
echo export R_LIBS=/Users/andymac/sw/R-4.3.1
echo export R_LIBS=/Users/andymac/sw/R-4.3.1
echo setenv R_LIBS /Users/andymac/sw/R-4.3.1
mkdir -p /Users/andymac/sw/R-4.3.1
rPkgsInstall -pkgs ALL
tee out.rPkgsInstall.txt

** ERROR: Failed to load R_io.so

Looking at the "setenv PATH" line of this text output, it still does not have homebrew in it.
I will send you a private message, and maybe we can move this to an email thread to get more detail from.

  • rick

Just to follow up on this thread, once the PATH was set up with updates to the dot files, building and running AFNI worked well.

  • rick
2 Likes