I was having a problem running the latest install routines for Apple M* systems. It turned out that the issue was I had previously installed freesurfer, which would set DYLD_LIBRARY_PATH to /Applications/freesurfer/7.4.1/lib/gcc/lib
Problem was persistent even though the path was updated to include /opt/X11/lib/flat_namespace
Once I disabled the Freesurfer startup scripts, the build was successful and the system check script cleared.
I decided to mention this here, because I noticed the same DYLD_LIBRARY_PATH issue in a previous poster's system check output, it was likely the source of the problem.
Thanks for the note. Actually, on newer macs and certainly on ones where a user will run their own build, DYLD_LIBRARY_PATH is no longer needed for AFNI. However, if FreeSurfer does set that variable (or related ones), it could affect compiling or running AFNI programs, as they might be forced to look in the FreeSurfer tree for libraries, rather than under the homebrew tree, which the build relies on. In your case, pointing to a gcc 7.4.1 tree will surely conflict with what is probably gcc 11 under homebrew.
It might be sufficient to unset DYLD_LIBRARY_PATH for the duration of the AFNI build. Maybe you would then reset it afterwards.
These environments that packages use or suggest will probably make interoperability more and more difficult, unfortunately.
That's interesting, thanks Rick. FWIW I re-activated the Freesurfer scripts after the build and so far I don't have any issues.
That's good to know, thanks for the update.