# Compilation fails on macOS Sonoma with homebrew gcc-13.2

**URL:** https://discourse.vtk.org/t/compilation-fails-on-macos-sonoma-with-homebrew-gcc-13-2/12571
**Category:** Support
**Created:** [October 30, 2023, 11:29am UTC](https://discourse.vtk.org/t/compilation-fails-on-macos-sonoma-with-homebrew-gcc-13-2/12571 "2023-10-30T11:29:25Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![abhinavsns](https://discourse.vtk.org/user_avatar/discourse.vtk.org/abhinavsns/32/7909_2.png) [@abhinavsns](https://discourse.vtk.org/u/abhinavsns)
#### Post date: [October 30, 2023, 11:29am UTC](https://discourse.vtk.org/t/compilation-fails-on-macos-sonoma-with-homebrew-gcc-13-2/12571/1 "2023-10-30T11:29:25Z")

</div>

Hello,

I am trying to compile Paraview with gcc 13.2.0 (homebrew gcc), OpenMPI 4.1.1 on macOS Sonoma and VTK compilation is failing with the following error message:

```auto
/paraview/VTK/Rendering/UI/vtkCocoaMacOSXSDKCompatibility.h:71:20: error: missing binary operator before token "("
   71 | #elif __has_feature(objc_arc)
      | ^
/Users/absingh/git/paraview/VTK/Rendering/UI/vtkCocoaMacOSXSDKCompatibility.h:81:18: error: missing binary operator before token "("
   81 | #if __has_feature(objc_arc)
      | ^

```

Any advice would be helpful.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [October 30, 2023, 12:10pm UTC](https://discourse.vtk.org/t/compilation-fails-on-macos-sonoma-with-homebrew-gcc-13-2/12571/2 "2023-10-30T12:10:39Z")

</div>

Which version of VTK? master ?

FYI @seanm @dgobbi

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [October 30, 2023, 12:48pm UTC](https://discourse.vtk.org/t/compilation-fails-on-macos-sonoma-with-homebrew-gcc-13-2/12571/3 "2023-10-30T12:48:15Z")

</div>

The `__has_feature()` builtin is clang-only, it doesn’t exist on gcc.

I haven’t heard of anyone trying to build VTK on macOS with gcc recently, you might have to do a lot changes to the code to make it work. Both gcc and clang are free compilers, but clang gets a lot of support from Apple, while gcc does not.

---

<div class="post-metadata">

### Author: ![abhinavsns](https://discourse.vtk.org/user_avatar/discourse.vtk.org/abhinavsns/32/7909_2.png) [@abhinavsns](https://discourse.vtk.org/u/abhinavsns)
#### Post date: [October 30, 2023, 12:54pm UTC](https://discourse.vtk.org/t/compilation-fails-on-macos-sonoma-with-homebrew-gcc-13-2/12571/4 "2023-10-30T12:54:49Z")

</div>

Thank you so much for the fast response!  
In general my projects also use gfortran (for standard linear algebra libraries). As an aside, I would like to ask if there are issues if clang is used along side gfortran and if extra care should be taken in general?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [October 30, 2023, 12:55pm UTC](https://discourse.vtk.org/t/compilation-fails-on-macos-sonoma-with-homebrew-gcc-13-2/12571/5 "2023-10-30T12:55:04Z")

</div>

This should be something like:

```auto
#elif __has_builtin(__has_feature)
#if __has_feature(objc_arc)
#endif
#else

```

because GCC _recognizes_ `__has_feature` as special, but not all modes “understand” it properly. Since it’s a parser-like thing, it cannot be guarded with a `&&` short-circuit.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [October 30, 2023, 12:55pm UTC](https://discourse.vtk.org/t/compilation-fails-on-macos-sonoma-with-homebrew-gcc-13-2/12571/6 "2023-10-30T12:55:41Z")

</div>

> [@abhinavsns](#):
>
> In general my projects also use gfortran (for standard linear algebra libraries). As an aside, I would like to ask if there are issues if clang is used along side gfortran and if extra care should be taken in general?

No, there’s no issue AFAIK. We do this for the ParaView binaries (where Fortran is used to compile NumPy, SciPy, and a few other projects).
