ERROR: Failed to load R_io.so

Dear developers, thanks for your works in AFNI. I am new in AFNI, and there is a problem when I am trying to install the AFNI. I have read other's discussions which have same problem, but still can't resolve it.
Problems: The error shows when I ran tcsh OS_notes.macos_12_ARM_b_user.tcsh on a M1 Mac.
Error Informations:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5083 100 5083 0 0 5767 0 --:--:-- --:--:-- --:--:-- 5763
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
if ( ! -f /Users/zero/abin/init_user_dotfiles.py ) then
echo -- skipping install of AFNI anyos_text_atlas
-- skipping install of AFNI anyos_text_atlas
endif
echo ++ setting up user dotfiles
++ setting up user dotfiles
/Users/zero/abin/init_user_dotfiles.py -shell_list bash zsh tcsh -do_updates path apsearch -dir_bin /Users/zero/abin
-- good: .cshrc seems to contain 'source .tcshrc'
-- considered operations: path, apsearch

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

no modifications needed across 4 dot files

which init_user_dotfiles.py
/Users/zero/abin/init_user_dotfiles.py
if ( 0 ) then
if ( arm64 == x86_64 ) then
set package = macos_13_ARM
endif
echo ++ compiling AFNI package macos_13_ARM
++ compiling AFNI package macos_13_ARM
echo ++ running: build_afni.py -build_root ~/afni_build -package macos_13_ARM
++ running: build_afni.py -build_root ~/afni_build -package macos_13_ARM
build_afni.py -build_root /Users/zero/afni_build -package macos_13_ARM

-- build_afni.py, version 0.14, November 17, 2024
-- current AFNI: AFNI_25.0.13, anyos_text_atlas, Mar 29 2025
-- cleaning old build root dir, /Users/zero/afni_build
-- backing up dir build_src
-- preparing build_root dir, /Users/zero/afni_build
-- have default git tag LAST_TAG, will checkout AFNI_25.0.13
-- checking out git tag AFNI_25.0.13
-- using repo branch (detached), tag AFNI_25.0.13
-- 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
-- copying README files
-- copying Makefile.macos_13_ARM to Makefile
-- building make target 'itall'

-- consider monitoring the build in a separate window with:
cd /Users/zero
tail -f /Users/zero/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/zero/afni_build/build_src/log_make.txt
** error: tail from log_make.txt:

prog_list.txt
echo "" >> prog_list.txt
cat prog_list_bin.txt prog_list_scripts.txt
| tr ' ' '\n' | LC_COLLATE=C sort | uniq
prog_list.txt
/bin/cp -f scripts_install/* macos_13_ARM
/bin/cp -f text_install/* macos_13_ARM
/bin/mv -f afni to3d from3d 3dclust nsize 3dinfo 3dmerge count count_afni sfim tfim imrotate imreg imstat 3dnvals fim2 imand immask imdump imaver 3dhistog 3daxialize cdf 2swap 4swap 3dANOVA 3dANOVA2 3dANOVA3 plugout_tta waver 3dnewid 3dcalc ccalc imcalc 1dmatcalc 3drefit 3dbucket 3dNLfim 3dTSgen plugout_tt plugout_ijk 3dMannWhitney 3dWilcoxon 3dKruskalWallis 3dFriedman 3dRegAna 2dImReg 3dmaskave byteorder imstack 3dDeconvolve 3dTcat 3drotate 3dvolreg 3dpc 3dfractionize 1dplot adwarp imupsam 3dIntracranial 24swap 3dTsmooth RSFgen float_scan 1dtranspose 3dNotes 3dROIstats 1deval 3dStatClust 3dTstat 3dmaskdump 3dTshift 3dDetrend 1dfft 1dcat 3drename 1dnorm afni_vcheck 3ddot 3dfim+ imcutup imcat 3dWinsor 3dZeropad 3dTagalign 3dMean 3dAttribute cat_matvec 3dOverlap 3dClipLevel 3dZregrid 3dEntropy 3ddelay 3dRowFillin 1dgrayplot 3dToutcount 1dsum 3dExtrema qhull strblast 3dConvolve 3dZcutup 3dZcat 3dTqual 3dGetrow 3dTcorrelate 3dcopy Vecwarp 3dCM fdrval 3dAFNItoANALYZE 3dAFNItoNIFTI 3dAutoTcorrelate 3dFDR rtfeedme 3dAutomask 3dBrickStat 3dThreetoRGB 3dresample 3dAutobox 3dLRflip dicom_hdr 3dDespike dicom_to_raw file_tool rotcom 1ddot 1dsvd 2dcat 3dAnhist 3dAFNIto3D 3dWarp nicat 3dSpatNorm fftest serial_helper 3dDTeig 3dDWItoDT 3dWarpDrive nifti_tool 3dAllineate whereami whereami_afni plugout_drive 3dLSS 3dMedianFilter 3dretroicor 3dAFNItoNIML 3dAFNItoRaw im2niml 3dedge3 DTIStudioFibertoSegments Dimon 3dLocalstat 3danisosmooth 3dmaxima GLTsymtest 3dPval stimband 1dNLfit 1dApar2mat 3dTwotoComplex 3dInvFMRI 3dmatcalc 3dAcost 3dLocalBistat 3dFWHMx 3dBlurToFWHM 1dSEM 3dDFT 3dSynthesize 1dMarry 3dEmpty 3dsvm 1dFlagMotion 3dTsort 1dTsort 3dTfitter afni_history 1dUpsample 3dLocalSVD niml_feedme 3dErrtsCormat 3dUndump 3dREMLfit 3dTnorm 3dUpsample 3dTcorrMap 3dmatmult 3dABoverlap 3dmaskSVD 1dBandpass 3dCompareAffine 3dBallMatch 3dmaxdisp 3dBlurInMask 3dRank 3dFFT 1dgenARMA11 3dPeriodogram 1dAstrip 3dLocalPV 3dBandpass 3dSetupGroupInCorr 3dGroupInCorr 3dTcorr1D 3dClustSim 3dRetinoPhase 3dMaskToASCII 3dttest++ 3dDTtoDWI niccc rbox qdelaunay 3dkmeans 3dXYZcat 3dPolyfit 3dNwarpApply 1dCorrelate 3dNwarpCalc dicom_hinfo apsearch 1dBport 3dNormalityTest 3dmask_tool FIRdesign help_format 2perm 3dClustCount column_cat 3dUnifize 3dNwarpCat 3dQwarp 3dLocalHistog 3dNwarpAdjust 3dNwarpFuncs 3dTproject afni_open 3dConformist 3dNwarpXYZ 3dTRfix 3dToyProg 3dRankizer nifti1_tool gifti_tool cifti_tool images_equal uniq_images tokens 3dLocalACF 3dXClustSim 3dtoXdataset 3dMultiThresh 3dLFCD 3dDegreeCentrality 3dECM 3dMSE 3dsvm_linpredict 3dTfilter 3dTsplit4D 3dSharpen 3dDepthMap 3dExtractGroupInCorr dcm2niix_afni 3dTto1D 3dBrainSync 3dGrayplot 1dsound afni_check_omp 3dPVmap 3dExchange 3dEdu_01_scale 3dDiff get_afni_model_PRF get_afni_model_PRF_6 get_afni_model_PRF_6_BAD 3dedgedog p2dsetstat dsetstat2p cjpeg djpeg whirlgif myget rmz aiv mycat quotize macos_13_ARM
mv: rename dcm2niix_afni to macos_13_ARM/dcm2niix_afni: No such file or directory
make: *** [install] Error 1


** warning: in conda environment
CONDA_SHLVL = 0, CONDA_DEFAULT_ENV = myAFNI

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

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

rehash
if ( ! 1 ) then
echo -- already have R_LIBS=/Users/zero/sw/R-4.4.3
-- already have R_LIBS=/Users/zero/sw/R-4.4.3
endif
if ( ! -d /Users/zero/sw/R-4.4.3/data.table ) then
echo ++ building R libraries: rPkgsInstall -pkgs ALL
++ building R libraries: rPkgsInstall -pkgs ALL
mkdir -p /Users/zero/sw/R-4.4.3
rPkgsInstall -pkgs ALL
tee out.rPkgsInstall.txt

** ERROR: Failed to load R_io.so

Possible Useful Informations:

  1. The output of afni_system_check.py -check_all
    -------------------------------- general ---------------------------------
    architecture: 64bit
    cpu type: arm64
    system: Darwin
    release: 23.6.0
    version: Darwin Kernel Version 23.6.0: Fri Nov 15 15:13:56 PST 2024; root:xnu-10063.141.1.702.7~1/RELEASE_ARM64_T8103
    distribution: 14.7.2
    number of CPUs: 8
    user: zero
    apparent login shell: zsh
    shell RC file: .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni :
:
AFNI_version.txt : AFNI_25.0.13, anyos_text_atlas, Mar 29 2025, local
which python : /opt/miniconda3/envs/myAFNI/bin/python
python version : 3.9.21
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 : 2
/opt/miniconda3/envs/myAFNI/bin/python3.9
/opt/homebrew/Cellar/python@3.13/3.13.2/Frameworks/Python.framework/Versions/3.13/bin/python3.13
python2 : 0
python3 : 3
/opt/miniconda3/envs/myAFNI/bin/python3.9
/opt/homebrew/Cellar/python@3.13/3.13.2/Frameworks/Python.framework/Versions/3.13/bin/python3.13
/usr/bin/python3

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
build_afni.py : success
uber_subject.py : success
3dMVM : FAILURE
Error in library(data.table) : 不存在叫‘data.table’这个名字的程辑包
Calls: source ... suppressPackageStartupMessages -> withCallingHandlers -> library
停止执行
rPkgsInstall : FAILURE

------------------------ 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

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

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

++ module loaded: matplotlib.pyplot
module file : /opt/miniconda3/envs/myAFNI/lib/python3.9/site-packages/matplotlib/pyplot.py
matplotlib version : 3.9.2

++ module loaded: flask
module file : /opt/miniconda3/envs/myAFNI/lib/python3.9/site-packages/flask/init.py
flask version : 3.1.0

++ module loaded: flask_cors
module file : /opt/miniconda3/envs/myAFNI/lib/python3.9/site-packages/flask_cors/init.py
flask_cors version : 3.0.10

-------------------------------- env vars --------------------------------
PATH = /opt/miniconda3/envs/myAFNI/bin:/opt/miniconda3/condabin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/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:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/Users/zero/abin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin:/opt/homebrew/opt/python/libexec/bin

PYTHONPATH =
R_LIBS = /Users/zero/sw/R-4.4.3
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH (sub-shell) =
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) =
CONDA_SHLVL = 2
CONDA_DEFAULT_ENV = myAFNI
CC =
HOMEBREW_PREFIX = /opt/homebrew

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

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

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

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

-- good: .cshrc seems to contain 'source .tcshrc'
-- considered operations: path, apsearch

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

no modifications needed across 3 dot files

------------------------------ 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

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

which git : /usr/bin/git
git version : git version 2.39.5 (Apple Git-154)
which gcc : /usr/bin/gcc
gcc version : Apple clang version 16.0.0 (clang-1600.0.26.6)

brew gcc(s) : /opt/homebrew/bin/gcc-13
/opt/homebrew/bin/gcc-14
CommandLineTools SDK : MacOSX15.2.sdk

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

  • just be aware: login shell 'zsh', but our code examples use 'tcsh'
  • missing program: afni
  • failure under initial "AFNI and related program tests"
  • AFNI programs show FAILURE
  • missing R packages (see rPkgsInstall)
  • please run: "suma -update_env" for .sumarc
  • please run: apsearch -update_all_afni_help
  • insufficient data for AFNI bootcamp
    (see "Prepare for Bootcamp" on install pages)
  • possibly missing atlases

Looks like the first issue is dcm2niix_afni not building. You might need to reinstall the apple developer tools. If you run:

xcode-select --install

and receive the output:

xcode-select: note: Command line tools are already installed. Use "Software Update" in System Settings or the softwareupdate command line interface to install updates

Then you'll need to follow the instructions on a page such as this.

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

After that, try running the build script again and see if your build succeeds.

After following your suggestion, the installation was successful. Thanks for your help

1 Like