Compilation fails on macOS Sonoma with homebrew gcc-13.2

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:

/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.

Which version of VTK? master ?

FYI @seanm @dgobbi

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.

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?

This should be something like:

#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.

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).