Skip to content

Commit a598982

Browse files
markasselindzenanz
authored andcommitted
COMP: Fix Slicer vtkITK build on macOS
This commit addresses a Slicer macOS build error reported on Discourse (see https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940) and on GitHub (see comments on issue #5944). The _POSIX_SOURCE preprocessor identifier is defined in several places including by Python and several ITK ThirdParty modules. It looks like this definition is causing unintended side effects when building vtkITK. When itkMacro.h is #included in vtkITK, _POSIX_SOURCE causes conditional inclusion of code using __assert_fail and __ASSERT_FUNCTION, which are defined by GLIBC. Compiling under Clang on macOS this results in a compile error. This commit fixes the error by checking for the __GLIBC__ preprocessor identifier instead of __POSIX_SOURCE.
1 parent 8273f8b commit a598982

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/Core/Common/include/itkMacro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ compilers.
776776

777777
#ifndef NDEBUG
778778

779-
# ifdef _POSIX_SOURCE
779+
# ifdef __GLIBC__
780780
# define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail(msg, __FILE__, __LINE__, __ASSERT_FUNCTION);
781781
# else
782782
# define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);

0 commit comments

Comments
 (0)