Compilation Error M1 MacBook Pro

I started having problems with Stan models after I updated to macOS 12.1 Monterey.
I’m using r , and start seeing error messages, that I’ve never seen before:

Error in compileCode(f, code, language = language, verbose = verbose) : 
          typedef double local_scalar_t__;                       ^28 warnings generated.error: unknown target CPU 'vortex'note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, geodemake: *** [file5aee482c3432.o] Error 1

I see this error whether I’m trying to compile a model with rstan, or with brms. Same thing.

Apart from the aforementioned system update I can’t think of any other drastic changes to the system.

I tried a clean r/RStudio install – same thing.

My clang version is:

➜  ~ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: arm64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Does anyone have an idea what’s going on? Thank you.

Solved. Removed Xcode, and reinstalled command line tools. Now clang version is 12.0.5, and models compile normally. So, apparently Stan didn’t like clang 13.0.0.

Which version of Command line tools did you install to get clang version 12.0.5?

On MacOS 12.1, I seem to be only getting command line tools with clang 13.0.0, which fails with

error: unknown target CPU 'vortex'
note: valid target CPU values are: i386, i486, winchip-c6, winchip2, c3, i586, pentium, pentium-mmx, pentiumpro, i686, pentium2, pentium3, pentium3m, pentium-m, c3-2, yonah, pentium4, pentium4m, prescott, nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, sapphirerapids, alderlake, knl, knm, lakemont, k6, k6-2, k6-3, athlon, athlon-tbird, athlon-xp, athlon-mp, athlon-4, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, x86-64, geode
make: *** [Module.o] Error 1

Hmmm, I just removed Xcode and did xcode-select --install

➜  ~ xcode-select --version
xcode-select version 2392.
➜  ~ clang --version
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: arm64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Thanks! Which version of MacOS are you on at the moment?

Monterey 12.1 (21C52)