<?xml version="1.0"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Planets  - Recent changes [en]</title>
		<link>http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php/Special:RecentChanges</link>
		<description>Track the most recent changes to the wiki in this feed.</description>
		<language>en</language>
		<generator>MediaWiki 1.27.7</generator>
		<lastBuildDate>Tue, 20 Oct 2026 18:27:53 GMT</lastBuildDate>
		<item>
			<title>Dummy PCM compilation on an Apple Silicon Mac</title>
			<link>http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php?title=Dummy_PCM_compilation_on_an_Apple_Silicon_Mac&amp;diff=3342&amp;oldid=0</link>
			<guid isPermaLink="false">http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php?title=Dummy_PCM_compilation_on_an_Apple_Silicon_Mac&amp;diff=3342&amp;oldid=0</guid>
			<description>&lt;p&gt;Created page with &amp;quot;= Compiling the Dummy PCM (LMDZ.COMMON, no physics) on Apple Silicon with XIOS =  This page provides the LMDZ.COMMON arch files needed to build the dynamical core with no phys...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Compiling the Dummy PCM (LMDZ.COMMON, no physics) on Apple Silicon with XIOS =&lt;br /&gt;
&lt;br /&gt;
This page provides the LMDZ.COMMON arch files needed to build the dynamical core with no physics (&amp;lt;code&amp;gt;-p nophys&amp;lt;/code&amp;gt;), MPI and XIOS output, on macOS with Homebrew gfortran and Homebrew Open MPI. It assumes XIOS has already been built with the &amp;lt;code&amp;gt;CLANG_MACOSX&amp;lt;/code&amp;gt; arch files, as described on the XIOS compilation page ([[XIOS on an Apple Silicon Mac]].&lt;br /&gt;
&lt;br /&gt;
The one setting that differs from the stock &amp;lt;code&amp;gt;arch-gfortran&amp;lt;/code&amp;gt; files is the C++ library in &amp;lt;code&amp;gt;XIOS_LIB&amp;lt;/code&amp;gt; and discussed below for the interested reader - [[#Background: which C++ library libxios.a needs|the background section]].&lt;br /&gt;
&lt;br /&gt;
== Tested environment ==&lt;br /&gt;
&lt;br /&gt;
* macOS 26 (Darwin 25.6.0), Apple Silicon (arm64)&lt;br /&gt;
* GNU Fortran 16.2.0 (Homebrew), installed as &amp;lt;code&amp;gt;gfortran&amp;lt;/code&amp;gt;&lt;br /&gt;
* Apple clang 21 (also what &amp;lt;code&amp;gt;/usr/bin/gcc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/usr/bin/cpp&amp;lt;/code&amp;gt; run)&lt;br /&gt;
* Open MPI 5.0.11 (Homebrew)&lt;br /&gt;
* netCDF-C and netCDF-Fortran compiled from source against Open MPI, installed in &amp;lt;code&amp;gt;/opt/parallel-netcdf&amp;lt;/code&amp;gt;&lt;br /&gt;
* XIOS built with &amp;lt;code&amp;gt;--arch CLANG_MACOSX&amp;lt;/code&amp;gt; (C++ compiled by clang against libc++)&lt;br /&gt;
&lt;br /&gt;
== Directory layout ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;.path&amp;lt;/code&amp;gt; file finds IOIPSL and XIOS relative to the LMDZ.COMMON directory, so the three directories must sit side by side:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
trunk/&lt;br /&gt;
  IOIPSL/&lt;br /&gt;
  LMDZ.COMMON/&lt;br /&gt;
  XIOS/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arch files ==&lt;br /&gt;
&lt;br /&gt;
Create these two files in &amp;lt;code&amp;gt;LMDZ.COMMON/arch/&amp;lt;/code&amp;gt;. No &amp;lt;code&amp;gt;.env&amp;lt;/code&amp;gt; file is needed: &amp;lt;code&amp;gt;makelmdz_fcm&amp;lt;/code&amp;gt; uses an empty one if it is missing.&lt;br /&gt;
&lt;br /&gt;
=== arch/arch-CLANG_MACOSX.fcm ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
%COMPILER            mpif90&lt;br /&gt;
%LINK                mpif90&lt;br /&gt;
%AR                  ar&lt;br /&gt;
%MAKE                make&lt;br /&gt;
%FPP_FLAGS           -P -traditional&lt;br /&gt;
%CPP_FLAGS           -P&lt;br /&gt;
%CPP_DEF             LAPACK&lt;br /&gt;
%FPP_DEF             NC_DOUBLE&lt;br /&gt;
%BASE_FFLAGS         -c -fdefault-real-8 -fdefault-double-8 -ffree-line-length-none -fno-align-commons -fallow-argument-mismatch -fcray-pointer&lt;br /&gt;
%PROD_FFLAGS         -O3&lt;br /&gt;
%DEV_FFLAGS          -O&lt;br /&gt;
%DEBUG_FFLAGS        -ffpe-trap=invalid,zero,overflow -fbounds-check -g3 -O0 -fstack-protector-all -finit-real=snan -fbacktrace&lt;br /&gt;
%C_COMPILER          gcc&lt;br /&gt;
%C_OPTIM             -O3&lt;br /&gt;
%MPI_FFLAGS&lt;br /&gt;
%OMP_FFLAGS&lt;br /&gt;
%BASE_LD&lt;br /&gt;
%MPI_LD&lt;br /&gt;
%OMP_LD&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== arch/arch-CLANG_MACOSX.path ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;nc-config&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nf-config&amp;lt;/code&amp;gt; must be on your &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ROOT=$PWD&lt;br /&gt;
&lt;br /&gt;
NETCDF_INCDIR=&amp;quot;$(nc-config --cflags) $(nf-config --fflags)&amp;quot;&lt;br /&gt;
NETCDF_LIBDIR=&amp;quot;$(nc-config --libs) $(nf-config --flibs)&amp;quot;&lt;br /&gt;
NETCDF_LIB=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
IOIPSL_INCDIR=&amp;quot;-I$ROOT/../IOIPSL/inc&amp;quot;&lt;br /&gt;
IOIPSL_LIBDIR=&amp;quot;-L$ROOT/../IOIPSL/lib&amp;quot;&lt;br /&gt;
IOIPSL_LIB=&amp;quot;-lioipsl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XIOS_INCDIR=&amp;quot;-I$ROOT/../XIOS/inc&amp;quot;&lt;br /&gt;
XIOS_LIBDIR=&amp;quot;-L$ROOT/../XIOS/lib&amp;quot;&lt;br /&gt;
XIOS_LIB=&amp;quot;-lxios -lc++&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
From the &amp;lt;code&amp;gt;LMDZ.COMMON&amp;lt;/code&amp;gt; directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./makelmdz_fcm -arch CLANG_MACOSX -parallel mpi -io xios -d 32x32x12 -p nophys gcm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A successful build produces &amp;lt;code&amp;gt;bin/gcm_32x32x12_phynophys_para.e&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Background: which C++ library libxios.a needs ==&lt;br /&gt;
&lt;br /&gt;
=== Symptom with the stock setting ===&lt;br /&gt;
&lt;br /&gt;
The stock gfortran arch files use &amp;lt;code&amp;gt;XIOS_LIB=&amp;quot;-lxios -lstdc++&amp;quot;&amp;lt;/code&amp;gt;. With that setting, all Fortran sources compile, and then the final link fails with hundreds of undefined C++ symbols coming from &amp;lt;code&amp;gt;libxios.a&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Undefined symbols for architecture arm64:&lt;br /&gt;
  &amp;quot;std::__1::regex_error::regex_error(std::__1::regex_constants::error_type)&amp;quot;, referenced from:&lt;br /&gt;
      ... in libxios.a[366](server.o)&lt;br /&gt;
  &amp;quot;vtable for std::__1::basic_ios&amp;lt;char, std::__1::char_traits&amp;lt;char&amp;gt;&amp;gt;&amp;quot;, referenced from:&lt;br /&gt;
      xios::CException::CException() in libxios.a[90](exception.o)&lt;br /&gt;
  ...&lt;br /&gt;
ld: symbol(s) not found for architecture arm64&lt;br /&gt;
collect2: error: ld returned 1 exit status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Two compilers, two C++ standard libraries ===&lt;br /&gt;
&lt;br /&gt;
Two different toolchains build the pieces of this model:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Component !! Wrapper !! Underlying compiler !! C++ standard library&lt;br /&gt;
|-&lt;br /&gt;
| XIOS (C++ core) || &amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt; || Apple '''clang''' || '''libc++''' (LLVM), linked with &amp;lt;code&amp;gt;-lc++&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| LMDZ (Fortran) || &amp;lt;code&amp;gt;mpif90&amp;lt;/code&amp;gt; || Homebrew '''gfortran''' || none (GCC Fortran runtime)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt; is not a separate C++ wrapper here. macOS filesystems are case-insensitive by default, so &amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mpicc&amp;lt;/code&amp;gt; cannot both exist. Homebrew's Open MPI makes &amp;lt;code&amp;gt;/opt/homebrew/bin/mpiCC&amp;lt;/code&amp;gt; a symlink to the C wrapper &amp;lt;code&amp;gt;mpicc&amp;lt;/code&amp;gt;, which calls Apple &amp;lt;code&amp;gt;clang&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ mpiCC --showme&lt;br /&gt;
clang -I/opt/homebrew/Cellar/open-mpi/5.0.11/include -L/opt/homebrew/Cellar/open-mpi/5.0.11/lib -lmpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
clang compiles the XIOS &amp;lt;code&amp;gt;.cpp&amp;lt;/code&amp;gt; files as C++, because it picks the language from the file extension. Unless it is given &amp;lt;code&amp;gt;-stdlib=libstdc++&amp;lt;/code&amp;gt;, it compiles them against '''libc++''', LLVM's C++ standard library. libc++ puts its symbols in the inline namespace &amp;lt;code&amp;gt;std::__1::&amp;lt;/code&amp;gt;, which is why every missing symbol in the error starts with &amp;lt;code&amp;gt;std::__1::&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
GCC's &amp;lt;code&amp;gt;g++&amp;lt;/code&amp;gt; uses a different library, '''libstdc++''' (&amp;lt;code&amp;gt;-lstdc++&amp;lt;/code&amp;gt;), with its own symbol names such as &amp;lt;code&amp;gt;std::__cxx11::&amp;lt;/code&amp;gt;. The two libraries are '''not interchangeable''' at link time: an object compiled against libc++ can only be linked with libc++.&lt;br /&gt;
&lt;br /&gt;
The gcm is linked by &amp;lt;code&amp;gt;mpif90&amp;lt;/code&amp;gt; (gfortran), and gfortran does not add any C++ library on its own. The C++ library that &amp;lt;code&amp;gt;libxios.a&amp;lt;/code&amp;gt; needs must be named in &amp;lt;code&amp;gt;XIOS_LIB&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;-lstdc++&amp;lt;/code&amp;gt; is right only when XIOS was compiled with &amp;lt;code&amp;gt;g++&amp;lt;/code&amp;gt;. Here it was compiled with clang, so the linker looked for &amp;lt;code&amp;gt;std::__1::&amp;lt;/code&amp;gt; symbols in libstdc++, found none, and failed.&lt;br /&gt;
&lt;br /&gt;
The XIOS arch file already makes the same choice for the XIOS executables:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
%CCOMPILER      mpiCC&lt;br /&gt;
%LINKER         mpif90&lt;br /&gt;
%BASE_LD        -lc++&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Fix ===&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;code&amp;gt;arch/arch-CLANG_MACOSX.path&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- XIOS_LIB=&amp;quot;-lxios -lstdc++&amp;quot;&lt;br /&gt;
+ XIOS_LIB=&amp;quot;-lxios -lc++&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Checking which library your libxios.a needs ===&lt;br /&gt;
&lt;br /&gt;
From &amp;lt;code&amp;gt;LMDZ.COMMON&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nm -C ../XIOS/lib/libxios.a | grep -m1 'std::__1::'      # match -&amp;gt; libc++    (-lc++)&lt;br /&gt;
nm -C ../XIOS/lib/libxios.a | grep -m1 'std::__cxx11::'  # match -&amp;gt; libstdc++ (-lstdc++)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rule: '''&amp;lt;code&amp;gt;XIOS_LIB&amp;lt;/code&amp;gt; must name the same C++ library that compiled XIOS.''' If you rebuild XIOS with GCC's &amp;lt;code&amp;gt;g++&amp;lt;/code&amp;gt; instead, switch back to &amp;lt;code&amp;gt;-lstdc++&amp;lt;/code&amp;gt;. One way to do that rebuild is to set &amp;lt;code&amp;gt;%CCOMPILER mpicxx&amp;lt;/code&amp;gt; in the XIOS arch file and &amp;lt;code&amp;gt;export OMPI_CXX=g++-16&amp;lt;/code&amp;gt;. Setting &amp;lt;code&amp;gt;OMPI_CXX&amp;lt;/code&amp;gt; has no effect on &amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt; is really &amp;lt;code&amp;gt;mpicc&amp;lt;/code&amp;gt;, which reads &amp;lt;code&amp;gt;OMPI_CC&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Other notes ===&lt;br /&gt;
&lt;br /&gt;
* '''Preprocessor.''' Unlike the XIOS build, this arch file does not set &amp;lt;code&amp;gt;%FPP&amp;lt;/code&amp;gt;, so LMDZ.COMMON's &amp;lt;code&amp;gt;bld.cfg&amp;lt;/code&amp;gt; falls back to plain &amp;lt;code&amp;gt;cpp&amp;lt;/code&amp;gt;, which is Apple clang's preprocessor on macOS. With &amp;lt;code&amp;gt;-P -traditional&amp;lt;/code&amp;gt; this worked for the no-physics build. The &amp;lt;code&amp;gt;cpp-16&amp;lt;/code&amp;gt; workaround on the XIOS page is for the &amp;lt;code&amp;gt;##&amp;lt;/code&amp;gt; macros in XIOS's own Fortran interface, not for the gcm.&lt;br /&gt;
* '''&amp;lt;code&amp;gt;%C_COMPILER gcc&amp;lt;/code&amp;gt;''' runs &amp;lt;code&amp;gt;/usr/bin/gcc&amp;lt;/code&amp;gt;, which on macOS is Apple clang, not GNU gcc.&lt;br /&gt;
* '''Harmless warning:''' &amp;lt;code&amp;gt;ld: warning: ignoring duplicate libraries: '-lnetcdf'&amp;lt;/code&amp;gt;. It appears because &amp;lt;code&amp;gt;nc-config --libs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nf-config --flibs&amp;lt;/code&amp;gt; both list &amp;lt;code&amp;gt;-lnetcdf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Category:LMDZ]]&lt;br /&gt;
[[Category:XIOS]]&lt;br /&gt;
[[Category:macOS]]&lt;/div&gt;</description>
			<pubDate>Fri, 16 Oct 2026 10:54:28 GMT</pubDate>			<dc:creator>Mwolff</dc:creator>			<comments>http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php/Talk:Dummy_PCM_compilation_on_an_Apple_Silicon_Mac</comments>		</item>
		<item>
			<title>XIOS on an Apple Silicon Mac</title>
			<link>http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php?title=XIOS_on_an_Apple_Silicon_Mac&amp;diff=3341&amp;oldid=3337</link>
			<guid isPermaLink="false">http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php?title=XIOS_on_an_Apple_Silicon_Mac&amp;diff=3341&amp;oldid=3337</guid>
			<description>&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Compiling XIOS on macOS (Apple Silicon) with openmpi and clang&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 10:37, 16 October 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='4' style='text-align: center;' class='diff-multi' lang='en'&gt;(3 intermediate revisions by the same user not shown)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Compiling XIOS on macOS (Apple Silicon) with &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Open MPI &lt;/del&gt;and &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Clang &lt;/del&gt;=&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Compiling XIOS on macOS (Apple Silicon) with &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;openmpi &lt;/ins&gt;and &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;clang &lt;/ins&gt;=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This page &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;provides &lt;/del&gt;the three XIOS arch files needed to build XIOS on macOS &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;with &lt;/del&gt;Homebrew gfortran and Homebrew Open MPI. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;In this setup &lt;/del&gt;the Open MPI C++ wrapper &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;calls &lt;/del&gt;Apple '''clang''', not GCC. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Because of that&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;two settings differ from the stock &amp;lt;code&amp;gt;arch-gfortran&amp;lt;/code&amp;gt; files. They are explained in &lt;/del&gt;[[#Background: Open MPI uses Clang, not GCC|the background section]] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;below&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This page &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;makes the assumption that you have built and installed the parallel version of NetCDF similarly to that described on the page [[NetCDF-Parallel on an Apple Silicon Mac]].&amp;#160; Below, one finds &lt;/ins&gt;the three XIOS arch files needed to build XIOS on macOS &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(using &lt;/ins&gt;Homebrew gfortran and Homebrew Open MPI&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;)&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; The customizations here with respect to the stock &amp;lt;code&amp;gt;arch-gfortran&amp;lt;/code&amp;gt; files are driven by &lt;/ins&gt;the Open MPI C++ wrapper &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;calling &lt;/ins&gt;Apple '''clang''', not GCC &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(e.g&lt;/ins&gt;., [[#Background: Open MPI uses Clang, not GCC|the background section]]&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;)&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Tested environment ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Tested environment ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l9&quot; &gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Apple clang 21, which provides &amp;lt;code&amp;gt;/usr/bin/cpp&amp;lt;/code&amp;gt; and is called by &amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Apple clang 21, which provides &amp;lt;code&amp;gt;/usr/bin/cpp&amp;lt;/code&amp;gt; and is called by &amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Open MPI 5.0.11 (Homebrew)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Open MPI 5.0.11 (Homebrew)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* netCDF-C 4.10.1 and netCDF-Fortran 4.6.4, compiled from source against Open MPI and installed in &amp;lt;code&amp;gt;/opt/parallel-netcdf&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* netCDF-C 4.10.1 and netCDF-Fortran 4.6.4, compiled from source against Open MPI&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(which is where the CLANG dependence originates) &lt;/ins&gt;and installed in &amp;lt;code&amp;gt;/opt/parallel-netcdf&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Arch files ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Arch files ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l20&quot; &gt;Line 20:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 20:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Environment to compile XIOS on Mac OS X with NETCDF compiled with CLANG&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Environment to compile XIOS on Mac OS X with NETCDF compiled with CLANG &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(through openmpi)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Tested successfully with :&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Tested successfully with :&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l91&quot; &gt;Line 91:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 91:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Use &amp;lt;code&amp;gt;--full&amp;lt;/code&amp;gt; to rebuild from scratch&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;. &amp;lt;code&amp;gt;make_xios&amp;lt;/code&amp;gt; has no &amp;lt;code&amp;gt;--clean&amp;lt;/code&amp;gt; option, and it ignores unknown options without any warning. So &amp;lt;code&amp;gt;./make_xios --clean&amp;lt;/code&amp;gt; cleans nothing. FCM then keeps reusing old preprocessed files in &amp;lt;code&amp;gt;ppsrc/&amp;lt;/code&amp;gt;, and a fix to the preprocessor settings does not take effect&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Use &amp;lt;code&amp;gt;--full&amp;lt;/code&amp;gt; to rebuild from scratch. &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A successful build produces:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;A successful build produces:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;lib/libxios.a&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;lib/libxios.a&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &amp;lt;code&amp;gt;bin/xios_server.exe&amp;lt;/code&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* &amp;lt;code&amp;gt;bin/generic_testcase.exe&amp;lt;/code&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Background: Open MPI uses Clang, not GCC ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Background: Open MPI uses Clang, not GCC ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key PlanetsWiki:diff:version:1.11a:oldid:3337:newid:3341 --&gt;
&lt;/table&gt;</description>
			<pubDate>Fri, 16 Oct 2026 10:37:41 GMT</pubDate>			<dc:creator>Mwolff</dc:creator>			<comments>http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php/Talk:XIOS_on_an_Apple_Silicon_Mac</comments>		</item>
		<item>
			<title>XIOS on an Apple Silicon Mac</title>
			<link>http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php?title=XIOS_on_an_Apple_Silicon_Mac&amp;diff=3337&amp;oldid=0</link>
			<guid isPermaLink="false">http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php?title=XIOS_on_an_Apple_Silicon_Mac&amp;diff=3337&amp;oldid=0</guid>
			<description>&lt;p&gt;Created page with &amp;quot;= Compiling XIOS on macOS (Apple Silicon) with Open MPI and Clang =  This page provides the three XIOS arch files needed to build XIOS on macOS with Homebrew gfortran and Home...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Compiling XIOS on macOS (Apple Silicon) with Open MPI and Clang =&lt;br /&gt;
&lt;br /&gt;
This page provides the three XIOS arch files needed to build XIOS on macOS with Homebrew gfortran and Homebrew Open MPI. In this setup the Open MPI C++ wrapper calls Apple '''clang''', not GCC. Because of that, two settings differ from the stock &amp;lt;code&amp;gt;arch-gfortran&amp;lt;/code&amp;gt; files. They are explained in [[#Background: Open MPI uses Clang, not GCC|the background section]] below.&lt;br /&gt;
&lt;br /&gt;
== Tested environment ==&lt;br /&gt;
&lt;br /&gt;
* macOS 26 (Darwin 25.6.0), Apple Silicon (arm64)&lt;br /&gt;
* GNU Fortran 16.2.0 (Homebrew), installed as &amp;lt;code&amp;gt;gfortran&amp;lt;/code&amp;gt;&lt;br /&gt;
* Apple clang 21, which provides &amp;lt;code&amp;gt;/usr/bin/cpp&amp;lt;/code&amp;gt; and is called by &amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt;&lt;br /&gt;
* Open MPI 5.0.11 (Homebrew)&lt;br /&gt;
* netCDF-C 4.10.1 and netCDF-Fortran 4.6.4, compiled from source against Open MPI and installed in &amp;lt;code&amp;gt;/opt/parallel-netcdf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arch files ==&lt;br /&gt;
&lt;br /&gt;
Create these three files in the &amp;lt;code&amp;gt;arch/&amp;lt;/code&amp;gt; directory of your XIOS source tree.&lt;br /&gt;
&lt;br /&gt;
=== arch/arch-CLANG_MACOSX.env ===&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;NETCDF_DIR&amp;lt;/code&amp;gt; to match your netCDF installation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Environment to compile XIOS on Mac OS X with NETCDF compiled with CLANG&lt;br /&gt;
#&lt;br /&gt;
# Tested successfully with :&lt;br /&gt;
#   Mac OS X 25.6.0&lt;br /&gt;
#   Prerequisite softwares installed with Homebrew&lt;br /&gt;
#     gfortran       : 16.2.0&lt;br /&gt;
#     openmpi        : 5.0.11&lt;br /&gt;
#&lt;br /&gt;
#   Compiled from source with open-mpi&lt;br /&gt;
#     netcdf         : netCDF 4.10.1 netCDF-Fortran 4.6.4&lt;br /&gt;
#&lt;br /&gt;
#&lt;br /&gt;
export NETCDF_DIR=/opt/parallel-netcdf&lt;br /&gt;
export NETCDF_INC_DIR=${NETCDF_DIR}/include&lt;br /&gt;
export NETCDF_LIB_DIR=${NETCDF_DIR}/lib&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== arch/arch-CLANG_MACOSX.fcm ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
################################################################################&lt;br /&gt;
###################                Projet XIOS               ###################&lt;br /&gt;
################################################################################&lt;br /&gt;
#Build environment (2026-10-13):&lt;br /&gt;
#&lt;br /&gt;
#- macOS 26 (Darwin 25.6.0), arm64&lt;br /&gt;
#- GNU Fortran 16.2.0 (Homebrew), installed as `gfortran`&lt;br /&gt;
#- Apple clang 21, which provides `/usr/bin/cpp` and is wrapped by `mpiCC`&lt;br /&gt;
#- Open MPI 5.0.11 (Homebrew)&lt;br /&gt;
## Summary&lt;br /&gt;
&lt;br /&gt;
%CCOMPILER      mpiCC&lt;br /&gt;
%FCOMPILER      mpif90&lt;br /&gt;
%LINKER         mpif90&lt;br /&gt;
&lt;br /&gt;
%BASE_CFLAGS    -w -std=gnu++11&lt;br /&gt;
%PROD_CFLAGS    -O3 -D BOOST_DISABLE_ASSERTS&lt;br /&gt;
%DEV_CFLAGS     -g&lt;br /&gt;
%DEBUG_CFLAGS   -g -O2&lt;br /&gt;
&lt;br /&gt;
%BASE_FFLAGS    -D__NONE__ -ffree-line-length-none&lt;br /&gt;
%PROD_FFLAGS    -O3&lt;br /&gt;
%DEV_FFLAGS     -g -O2&lt;br /&gt;
%DEBUG_FFLAGS   -g&lt;br /&gt;
&lt;br /&gt;
%BASE_INC       -D__NONE__&lt;br /&gt;
%BASE_LD        -lc++&lt;br /&gt;
&lt;br /&gt;
%CPP             cpp -P -undef&lt;br /&gt;
%FPP             cpp-16 -P&lt;br /&gt;
%MAKE           make&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== arch/arch-CLANG_MACOSX.path ===&lt;br /&gt;
&lt;br /&gt;
This file gets the netCDF flags from &amp;lt;code&amp;gt;nc-config&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nf-config&amp;lt;/code&amp;gt;, so both must be on your &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
NETCDF_INCDIR=&amp;quot;$(nc-config --cflags) $(nf-config --fflags)&amp;quot;&lt;br /&gt;
NETCDF_LIBDIR=&amp;quot;$(nc-config --libs) $(nf-config --flibs)&amp;quot;&lt;br /&gt;
NETCDF_LIB=&amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
From the top of the XIOS source tree:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./make_xios --arch CLANG_MACOSX --job 8 --full &amp;gt; make_xios.out 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;--full&amp;lt;/code&amp;gt; to rebuild from scratch. &amp;lt;code&amp;gt;make_xios&amp;lt;/code&amp;gt; has no &amp;lt;code&amp;gt;--clean&amp;lt;/code&amp;gt; option, and it ignores unknown options without any warning. So &amp;lt;code&amp;gt;./make_xios --clean&amp;lt;/code&amp;gt; cleans nothing. FCM then keeps reusing old preprocessed files in &amp;lt;code&amp;gt;ppsrc/&amp;lt;/code&amp;gt;, and a fix to the preprocessor settings does not take effect.&lt;br /&gt;
&lt;br /&gt;
A successful build produces:&lt;br /&gt;
* &amp;lt;code&amp;gt;lib/libxios.a&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;bin/xios_server.exe&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;bin/generic_testcase.exe&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Background: Open MPI uses Clang, not GCC ==&lt;br /&gt;
&lt;br /&gt;
On Linux, &amp;lt;code&amp;gt;mpif90&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mpicc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mpicxx&amp;lt;/code&amp;gt; usually all call the GNU compilers. With Homebrew on macOS, Open MPI is built with Apple's toolchain. Only the Fortran wrapper calls GCC:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Component !! Wrapper !! Underlying compiler !! C++ standard library&lt;br /&gt;
|-&lt;br /&gt;
| XIOS (C++ core) || &amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt; || Apple '''clang''' || '''libc++''' (LLVM), linked with &amp;lt;code&amp;gt;-lc++&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| XIOS Fortran interface, and the model (e.g. LMDZ / PCM) || &amp;lt;code&amp;gt;mpif90&amp;lt;/code&amp;gt; || Homebrew '''gfortran''' || none (GCC Fortran runtime)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This mix causes two problems: one with the preprocessor and one at link time.&lt;br /&gt;
&lt;br /&gt;
=== Why mpiCC is really clang ===&lt;br /&gt;
&lt;br /&gt;
macOS filesystems are case-insensitive by default, so the files &amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;mpicc&amp;lt;/code&amp;gt; cannot both exist. Homebrew's Open MPI makes &amp;lt;code&amp;gt;/opt/homebrew/bin/mpiCC&amp;lt;/code&amp;gt; a symlink to the C wrapper &amp;lt;code&amp;gt;mpicc&amp;lt;/code&amp;gt;, which calls Apple &amp;lt;code&amp;gt;clang&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ mpiCC --showme&lt;br /&gt;
clang -I/opt/homebrew/Cellar/open-mpi/5.0.11/include -L/opt/homebrew/Cellar/open-mpi/5.0.11/lib -lmpi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
clang still compiles the XIOS &amp;lt;code&amp;gt;.cpp&amp;lt;/code&amp;gt; files as C++, because it picks the language from the file extension. But it compiles them against '''libc++''', LLVM's C++ standard library, not GCC's '''libstdc++'''.&lt;br /&gt;
&lt;br /&gt;
A side effect: &amp;lt;code&amp;gt;OMPI_CXX&amp;lt;/code&amp;gt; has no effect on &amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;mpiCC&amp;lt;/code&amp;gt; is really &amp;lt;code&amp;gt;mpicc&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;mpicc&amp;lt;/code&amp;gt; reads &amp;lt;code&amp;gt;OMPI_CC&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== 1. Link library: &amp;lt;code&amp;gt;-lc++&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;-lstdc++&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
The stock &amp;lt;code&amp;gt;arch-gfortran.fcm&amp;lt;/code&amp;gt; sets &amp;lt;code&amp;gt;%BASE_LD -lstdc++&amp;lt;/code&amp;gt;. With clang-compiled C++ objects, the link of &amp;lt;code&amp;gt;xios_server.exe&amp;lt;/code&amp;gt; fails with errors like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Undefined symbols for architecture arm64:&lt;br /&gt;
  &amp;quot;std::__1::basic_string&amp;lt;...&amp;gt;::copy(...) const&amp;quot;, referenced from: ...&lt;br /&gt;
  &amp;quot;std::__1::regex_error::regex_error(...)&amp;quot;, referenced from: ...&lt;br /&gt;
ld: symbol(s) not found for architecture arm64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;std::__1::&amp;lt;/code&amp;gt; prefix is libc++'s inline namespace. libstdc++ uses different names, such as &amp;lt;code&amp;gt;std::__cxx11::&amp;lt;/code&amp;gt;. The two libraries are '''not interchangeable''' at link time: an object compiled against libc++ can only be linked with libc++.&lt;br /&gt;
&lt;br /&gt;
The final link is done by &amp;lt;code&amp;gt;mpif90&amp;lt;/code&amp;gt; (gfortran), and gfortran does not add any C++ library on its own. The arch file must name the right one, so &amp;lt;code&amp;gt;%BASE_LD&amp;lt;/code&amp;gt; is set to &amp;lt;code&amp;gt;-lc++&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''This also applies to every program that links against this &amp;lt;code&amp;gt;libxios.a&amp;lt;/code&amp;gt;.''' For example, the LMDZ / PCM arch &amp;lt;code&amp;gt;.path&amp;lt;/code&amp;gt; file must use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XIOS_LIB=&amp;quot;-lxios -lc++&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and not &amp;lt;code&amp;gt;-lstdc++&amp;lt;/code&amp;gt;. Otherwise the model build compiles all its sources and then fails at the final link with hundreds of undefined &amp;lt;code&amp;gt;std::__1::&amp;lt;/code&amp;gt; symbols coming from &amp;lt;code&amp;gt;libxios.a&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To check which C++ library an existing &amp;lt;code&amp;gt;libxios.a&amp;lt;/code&amp;gt; needs:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
nm -C lib/libxios.a | grep -m1 'std::__1::'      # match -&amp;gt; libc++    (-lc++)&lt;br /&gt;
nm -C lib/libxios.a | grep -m1 'std::__cxx11::'  # match -&amp;gt; libstdc++ (-lstdc++)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rule: '''the C++ library named at link time must be the same one that compiled XIOS.''' If you rebuild XIOS with GCC's &amp;lt;code&amp;gt;g++&amp;lt;/code&amp;gt; instead (for example &amp;lt;code&amp;gt;%CCOMPILER mpicxx&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;export OMPI_CXX=g++-16&amp;lt;/code&amp;gt;), switch back to &amp;lt;code&amp;gt;-lstdc++&amp;lt;/code&amp;gt; in both the XIOS and the model arch files.&lt;br /&gt;
&lt;br /&gt;
=== 2. Fortran preprocessor: &amp;lt;code&amp;gt;cpp-16&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;cpp&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
The XIOS Fortran interface builds its names with a token-pasting macro, defined in &amp;lt;code&amp;gt;src/interface/fortran/xios_fortran_prefix.hpp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#define xios(arg)  xios_##arg&lt;br /&gt;
#define txios(arg) xios_##arg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On macOS, &amp;lt;code&amp;gt;/usr/bin/cpp&amp;lt;/code&amp;gt; is Apple clang. It does not expand &amp;lt;code&amp;gt;##&amp;lt;/code&amp;gt; in these files, so &amp;lt;code&amp;gt;txios(duration)&amp;lt;/code&amp;gt; comes out as &amp;lt;code&amp;gt;xios_##duration&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;xios_duration&amp;lt;/code&amp;gt;. Compilation then fails, for example in &amp;lt;code&amp;gt;duration_interface.f90&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IMPORT :: xios_##duration&lt;br /&gt;
Error: Syntax error in IMPORT statement at (1)&lt;br /&gt;
TYPE(xios_##duration), VALUE :: dur&lt;br /&gt;
Error: Malformed type-spec at (1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fix is to use the GNU C preprocessor that comes with Homebrew GCC for Fortran files: &amp;lt;code&amp;gt;%FPP cpp-16 -P&amp;lt;/code&amp;gt;. The &amp;lt;code&amp;gt;-16&amp;lt;/code&amp;gt; suffix follows the major version of Homebrew GCC. If GCC is upgraded, update this line to match. Check the installed version with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ls /opt/homebrew/bin/cpp-*&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;gfortran -E -P -cpp&amp;lt;/code&amp;gt; may also work as the Fortran preprocessor, but it has not been tested.&lt;br /&gt;
&lt;br /&gt;
=== Harmless warning ===&lt;br /&gt;
&lt;br /&gt;
The XIOS build and the model builds may print:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ld: warning: ignoring duplicate libraries: '-lnetcdf'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It appears because &amp;lt;code&amp;gt;nc-config --libs&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;nf-config --flibs&amp;lt;/code&amp;gt; both list &amp;lt;code&amp;gt;-lnetcdf&amp;lt;/code&amp;gt;. You can ignore it.&lt;br /&gt;
&lt;br /&gt;
[[Category:XIOS]]&lt;br /&gt;
[[Category:macOS]]&lt;/div&gt;</description>
			<pubDate>Fri, 16 Oct 2026 10:14:32 GMT</pubDate>			<dc:creator>Mwolff</dc:creator>			<comments>http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php/Talk:XIOS_on_an_Apple_Silicon_Mac</comments>		</item>
		<item>
			<title>NetCDF-Parallel on an Apple Silicon Mac</title>
			<link>http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php?title=NetCDF-Parallel_on_an_Apple_Silicon_Mac&amp;diff=3336&amp;oldid=3326</link>
			<guid isPermaLink="false">http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php?title=NetCDF-Parallel_on_an_Apple_Silicon_Mac&amp;diff=3336&amp;oldid=3326</guid>
			<description>&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Building a parallel NetCDF-4 stack on macOS (Apple Silicon) with the build scripts&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;a href=&quot;http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php?title=NetCDF-Parallel_on_an_Apple_Silicon_Mac&amp;amp;diff=3336&amp;amp;oldid=3326&quot;&gt;Show changes&lt;/a&gt;</description>
			<pubDate>Thu, 15 Oct 2026 19:47:20 GMT</pubDate>			<dc:creator>Mwolff</dc:creator>			<comments>http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php/Talk:NetCDF-Parallel_on_an_Apple_Silicon_Mac</comments>		</item>
		<item>
			<title>NetCDF-Parallel on an Apple Silicon Mac</title>
			<link>http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php?title=NetCDF-Parallel_on_an_Apple_Silicon_Mac&amp;diff=3326&amp;oldid=0</link>
			<guid isPermaLink="false">http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php?title=NetCDF-Parallel_on_an_Apple_Silicon_Mac&amp;diff=3326&amp;oldid=0</guid>
			<description>&lt;p&gt;Created page with &amp;quot;= Building a parallel NetCDF-4 stack on macOS (Apple Silicon) =  This page builds &amp;#039;&amp;#039;&amp;#039;Parallel HDF5 → NetCDF-C → NetCDF-Fortran → NetCDF-C++4&amp;#039;&amp;#039;&amp;#039; from source with Open MPI...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Building a parallel NetCDF-4 stack on macOS (Apple Silicon) =&lt;br /&gt;
&lt;br /&gt;
This page builds '''Parallel HDF5 → NetCDF-C → NetCDF-Fortran → NetCDF-C++4''' from source with Open MPI and installs everything into &amp;lt;code&amp;gt;/opt/parallel-netcdf&amp;lt;/code&amp;gt;. Every step is a block of commands to copy and paste into a terminal, followed by what you should see.&lt;br /&gt;
&lt;br /&gt;
It reproduces the build scripts &amp;lt;code&amp;gt;0_env_setup.sh&amp;lt;/code&amp;gt; … &amp;lt;code&amp;gt;4_build_netcdf_cxx.sh&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;NetCDFlib&amp;lt;/code&amp;gt; directory. If the two ever disagree, the scripts are the reference.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Package !! Version !! Source&lt;br /&gt;
|-&lt;br /&gt;
| HDF5 || 2.2.0 || GitHub release (HDFGroup/hdf5)&lt;br /&gt;
|-&lt;br /&gt;
| NetCDF-C || 4.10.1 || downloads.unidata.ucar.edu&lt;br /&gt;
|-&lt;br /&gt;
| NetCDF-Fortran || 4.6.4 || downloads.unidata.ucar.edu&lt;br /&gt;
|-&lt;br /&gt;
| NetCDF-C++4 || 4.3.1 || downloads.unidata.ucar.edu&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
''Last verified: 2026-10-15, macOS 26 (Darwin 25.6), Apple Silicon, 18 cores, Homebrew Open MPI 5.0.11.'' Total time is about 10–12 minutes, plus under a minute of downloads.&lt;br /&gt;
&lt;br /&gt;
== Before you start ==&lt;br /&gt;
&lt;br /&gt;
* Use '''one terminal window for the whole page'''. Step 0 sets variables that every later step needs. If you close the terminal or open a new one, paste the Step 0 block again before continuing.&lt;br /&gt;
* The commands are written for '''bash'''. macOS terminals start &amp;lt;code&amp;gt;zsh&amp;lt;/code&amp;gt; by default, so type &amp;lt;code&amp;gt;bash&amp;lt;/code&amp;gt; first and press Enter.&lt;br /&gt;
* Paste one block at a time and compare the result with the '''Expected''' box before moving on. If something differs, stop and see [[#Troubleshooting|Troubleshooting]].&lt;br /&gt;
* Don't paste the contents of the '''Expected''' boxes; they are output, not commands.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Install the compilers, Open MPI and build tools with Homebrew:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
brew install gcc openmpi zlib ccache wget cmake&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Expected:''' Homebrew finishes without errors. Check that the MPI compiler wrappers are found:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
which mpicc mpicxx mpif90&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' three paths under &amp;lt;code&amp;gt;/opt/homebrew/bin/&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 0 – Set up the environment ==&lt;br /&gt;
&lt;br /&gt;
This defines the versions, directories and compilers used by every later step. It creates &amp;lt;code&amp;gt;/opt/parallel-netcdf&amp;lt;/code&amp;gt; the first time, which asks for your password (&amp;lt;code&amp;gt;sudo&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ROOT&amp;lt;/code&amp;gt; is the base directory for the downloaded source archives (&amp;lt;code&amp;gt;$ROOT/netcdf_archives&amp;lt;/code&amp;gt;) and the temporary build tree (&amp;lt;code&amp;gt;$ROOT/netcdf_parallel_scratch&amp;lt;/code&amp;gt;). It is set to your home directory; to use another location (for example a larger disk), change the first line before pasting. The installation itself always goes to &amp;lt;code&amp;gt;/opt/parallel-netcdf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export ROOT=$HOME&lt;br /&gt;
&lt;br /&gt;
export HDF5_VER=&amp;quot;2.2.0&amp;quot;&lt;br /&gt;
export NETCDF_C_VER=&amp;quot;4.10.1&amp;quot;&lt;br /&gt;
export NETCDF_F_VER=&amp;quot;4.6.4&amp;quot;&lt;br /&gt;
export NETCDF_CXX_VER=&amp;quot;4.3.1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
export ARCHIVE_DIR=&amp;quot;$ROOT/netcdf_archives&amp;quot;&lt;br /&gt;
export PREFIX=&amp;quot;/opt/parallel-netcdf&amp;quot;&lt;br /&gt;
export TMP_BUILD_DIR=&amp;quot;$ROOT/netcdf_parallel_scratch&amp;quot;&lt;br /&gt;
export HOMEBREW_PREFIX=&amp;quot;/opt/homebrew&amp;quot;&lt;br /&gt;
export NUM_CORES=$(sysctl -n hw.ncpu)&lt;br /&gt;
&lt;br /&gt;
export CC=mpicc&lt;br /&gt;
export CXX=mpicxx&lt;br /&gt;
export FC=mpif90&lt;br /&gt;
export F77=mpif77&lt;br /&gt;
&lt;br /&gt;
export OMPI_MCA_io=romio341&lt;br /&gt;
&lt;br /&gt;
export CPPFLAGS=&amp;quot;-I$PREFIX/include -I$HOMEBREW_PREFIX/opt/zlib/include&amp;quot;&lt;br /&gt;
export LDFLAGS=&amp;quot;-L$PREFIX/lib -L$HOMEBREW_PREFIX/opt/zlib/lib&amp;quot;&lt;br /&gt;
export PATH=&amp;quot;$PREFIX/bin:$PATH&amp;quot;&lt;br /&gt;
&lt;br /&gt;
if [ ! -d &amp;quot;$PREFIX&amp;quot; ]; then&lt;br /&gt;
    sudo mkdir -p &amp;quot;$PREFIX&amp;quot;&lt;br /&gt;
    sudo chown -R $(whoami):admin &amp;quot;$PREFIX&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
mkdir -p &amp;quot;$ARCHIVE_DIR&amp;quot; &amp;quot;$TMP_BUILD_DIR&amp;quot;&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;ROOT=$ROOT  PREFIX=$PREFIX  cores=$NUM_CORES  HDF5=$HDF5_VER  C=$NETCDF_C_VER  F=$NETCDF_F_VER  CXX=$NETCDF_CXX_VER&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' one line such as &amp;lt;code&amp;gt;ROOT=/Users/yourname  PREFIX=/opt/parallel-netcdf  cores=18  HDF5=2.2.0  C=4.10.1  F=4.6.4  CXX=4.3.1&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OMPI_MCA_io=romio341&amp;lt;/code&amp;gt; is not optional: without it, Open MPI's default I/O layer can hang during large parallel writes on macOS (see [[#Troubleshooting|Troubleshooting]]).&lt;br /&gt;
&lt;br /&gt;
To check later that the environment is still set (for example after a break), run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;PREFIX=$PREFIX  cores=$NUM_CORES  HDF5=$HDF5_VER&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;code&amp;gt;PREFIX=&amp;lt;/code&amp;gt; is empty, paste the Step 0 block again.&lt;br /&gt;
&lt;br /&gt;
== Step 1 – Download the sources ==&lt;br /&gt;
&lt;br /&gt;
These must be the '''official release tarballs'''. The &amp;quot;Source code&amp;quot; archives that GitHub generates automatically lack the &amp;lt;code&amp;gt;configure&amp;lt;/code&amp;gt; script and will not build. The NetCDF libraries are downloaded from Unidata because their GitHub releases have no downloadable files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$ARCHIVE_DIR&amp;quot;&lt;br /&gt;
curl -fL --retry 3 -o &amp;quot;hdf5-${HDF5_VER}.tar.gz&amp;quot; &amp;quot;https://github.com/HDFGroup/hdf5/releases/download/${HDF5_VER}/hdf5-${HDF5_VER}.tar.gz&amp;quot;&lt;br /&gt;
curl -fL --retry 3 -o &amp;quot;netcdf-c-${NETCDF_C_VER}.tar.gz&amp;quot; &amp;quot;https://downloads.unidata.ucar.edu/netcdf-c/${NETCDF_C_VER}/netcdf-c-${NETCDF_C_VER}.tar.gz&amp;quot;&lt;br /&gt;
curl -fL --retry 3 -o &amp;quot;netcdf-fortran-${NETCDF_F_VER}.tar.gz&amp;quot; &amp;quot;https://downloads.unidata.ucar.edu/netcdf-fortran/${NETCDF_F_VER}/netcdf-fortran-${NETCDF_F_VER}.tar.gz&amp;quot;&lt;br /&gt;
curl -fL --retry 3 -o &amp;quot;netcdf-cxx4-${NETCDF_CXX_VER}.tar.gz&amp;quot; &amp;quot;https://downloads.unidata.ucar.edu/netcdf-cxx/${NETCDF_CXX_VER}/netcdf-cxx4-${NETCDF_CXX_VER}.tar.gz&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check that all four files are intact:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$ARCHIVE_DIR&amp;quot;&lt;br /&gt;
gzip -t &amp;quot;hdf5-${HDF5_VER}.tar.gz&amp;quot; &amp;amp;&amp;amp; echo &amp;quot;hdf5 OK&amp;quot;&lt;br /&gt;
gzip -t &amp;quot;netcdf-c-${NETCDF_C_VER}.tar.gz&amp;quot; &amp;amp;&amp;amp; echo &amp;quot;netcdf-c OK&amp;quot;&lt;br /&gt;
gzip -t &amp;quot;netcdf-fortran-${NETCDF_F_VER}.tar.gz&amp;quot; &amp;amp;&amp;amp; echo &amp;quot;netcdf-fortran OK&amp;quot;&lt;br /&gt;
gzip -t &amp;quot;netcdf-cxx4-${NETCDF_CXX_VER}.tar.gz&amp;quot; &amp;amp;&amp;amp; echo &amp;quot;netcdf-cxx4 OK&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' four &amp;lt;code&amp;gt;OK&amp;lt;/code&amp;gt; lines. A &amp;lt;code&amp;gt;curl: (22) ... 404&amp;lt;/code&amp;gt; error means that version is not available at that URL; check the version numbers in Step 0.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 2 – Parallel HDF5 (about 3 minutes) ==&lt;br /&gt;
&lt;br /&gt;
HDF5 2.x is built with CMake.&lt;br /&gt;
&lt;br /&gt;
=== Extract ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm -rf &amp;quot;$TMP_BUILD_DIR/hdf5-${HDF5_VER}&amp;quot;&lt;br /&gt;
tar -xzf &amp;quot;$ARCHIVE_DIR/hdf5-${HDF5_VER}.tar.gz&amp;quot; -C &amp;quot;$TMP_BUILD_DIR&amp;quot;&lt;br /&gt;
mkdir -p &amp;quot;$TMP_BUILD_DIR/hdf5-${HDF5_VER}/build&amp;quot;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/hdf5-${HDF5_VER}/build&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Configure ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cmake .. \&lt;br /&gt;
  -DCMAKE_INSTALL_PREFIX=&amp;quot;$PREFIX&amp;quot; \&lt;br /&gt;
  -DCMAKE_INSTALL_NAME_DIR=&amp;quot;$PREFIX/lib&amp;quot; \&lt;br /&gt;
  -DHDF5_ENABLE_PARALLEL=ON \&lt;br /&gt;
  -DHDF5_BUILD_FORTRAN=ON \&lt;br /&gt;
  -DHDF5_ENABLE_ZLIB_SUPPORT=ON \&lt;br /&gt;
  -DZLIB_INCLUDE_DIR=&amp;quot;$HOMEBREW_PREFIX/opt/zlib/include&amp;quot; \&lt;br /&gt;
  -DZLIB_LIBRARY=&amp;quot;$HOMEBREW_PREFIX/opt/zlib/lib/libz.dylib&amp;quot; \&lt;br /&gt;
  -DBUILD_SHARED_LIBS=ON \&lt;br /&gt;
  -DBUILD_TESTING=ON \&lt;br /&gt;
  -DHDF5_TEST_TOOLS=OFF \&lt;br /&gt;
  -DHDF5_TEST_SWMR=OFF \&lt;br /&gt;
  -DHDF5_TEST_EXAMPLES=OFF \&lt;br /&gt;
  -DMPIEXEC_MAX_NUMPROCS=4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' ends with &amp;lt;code&amp;gt;-- Build files have been written to: …/build&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Build ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/hdf5-${HDF5_VER}/build&amp;quot;&lt;br /&gt;
make -j&amp;quot;$NUM_CORES&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' ends at &amp;lt;code&amp;gt;[100%]&amp;lt;/code&amp;gt; with no &amp;lt;code&amp;gt;Error&amp;lt;/code&amp;gt; lines.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test (about 1.5 minutes) ===&lt;br /&gt;
&lt;br /&gt;
Paste this block '''on its own''' and wait for it to finish. The MPI tests read from the terminal, so commands pasted ahead of time would be swallowed and never run.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/hdf5-${HDF5_VER}/build&amp;quot;&lt;br /&gt;
ctest -j&amp;quot;$NUM_CORES&amp;quot; --output-on-failure 2&amp;gt;&amp;amp;1 | tee ctest.log | tail -5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' &amp;lt;code&amp;gt;100% tests passed out of 826&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/hdf5-${HDF5_VER}/build&amp;quot;&lt;br /&gt;
make install&lt;br /&gt;
otool -D &amp;quot;$PREFIX/lib/libhdf5_hl.dylib&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' the last line is &amp;lt;code&amp;gt;/opt/parallel-netcdf/lib/libhdf5_hl.320.dylib&amp;lt;/code&amp;gt;. If it starts with &amp;lt;code&amp;gt;@rpath/&amp;lt;/code&amp;gt; instead, the &amp;lt;code&amp;gt;CMAKE_INSTALL_NAME_DIR&amp;lt;/code&amp;gt; setting was lost; redo this step.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 3 – NetCDF-C (about 5–6 minutes) ==&lt;br /&gt;
&lt;br /&gt;
=== Extract and configure ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm -rf &amp;quot;$TMP_BUILD_DIR/netcdf-c-${NETCDF_C_VER}&amp;quot;&lt;br /&gt;
tar -xzf &amp;quot;$ARCHIVE_DIR/netcdf-c-${NETCDF_C_VER}.tar.gz&amp;quot; -C &amp;quot;$TMP_BUILD_DIR&amp;quot;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-c-${NETCDF_C_VER}&amp;quot;&lt;br /&gt;
export LIBS=&amp;quot;-lhdf5_hl -lhdf5 -lz&amp;quot;&lt;br /&gt;
./configure --prefix=&amp;quot;$PREFIX&amp;quot; --host=aarch64-apple-darwin --enable-netcdf-4 --enable-parallel4 --disable-dap --disable-parallel-tests&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' ends with a &amp;quot;NetCDF C Configuration Summary&amp;quot; that includes &amp;lt;code&amp;gt;HDF5 Support: yes&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;NC-4 Parallel Support: yes&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Build ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-c-${NETCDF_C_VER}&amp;quot;&lt;br /&gt;
make -j&amp;quot;$NUM_CORES&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test (about 5 minutes) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-c-${NETCDF_C_VER}&amp;quot;&lt;br /&gt;
make check &amp;gt; check.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
echo &amp;quot;PASS: $(grep -c '^PASS:' check.log)   FAIL: $(grep -c -E '^(FAIL|ERROR):' check.log)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' &amp;lt;code&amp;gt;PASS: 240   FAIL: 0&amp;lt;/code&amp;gt;. A much smaller PASS count means testing stopped early at a failure; run &amp;lt;code&amp;gt;grep -E '^(FAIL|ERROR):' check.log&amp;lt;/code&amp;gt; to see which one.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install and verify ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-c-${NETCDF_C_VER}&amp;quot;&lt;br /&gt;
make install&lt;br /&gt;
unset LIBS&lt;br /&gt;
nc-config --has-parallel4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' &amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt;. If it prints &amp;lt;code&amp;gt;no&amp;lt;/code&amp;gt;, NetCDF-C was built without parallel support: stop here.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 4 – NetCDF-Fortran (about 2 minutes) ==&lt;br /&gt;
&lt;br /&gt;
=== Extract and configure ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm -rf &amp;quot;$TMP_BUILD_DIR/netcdf-fortran-${NETCDF_F_VER}&amp;quot;&lt;br /&gt;
tar -xzf &amp;quot;$ARCHIVE_DIR/netcdf-fortran-${NETCDF_F_VER}.tar.gz&amp;quot; -C &amp;quot;$TMP_BUILD_DIR&amp;quot;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-fortran-${NETCDF_F_VER}&amp;quot;&lt;br /&gt;
export LIBS=&amp;quot;-lnetcdf -lhdf5_hl -lhdf5 -lz&amp;quot;&lt;br /&gt;
./configure --prefix=&amp;quot;$PREFIX&amp;quot; --host=aarch64-apple-darwin --disable-parallel-tests&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Build ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-fortran-${NETCDF_F_VER}&amp;quot;&lt;br /&gt;
make -j&amp;quot;$NUM_CORES&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' many &amp;lt;code&amp;gt;Warning: Type mismatch …&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;Rank mismatch …&amp;lt;/code&amp;gt; messages from gfortran. These are normal for NetCDF-Fortran; only &amp;lt;code&amp;gt;Error&amp;lt;/code&amp;gt; lines matter.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-fortran-${NETCDF_F_VER}&amp;quot;&lt;br /&gt;
make check &amp;gt; check.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
echo &amp;quot;PASS: $(grep -c '^PASS:' check.log)   FAIL: $(grep -c -E '^(FAIL|ERROR):' check.log)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' &amp;lt;code&amp;gt;PASS: 59   FAIL: 0&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install and verify ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-fortran-${NETCDF_F_VER}&amp;quot;&lt;br /&gt;
make install&lt;br /&gt;
unset LIBS&lt;br /&gt;
nf-config --has-nc4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' &amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 5 – NetCDF-C++4 (under 1 minute) ==&lt;br /&gt;
&lt;br /&gt;
NetCDF-C++ needs two extra commands that remove files named &amp;lt;code&amp;gt;VERSION&amp;lt;/code&amp;gt;; the reason is explained in [[#Troubleshooting|Troubleshooting]]. Don't skip them.&lt;br /&gt;
&lt;br /&gt;
=== Extract and configure ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm -rf &amp;quot;$TMP_BUILD_DIR/netcdf-cxx4-${NETCDF_CXX_VER}&amp;quot;&lt;br /&gt;
tar -xzf &amp;quot;$ARCHIVE_DIR/netcdf-cxx4-${NETCDF_CXX_VER}.tar.gz&amp;quot; -C &amp;quot;$TMP_BUILD_DIR&amp;quot;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-cxx4-${NETCDF_CXX_VER}&amp;quot;&lt;br /&gt;
find . -type f \( -name &amp;quot;version&amp;quot; -o -name &amp;quot;VERSION&amp;quot; \) -print -delete&lt;br /&gt;
export LIBS=&amp;quot;-lnetcdf -lhdf5_hl -lhdf5 -lz&amp;quot;&lt;br /&gt;
CXXFLAGS=&amp;quot;$CPPFLAGS&amp;quot; ./configure --prefix=&amp;quot;$PREFIX&amp;quot; --host=aarch64-apple-darwin --disable-filter-testing&lt;br /&gt;
rm -f VERSION&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Build ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-cxx4-${NETCDF_CXX_VER}&amp;quot;&lt;br /&gt;
make -j&amp;quot;$NUM_CORES&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' no &amp;lt;code&amp;gt;error:&amp;lt;/code&amp;gt; lines. If you see &amp;lt;code&amp;gt;./VERSION:1:1: error: expected unqualified-id&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;rm -f VERSION&amp;lt;/code&amp;gt; line was skipped: redo this step from &amp;quot;Extract and configure&amp;quot;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Test ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-cxx4-${NETCDF_CXX_VER}&amp;quot;&lt;br /&gt;
make check &amp;gt; check.log 2&amp;gt;&amp;amp;1&lt;br /&gt;
echo &amp;quot;PASS: $(grep -c '^PASS:' check.log)   FAIL: $(grep -c -E '^(FAIL|ERROR):' check.log)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' &amp;lt;code&amp;gt;PASS: 16   FAIL: 0&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Install ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;$TMP_BUILD_DIR/netcdf-cxx4-${NETCDF_CXX_VER}&amp;quot;&lt;br /&gt;
make install&lt;br /&gt;
unset LIBS&lt;br /&gt;
ls &amp;quot;$PREFIX/lib/libnetcdf_c++4.dylib&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:''' &amp;lt;code&amp;gt;/opt/parallel-netcdf/lib/libnetcdf_c++4.dylib&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Step 6 – Final check ==&lt;br /&gt;
&lt;br /&gt;
This confirms that the installed tools run without any special library path settings, and that no installed file depends on &amp;lt;code&amp;gt;@rpath&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
env -u DYLD_LIBRARY_PATH &amp;quot;$PREFIX/bin/h5dump&amp;quot; --version&lt;br /&gt;
env -u DYLD_LIBRARY_PATH &amp;quot;$PREFIX/bin/nc-config&amp;quot; --version&lt;br /&gt;
env -u DYLD_LIBRARY_PATH &amp;quot;$PREFIX/bin/nf-config&amp;quot; --has-nc4&lt;br /&gt;
env -u DYLD_LIBRARY_PATH &amp;quot;$PREFIX/bin/ncdump&amp;quot; 2&amp;gt;&amp;amp;1 | head -1&lt;br /&gt;
otool -L &amp;quot;$PREFIX&amp;quot;/lib/*.dylib &amp;quot;$PREFIX&amp;quot;/bin/* 2&amp;gt;/dev/null | grep -c '@rpath'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;border:1px solid #aaa; background:#f4f4f4; padding:0.5em;&amp;quot;&amp;gt;&lt;br /&gt;
'''Expected:'''&lt;br /&gt;
&amp;lt;code&amp;gt;h5dump: Version 2.2.0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;netCDF 4.10.1&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;yes&amp;lt;/code&amp;gt;, a line starting with &amp;lt;code&amp;gt;/opt/parallel-netcdf/bin/ncdump [-c|-h]&amp;lt;/code&amp;gt;, and finally &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The scratch build directory is no longer needed. To free the disk space:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
rm -rf &amp;quot;$TMP_BUILD_DIR&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shell profile ==&lt;br /&gt;
&lt;br /&gt;
Add these lines to your shell profile (&amp;lt;code&amp;gt;~/.bash_profile&amp;lt;/code&amp;gt; for bash, &amp;lt;code&amp;gt;~/.zshrc&amp;lt;/code&amp;gt; for zsh) so programs can find the tools:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
export PATH=&amp;quot;/opt/parallel-netcdf/bin:$PATH&amp;quot;&lt;br /&gt;
export OMPI_MCA_io=romio341&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;PATH&amp;lt;/code&amp;gt; is required.&lt;br /&gt;
* &amp;lt;code&amp;gt;OMPI_MCA_io&amp;lt;/code&amp;gt; is '''possibly required, but untested with model runs''': it avoids the Open MPI hang described below. It was needed for the HDF5 parallel tests to pass.&lt;br /&gt;
* &amp;lt;code&amp;gt;DYLD_LIBRARY_PATH&amp;lt;/code&amp;gt; is '''not''' needed: the libraries record their full install paths.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;curl: (22) The requested URL returned error: 404&amp;lt;/code&amp;gt;&lt;br /&gt;
: That version isn't hosted at the URL. Unidata only keeps recent versions (for example, NetCDF-C++ 4.2.1 is gone). Check the latest versions with &amp;lt;code&amp;gt;check_versions.sh&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;NetCDFlib&amp;lt;/code&amp;gt; directory, or on the GitHub release pages.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;configure: error: cannot run C compiled programs&amp;lt;/code&amp;gt;&lt;br /&gt;
: The &amp;lt;code&amp;gt;--host=aarch64-apple-darwin&amp;lt;/code&amp;gt; option is missing from the &amp;lt;code&amp;gt;./configure&amp;lt;/code&amp;gt; line. It makes configure skip a test-run of a compiled program that fails on macOS with the MPI compiler wrappers; the libraries are still built natively.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;dyld: Library not loaded: @rpath/libhdf5_hl.320.dylib&amp;lt;/code&amp;gt;&lt;br /&gt;
: HDF5 was installed without &amp;lt;code&amp;gt;-DCMAKE_INSTALL_NAME_DIR=&amp;quot;$PREFIX/lib&amp;quot;&amp;lt;/code&amp;gt;. Redo Step 2, then Steps 3–5 so they link against the corrected libraries. Setting &amp;lt;code&amp;gt;DYLD_LIBRARY_PATH&amp;lt;/code&amp;gt; is not a reliable fix: macOS removes it whenever a program is started via &amp;lt;code&amp;gt;/bin/sh&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;/bin/bash&amp;lt;/code&amp;gt; (as &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, job scripts and many &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt; setups do).&lt;br /&gt;
&lt;br /&gt;
; A parallel test or model run hangs after &amp;lt;code&amp;gt;mca_fbtl_posix_ipwritev: error in aio_write(): Resource temporarily unavailable&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;OMPI_MCA_io=romio341&amp;lt;/code&amp;gt; is not set. Open MPI's default I/O layer (OMPIO) issues more asynchronous writes than macOS allows per process, then waits forever. ROMIO avoids this. Set the variable (Step 0 and your shell profile), or run &amp;lt;code&amp;gt;mpirun --mca io romio341 …&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
; NetCDF-C++: &amp;lt;code&amp;gt;./VERSION:1:1: error: expected unqualified-id&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;expected external declaration&amp;lt;/code&amp;gt;)&lt;br /&gt;
: The standard C++ headers include a header called &amp;lt;code&amp;gt;&amp;amp;lt;version&amp;amp;gt;&amp;lt;/code&amp;gt;. On macOS the file system ignores case and the build searches the source directory for headers, so the compiler picks up the package's own &amp;lt;code&amp;gt;VERSION&amp;lt;/code&amp;gt; file instead. NetCDF-C++'s &amp;lt;code&amp;gt;configure&amp;lt;/code&amp;gt; creates that file, which is why Step 5 deletes it after configure. Never create &amp;lt;code&amp;gt;version&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;VERSION&amp;lt;/code&amp;gt; files in that tree.&lt;br /&gt;
&lt;br /&gt;
; NetCDF-C++: &amp;lt;code&amp;gt;Undefined symbols … _nc_set_log_level&amp;lt;/code&amp;gt;&lt;br /&gt;
: &amp;lt;code&amp;gt;--disable-filter-testing&amp;lt;/code&amp;gt; is missing from the configure line. Without it, an example program is built that needs a NetCDF-C function which only exists when NetCDF-C was built with logging enabled.&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;make check&amp;lt;/code&amp;gt; shows far fewer passes than expected&lt;br /&gt;
: &amp;lt;code&amp;gt;make check&amp;lt;/code&amp;gt; stops at the first directory with a failure, so the remaining tests never run. Look at the first &amp;lt;code&amp;gt;FAIL:&amp;lt;/code&amp;gt; line in &amp;lt;code&amp;gt;check.log&amp;lt;/code&amp;gt; and the matching &amp;lt;code&amp;gt;.log&amp;lt;/code&amp;gt; file next to that test.&lt;/div&gt;</description>
			<pubDate>Thu, 15 Oct 2026 16:45:05 GMT</pubDate>			<dc:creator>Mwolff</dc:creator>			<comments>http://lmdz-forge.lmd.jussieu.fr/mediawiki/Planets/index.php/Talk:NetCDF-Parallel_on_an_Apple_Silicon_Mac</comments>		</item>
	</channel>
</rss>