Install issue Mac M2 after trying brew install gcc@13 fix

Hi afni gurus,

I am having trouble installing on my M2 mac (Sonoma 14.1.1) on the
tcsh OS_notes.macos_12_ARM_b_user.tcsh step.

I have previously tried:

  • making sure my brew packages were up to date
  • doing brew install gcc@13
  • reinstalling xcode command line tools
  • reinstalling R from both brew and CRAN (I am currently using the CRAN version)

I am now getting this (cut to show relevant part) in my console after running tcsh OS_notes.macos_12_ARM_b_user.tcsh:

++ building (please be patient)...
** error: failed run_cmd: make AFNI_WHOMADEIT=build itall >& log_make.txt
-- status: building FAILURE
   see 'make' log file /Users/sun/afni_build/build_src/log_make.txt
** error: tail from log_make.txt:
   R_io.c:394:10: warning: unused variable 'CallingFunc' [-Wunused-variable]
   char *CallingFunc=NULL;
   7 warnings generated.
   clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/Library/Frameworks/R.framework/Resources/lib -L/opt/homebrew/lib -o R_io.o -L. -L/opt/homebrew/lib -L/opt/X11/lib -L/usr/lib -lmri -lf2c /opt/Homebrew/lib/libXm.a -ljpeg -lXt -lXft -lfontconfig -lpng16 -liconv -lXmu -lXp -lXpm -lXext -lX11 -lz -lexpat -lm -lc -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
   ld: library not found for -lz
   clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
   make[1]: *** [/Library/Frameworks/R.framework/Resources/share/make/] Error 1
   make[1]: Leaving directory '/Users/sun/afni_build/build_src'
   make: *** [Makefile.INCLUDE:4236:] Error 1

** warning: in conda environment

-- shell/system command history is in:

++ screen text history is in:

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

** ERROR: Failed to load

Any help would be greatly appreciated!

Edit: Here is my output of -check_all:

-------------------------------- general ---------------------------------
architecture:         64bit 
cpu type:             arm
system:               Darwin
release:              23.1.0
version:              Darwin Kernel Version 23.1.0: Mon Oct  9 21:28:31 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8112
distribution:         14.1.1
number of CPUs:       8
apparent login shell: zsh
shell RC file:        .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni           :
AFNI_version.txt     : AFNI_24.1.22, anyos_text, Jun 21 2024, local
which python         : /Users/sun/miniconda3/bin/python
python version       : 3.12.3
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  : 4 
    python2 : 1   (/Library/Frameworks/Python.framework/Versions/2.7/bin/python2)
    python3 : 5 

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      : success
    3dMVM                : 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 : /Users/sun/miniconda3/lib/python3.12/site-packages/matplotlib/
   matplotlib version : 3.9.0

++ module loaded: flask
   module file : /Users/sun/miniconda3/lib/python3.12/site-packages/flask/
   flask version : 3.0.3

++ module loaded: flask_cors
   module file : /Users/sun/miniconda3/lib/python3.12/site-packages/flask_cors/
   flask_cors version : 4.0.1

-- python binaries under /usr/local/bin:
    /usr/local/bin/python (sym link to /Library/Frameworks/Python.framework/Versions/2.7/bin/python)
    /usr/local/bin/python3 (sym link to /usr/local/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/bin/python3.12)
    /usr/local/bin/python2 (sym link to /Library/Frameworks/Python.framework/Versions/2.7/bin/python2)
    /usr/local/bin/python2.7 (sym link to /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)

-------------------------------- env vars --------------------------------
PATH                       = /Users/sun/miniconda3/bin:/usr/local/fsl/bin:/usr/local/fsl/share/fsl/bin:/usr/local/bin:/Users/sun/abin:/Users/sun/easyfmri/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/fsl/share/fsl/bin:/usr/local/fsl/share/fsl/bin:/usr/local/fsl/bin:/usr/local/fsl/share/fsl/bin:/usr/local/bin:/Users/sun/abin:/Users/sun/miniconda3/condabin:/Users/sun/easyfmri/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.11/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/

PYTHONPATH                 = 
R_LIBS                     = /Users/sun/sw/R-4.3.1
LD_LIBRARY_PATH            = 
DYLD_LIBRARY_PATH (sub-shell) = e]1337;RemoteHost=sun@Tonys-MacBook-Air.localae]1337;CurrentDir=/Users/sunae]1337;ShellIntegrationVersion=14;shell=zsha/opt/X11/lib/flat_namespace
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) = e]1337;RemoteHost=sun@Tonys-MacBook-Air.localae]1337;CurrentDir=/Users/sunae]1337;ShellIntegrationVersion=14;shell=zsha/Users/sun/abin
CONDA_SHLVL                = 1
CONDA_DEFAULT_ENV          = base

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

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

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

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

   ** 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 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           : /usr/local/bin/brew
brew version         : Homebrew 4.3.6

++ found valid link /usr/local/lib/libglib-2.0.dylib
   to ../Cellar/glib/2.80.3/lib/libglib-2.0.dylib

=========================  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
*  consider installing gcc under homebrew

Hi Tony,

That setup seems a little off. There are many things installed under /usr/loca/bin, including brew, which is where it belongs on an Intel system, not an ARM one. Do you have an /opt/homebrew directory? Maybe you have both versions installed at this point, and might be able to just point to the ARM version. What is the output from this:

ls -ld /opt/homebrew/bin /usr/local/bin
  • rick

Thanks for your response rick! As an update I believe I got AFNI working by just downloading the precompiled binaries here: 1.4. Download other/specific AFNI/SUMA software — AFNI, SUMA and FATCAT: v24.1.22

As a note for others my situation might be different since I was installing AFNI as a part of another tool which made many modifications to my .zshrc and .zprofile, easyfmri.

That's great Tony, thanks for the update!

  • rick