Compilation issue including ITK with brew on MacOS

Hi ITK teams,
We get an issue once using ITK (5.2.1) through brew and macOs and obtain this type of error related to cmath use:
Applications/Xcode_13.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/usr/include/c++/v1/cmath:321:9: error: no member named ‘signbit’ in the global namespace

See more details here from githubaction compilation issue: work space · kerautret/ITKtestBrewGithubActions@8413eeb · GitHub

It looks related to the use of ITK since not using it and using cmath.h does not provides any errors:

Did you have an idea of fix ? (without switching of MacOS SDK that is not always possible).

HI @Ber, not a MacOS user here, but isn’t this related to homebrew? Maybe a missmatch between the SDK used by homebrew and yours? Not sure.

For reference, links to formula in homebrew and their std_cmake_args handling SDK:

Hi Pablo!
Thanks for your suggestions. Yes probably since when using the command line tools SDK it compiles, I tried to edit the formula and adding an cmake option: -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
but I get compilations errors on itkv3p_netlib (while it works from full manual installation from source from default).

A possible workaround to successfully compile without using Xcode-select is just to add an cmake option: set(CMAKE_OSX_SYSROOT “/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk”)
That looks to be fine and do not change the user global config:

1 Like

I get also some fiftw used by ITK when using CMAKE_OSX_SYSROOT option: