Install Failure on M1 Mac part 2

Hello AFNI team,
I would like to create my own topic about install failure on MAC, which I already start to solve with one of AFNI team (Rick - thank you very much) in a topic with similar problem (here -Install Failure on M1 Mac).
For another readers seaking help I am posting output of afni check once
again.

architecture: 64bit
cpu type: arm
system: Darwin
release: 22.6.0
version: Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:52 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T8103
distribution: 13.5.2
number of CPUs: 8
apparent login shell: zsh
shell RC file: .zshrc (exists)

--------------------- AFNI and related program tests ---------------------
which afni :
:
AFNI_version.txt : AFNI_23.2.12, anyos_text, Sep 29 2023, local
which python : /Users/anna/fsl/bin/python
python version : 3.11.5
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 (/Users/anna/fsl/bin/python3.11)
python2 : 0
python3 : 2
/Users/anna/fsl/bin/python3.11
/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 : success
3dMVM : FAILURE
setenv: Too many arguments.

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

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

checking for R packages...
rPkgsInstall -pkgs ALL -check : FAILURE
setenv: Too many arguments.

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

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

++ module loaded: matplotlib.pyplot
module file : /Users/anna/fsl/lib/python3.11/site-packages/matplotlib/pyplot.py
matplotlib version : 3.7.2

-------------------------------- env vars --------------------------------
PATH = /usr/local/art/bin:/Applications/freesurfer/7.4.1/bin:/Applications/freesurfer/7.4.1/fsfast/bin:/Users/anna/fsl/bin:/Users/anna/fsl/share/fsl/bin:/Applications/freesurfer/7.4.1/mni/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/local/bin:/opt/local/sbin:/Users/anna/fsl/share/fsl/bin:/Users/anna/fsl/share/fsl/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/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:/Users/anna/abin:/opt/homebrew/opt/python/libexec/bin:/Users/anna/abin/

PYTHONPATH =
R_LIBS =
LD_LIBRARY_PATH =
DYLD_LIBRARY_PATH (sub-shell) = /Applications/freesurfer/7.4.1/lib/gcc/lib
DYLD_FALLBACK_LIBRARY_PATH (sub-shell) =

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

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

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

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

** warning: .tcshrc does NOT seem to contain 'source .cshrc'
-- (csh and tcsh will use different files)
-- considered operations: path, flatdir, apsearch

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

dot file test : want 2 modifications across 3 files:

file             path  flatdir  apsearch        follower
  ---------------  ----  -------  --------        --------
  .cshrc           0     0        0               0     
  .tcshrc          0     1        0               0     
  .zshrc           0     1        0               0

------------------------------ 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.1.13
which port : /opt/local/bin/port
port version : Version: 2.8.1

++ 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 'zsh'...
** env var DYLD_LIBRARY_PATH is set, but without /opt/X11/lib/flat_namespace
-- recent OS X, cheating to check DYLD_LIBRARY_PATH in shell 'tcsh'...
** env var DYLD_LIBRARY_PATH not set to contain /opt/X11/lib/flat_namespace

========================= 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)
  • dot file test : want 2 modifications across 3 files:
  • insufficient data for AFNI bootcamp
    (see "Prepare for Bootcamp" on install pages)
  • possibly missing atlases
  • consider installing gcc under homebrew
  • consider installing glib under homebrew
  • please set DYLD_LIBRARY_PATH to include /opt/X11/lib/flat_namespace
  • please set DYLD_LIBRARY_PATH to /opt/X11/lib/flat_namespace in tcsh

I was asked about the way of XQartz installation, which I downloaded from xqartz website. And the output of
mdfind -name stdlib.h, which is -

2023-10-20 22:13:19.665 mdfind[51931:864883] [UserQueryParser] Loading keywords and predicates for locale "cs_CZ"
2023-10-20 22:13:19.666 mdfind[51931:864883] [UserQueryParser] Loading keywords and predicates for locale "cs"
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/stdlib.h
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/xlocale/_stdlib.h
/Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/stdlib.h
/Users/anna/fsl/pkgs/libcxx-16.0.6-h4653b0c_0/include/c++/v1/stdlib.h
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/stdlib.h
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/xlocale/_stdlib.h
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/stdlib.h
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdlib.h
/Users/anna/fsl/pkgs/pycparser-2.21-pyhd8ed1ab_0/site-packages/pycparser/utils/fake_libc_include/stdlib.h
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/xlocale/_stdlib.h
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/stdlib.h
/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/stdlib.h

I will be really glad for any advice. Thank you for your ongoing support :).

Hi Anna,

It is not clear what the problem is, but maybe there is confusion between the 2 developer tools packages. It might be good to clean that up and go with a new one. I sent you a separate message about this. Sorry for being slow.

Thanks,

  • rick

Hello Rick,

Thank you very much for your message and valuable advice. I have attempted to reinstall xcode and R, tried to check dev tools and also verified install sites and paths. However I am still encountering an error with stdlib.h not found. If you have any additional suggestions I would greatly appreciate them as I would really like to try AFNI :).

Best regards

Anna

Hi Anna,

I am sorry for the difficulties. Are you attending the current bootcamp? It might help to be able to see some of this in person.

  • rick

Hello Rick,
Unfortunatelly not. But I really apreciate your effort to solve my problem :).

Please ping me again early next week please. I am a bit overwhelmed and scattered now during our bootcamp (as if that does not apply in general). Or also try a small update:

build_afni.py -build_root ~/afni_build -package macos_13_ARM_clang -git_tag NONE

Thanks a lot,

  • rick

I will greatly appreciate your help at any time, so any other suggestions are highly appreciated. I tried another build as you mentioned, and I am still encountering the same error message: 'stdlib.h' not found.

Thank you very much
Anna

One oddity is that at least on my Intel mac, stdlib.h is also found under the homebrew tree, and it is the homebrew compiler that is applied here. Can you make sure that all of the brew packages are installed?

brew install python netpbm cmake gfortran
brew install --cask xquartz

There is a small chance that the file comes with installing XQuartz via homebrew, rather than directly from the xquartz website. That is why I included the second command. Maybe you should just be positive and run the other command, too:

brew install libpng jpeg expat freetype fontconfig openmotif  \
             libomp gsl glib pkg-config gcc libiconv autoconf \
             libxt mesa mesa-glu libxpm

I will have access to an ARM mac again tomorrow, and will try to compare things then, too.

Please let me know if any of those install commands actually installs a package.

Thanks,

  • rick

Try this command to search the homebrew directories:

find /opt -name stdlib.h 

Hi Rick,
after my non-professional inspection, I noticed several packages were upgraded. Specifically R was upgraded from 4.3.1 --> 4.3.2, and python, libomp, libxt, glib were also upgraded. Xquartz wasn't upgraded as it is already the latest version. After running build I am still encountering the same error message.

make[1]: Entering directory '/Users/anna/afni_build/build_src'
clang -I"/opt/homebrew/Cellar/r/4.3.2/lib/R/include" -DNDEBUG -I. -I/opt/homebrew/include -I/opt/X11/include -I/usr/include -Icoxplot -Inifti/nifti2 -Inifti/niftilib -Inifti/nifticdf -Inifti/znzlib -I3DEdge/src -Irickr -Ileej3 -DHAVE_ZLIB -DHAVE_GIFTI -If2c -m64 -Wall -Wno-deprecated-declarations -Wcomment -Wformat -DUSE_TRACING -DHAVE_XDBE -DDONT_USE_MCW_MALLOC -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/opt/readline/include -I/opt/homebrew/opt/xz/include -I/opt/homebrew/include -fPIC -g -O2 -c R_io.c -o R_io.o
In file included from R_io.c:1:
/opt/homebrew/Cellar/r/4.3.2/lib/R/include/R.h:43:11: fatal error: 'stdlib.h' file not found
include <stdlib.h> /* Not used by R itself, but widely assumed in packages */

1 error generated.
make[1]: *** [/opt/homebrew/Cellar/r/4.3.2/lib/R/etc/Makeconf:191: R_io.o] Error 1
make[1]: Leaving directory '/Users/anna/afni_build/build_src'
make: *** [Makefile.INCLUDE:4213: R_io.so] Error 1

Thank you! for your help
Anna

Thank you for your reply and suggestion!

After running find /opt -name stdlib.h I can see this output.

/opt/homebrew/Cellar/gcc/13.2.0/include/c++/13/stdlib.h
/opt/homebrew/Cellar/gcc/13.2.0/include/c++/13/tr1/stdlib.h
/opt/local/include/gcc/c++/stdlib.h
/opt/local/include/gcc/c++/tr1/stdlib.h
/opt/local/var/macports/sources/rsync.macports.org/macports/release/tarballs/base/vendor/tcl8.6.13/compat/stdlib.h
/opt/local/x86_64-elf/include/ssp/stdlib.h
/opt/local/x86_64-elf/include/c++/12.2.0/stdlib.h
/opt/local/x86_64-elf/include/c++/12.2.0/tr1/stdlib.h
/opt/local/x86_64-elf/include/stdlib.h
/opt/local/x86_64-elf/include/machine/stdlib.h
/opt/local/lib/perl5/vendor_perl/5.34/darwin-thread-multi-2level/Tk/pTk/compat/stdlib.h

If I understand correctly, build is attempting to locate stdlib.h in the homebrew directory. I would assume that /opt/homebrew/Cellar/gcc/13.2.0/include/c++/13/stdlib.h could be ok, but I guess there is a problem I can't see as a new MAC user?

Hi Anna,

A new thought. What is the output from:

ls -l /Library/Developer/CommandLineTools/SDKs

Thanks,

  • rick

Hello AFNI team,
I am experiencing the same issue and hoping you have figured out an easy solution :). I would appreciate your advice.