# Slicer build on macOS Monterey

**URL:** <https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940>\
**Category:** Support\
**Tags:** build\
**Created:** [February 12, 2022, 6:41pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940 "2022-02-12T18:41:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![priya.vada4](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@priya.vada4](https://discourse.slicer.org/u/priya.vada4)\
**Post date:** [February 12, 2022, 6:41pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/1 "2022-02-12T18:41:27Z")

</div>

Has anyone built Slicer and Qt 5.15.2 on macOS Monterey with Xcode 13.2. I seem to be running into a lot of issues with building Qt5.15.2 from source (including JCFR’s easy script). I also tried to build Slicer with the Qt binaries but after building the code, I get a lot of errors related to link libraries. One example of the error is shown below:

Error(s):  
Cannot load library /S4-new2/S-s/Slicer-build/lib/Slicer-4.13/qt-loadable-modules/libqSlicerDataModule.dylib: (dlopen(/S4-new2/S-s/Slicer-build/lib/Slicer-4.13/qt-loadable-modules/libqSlicerDataModule.dylib, 0x0085): Symbol not found: \_\_ZN6vtksys18SystemToolsManagerC1Ev  
Referenced from: /S4-new2/S-s/Slicer-build/lib/Slicer-4.13/qt-loadable-modules/libqSlicerDataModule.dylib  
Expected in: /S4-new2/S-s/Slicer-build/lib/Slicer-4.13/qt-loadable-modules/libvtkSlicerDataModuleLogic.dylib)

Any idea how this could be resolved?

Priya

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [February 12, 2022, 6:59pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/2 "2022-02-12T18:59:17Z")

</div>

I’ve built on Monterey (12.1) with Qt 5.15.2 and Xcode 13.2.1, though not for a couple of weeks. Not sure what those link errors are, sorry, but that configuration should work.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 12, 2022, 7:04pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/3 "2022-02-12T19:04:03Z")

</div>

I typically use Qt from homebrew on mac with no problem, but I haven’t built from scratch in a while.

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [February 12, 2022, 7:08pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/4 "2022-02-12T19:08:16Z")

</div>

Same for me (Qt from homebrew).

---

<div class="post-metadata">

**Author:** ![priya.vada4](https://avatars.discourse-cdn.com/v4/letter/p/d26b3c/32.png) [@priya.vada4](https://discourse.slicer.org/u/priya.vada4)\
**Post date:** [February 12, 2022, 7:19pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/5 "2022-02-12T19:19:38Z")

</div>

Thanks Steve and Hollister. I am trying to create a Slicer package for a collaborator with a custom module, therefore trying to build Qt from source.

Priya

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [February 12, 2022, 8:27pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/6 "2022-02-12T20:27:57Z")

</div>

I just configured with this `cmake` line:

```
cmake -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15 -DCMAKE_BUILD_TYPE:STRING=Debug -DQt5_DIR:PATH=/usr/local/Cellar/qt/5.15.2/lib/cmake/Qt5 ../Slicer

```

and it’s building now. Should work, I’ll let you know if it doesn’t.

Even if you’re making a custom module, why do you need to build Qt from source?

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [February 12, 2022, 9:25pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/7 "2022-02-12T21:25:31Z")

</div>

So this is kinda odd. I now get:

```auto
[15%] Building CXX object Libs/vtkITK/CMakeFiles/vtkITKPython.dir/vtkITKGradientAnisotropicDiffusionImageFilterPython.cxx.o
In file included from /opt/SB/debug/Slicer-build/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilterPython.cxx:10:
In file included from /opt/SB/Slicer/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilter.h:18:
In file included from /opt/SB/Slicer/Libs/vtkITK/vtkITKImageToImageFilterFF.h:21:
In file included from /opt/SB/debug/ITK/Modules/Bridge/VTK/include/itkVTKImageExport.h:143:
In file included from /opt/SB/debug/ITK/Modules/Bridge/VTK/include/itkVTKImageExport.hxx:27:
In file included from /opt/SB/debug/ITK/Modules/Core/Common/include/itkNumericTraitsDiffusionTensor3DPixel.h:22:
In file included from /opt/SB/debug/ITK/Modules/Core/Common/include/itkDiffusionTensor3D.h:26:
In file included from /opt/SB/debug/ITK/Modules/Core/Common/include/itkSymmetricSecondRankTensor.h:29:
/opt/SB/debug/ITK/Modules/Core/Common/include/itkSymmetricEigenAnalysis.h:156:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
In file included from /opt/SB/debug/Slicer-build/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilterPython.cxx:10:
In file included from /opt/SB/Slicer/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilter.h:19:
In file included from /opt/SB/debug/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkGradientAnisotropicDiffusionImageFilter.h:21:
In file included from /opt/SB/debug/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionImageFilter.h:21:
In file included from /opt/SB/debug/ITK/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.h:21:
In file included from /opt/SB/debug/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceImageFilter.h:21:
In file included from /opt/SB/debug/ITK/Modules/Core/Common/include/itkInPlaceImageFilter.h:189:
/opt/SB/debug/ITK/Modules/Core/Common/include/itkInPlaceImageFilter.hxx:97:5: error: use of undeclared identifier '__ASSERT_FUNCTION'
    itkAssertOrThrowMacro(inputAsOutput.IsNotNull(), "Unable to convert input image to output image as expected!");

```

Looks like \_\_ASSERT\_FUNCTION is from assert.h? Am I misreading this?

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [February 15, 2022, 4:32pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/8 "2022-02-15T16:32:40Z")

</div>

Hey @pieper Steve, have you seen this ITK problem on a Mac? (or anybody else)?

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [February 16, 2022, 8:18pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/9 "2022-02-16T20:18:57Z")

</div>

I am experiencing the same issues when starting Slicer.

cmake configuration below:

```auto

   cmake ../../sources/cpp/Slicer/ \
    -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=12.1 \
    -DQt5_DIR:PATH=/Users/herzc/Qt/5.15.2/clang_64/lib/cmake/Qt5 \
    -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 \
    -DSlicer_USE_SYSTEM_OpenSSL:BOOL=ON \
    -DSlicer_USE_SimpleITK:BOOL=OFF

```

Getting errors like this:

```auto
dlopen(/Users/herzc/D/S4D/Slicer-build/lib/Slicer-4.13/qt-loadable-modules/qSlicerVolumeRenderingModuleWidgetsPythonQt.so, 0x0001): Symbol not found: __ZSt9terminatev
  Referenced from: /Users/herzc/D/S4D/Slicer-build/lib/Slicer-4.13/qt-loadable-modules/qSlicerVolumeRenderingModuleWidgetsPythonQt.so
  Expected in: /Users/herzc/D/S4D/ITK-build/lib/libITKDiffusionTensorImage-5.2.1.dylib
dlopen(/Users/herzc/D/S4D/Slicer-build/lib/Slicer-4.13/qt-loadable-modules/qSlicerDICOMLibModuleWidgetsPythonQt.so, 0x0001): Symbol not found: __ZSt9terminatev
  Referenced from: /Users/herzc/D/S4D/Slicer-build/lib/Slicer-4.13/qt-loadable-modules/qSlicerDICOMLibModuleWidgetsPythonQt.so
  Expected in: /Users/herzc/D/S4D/ITK-build/lib/libitklbfgs-5.2.1.dylib
dlopen(/Users/herzc/D/S4D/Slicer-build/lib/Slicer-4.13/qt-loadable-modules/qSlicerTablesModuleWidgetsPythonQt.so, 0x0001): Symbol not found: __ZSt9terminatev
  Referenced from: /Users/herzc/D/S4D/Slicer-build/lib/Slicer-4.13/qt-loadable-modules/qSlicerTablesModuleWidgetsPythonQt.so
  Expected in: /Users/herzc/D/S4D/ITK-build/lib/libITKOptimizersv4-5.2.1.dylib

```

I am using Qt from the online installer but can also try again with the one installed from brew (but Qt designer doesn’t work with that one)

I will try again with the cmake configuration from here: [Slicer build on macOS Monterey - #6 by hherhold](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/6)

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [February 16, 2022, 8:21pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/10 "2022-02-16T20:21:30Z")

</div>

Something relatively recent changed; I can build a fork from late January but the latest master fails.

The build machine looks okay though, I wonder if it’s a Monterey thing with some recent update?

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [February 16, 2022, 8:22pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/11 "2022-02-16T20:22:32Z")

</div>

Building an early Jan version works, but I am still getting the same errors when starting Slicer.

I will try with your configuration.

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [February 16, 2022, 8:26pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/12 "2022-02-16T20:26:44Z")

</div>

I looked through the 85 or so commits between the branch I have from late January (I said fork before, sorry, meant branch) and master from today, but nothing was obvious. I might try a binary search and see what broke things, I’ll let you know if I get to this.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [February 16, 2022, 8:39pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/13 "2022-02-16T20:39:04Z")

</div>

Thanks - let us know what you find. I haven’t had a chance to try building since my mac (and my brain) are tied up with some other projects.

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [February 17, 2022, 2:35am UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/14 "2022-02-17T02:35:33Z")

</div>

It looks like it was this one (below). The errors I get are the ones above, and included below for completeness.

> <https://github.com/Slicer/Slicer/commit/416a492f0a87c88e32c064afe877c759ff18681d>
>
> Summary:
> \- Add support for building CPython 3.7.x, 3.8.x and 3.9.x
> \- cmake: Upda…te minimum required version from 2.8.4 to 3.13.5
> \- 3.6.x: Add support for building asyncio module
> \- Deprecate SQLITE3\_INCLUDE\_PATH/SQLITE3\_LIBRARY variables and prefer
> SQLite3\_INCLUDE\_DIR/SQLite3\_LIBRARY.
> 
> List of python changes:
> 
> $ git shortlog dca8bee81..1feb43e4b --no-merges
> Andras Lasso (1):
> Remove irrelevant comment
> 
> Dan Dees (3):
> cmake: Python 3.5.10 requires PY3\_DLLNAME definition
> cmake: Display external libraries information
> 3.7.x: Add USE\_SYSTEM\_FFI option
> 
> David Brooks (2):
> Add checksums for Python 3.5.6 to 3.5.10, 3.6.8 to 3.6.15. Set default to 3.6.15
> 3.6.x: Add support for building asyncio module
> 
> Fernando Bordignon (6):
> circleci/linux: Expect tests to run in less than 360s
> circleci/linux: Install dependencies to build & test more extensions
> circleci/win: Update config to include windows build using VS2019
> 3.7.x: Update approach for using release OpenSSL in debug CPython
> cmake: Fix list of requirements associated with \_bsddb module
> 3.6.x: Add support for building \_testconsole module
> 
> James Butler (4):
> cmake: Add checksums for Python 3.8.7 to 3.8.12
> cmake: Add checksum for Python 3.9.10
> ci: Test latest patch release versions
> cmake: Update default version to 3.9.10
> 
> Jean-Christophe Fillion-Robin (49):
> PythonApplyPatches: Refactor logic applying patch to Python 2.7.11 and 2.7.12
> lzma: Fix Python 2.7 build excluding lzma extension introduced in Python 3.3
> ci/appveyor: Explicitly specify GENERATOR and PLATFORM
> ci/appveyor: Remove testing of 2.7.3 to 2.7.14
> ci/appveyor: Update 3.6.5 to 3.6.7, 2.7.14 to 2.7.15, Remove 3.5.5
> ci: Add CircleCI 2.0 configuration
> ci: Remove obsolete Circle 1.0 configuration
> circleci/linux: Update python 2.7.14 -\> 2.7.15, 3.6.4 -\> 3.6.7, remove 3.5.5
> cmake: Update add\_python\_extension to support NEVER\_BUILTIN option
> cmake: Append "-static" to fix executable linking when WITH\_STATIC\_DEPENDENCIES is ON
> cmake: Fix undefined reference to gss\_\* symbols when WITH\_STATIC\_DEPENDENCIES is ON
> cmake: Update minimum required version from 2.8.4 to 3.13.5
> cmake: Remove unused custom CMake module for detecting CMake features
> cmake/Extensions: Simplify removing workaround specific to CMake \< 2.8.8
> cmake: Fix undefined reference to gss\_\* symbols when libkrb5-dev package not installed
> PythonExtractVersionInfo: Support extracting version from patchlevel for alpha/beta/rc releases
> style: Simplify comparison using VERSION\_GREATER\_EQUAL if syntax
> audioop, \_ctypes\_test: Add missing libm dependency
> 3.6.x: Update pyconfig.h.in and add missing configure checks
> ci: Remove obsolete travis configuration
> Add support for building Python 3.7.x
> Add checksums for 3.7.8 to 3.7.12, update CI and set default to 3.7.12
> PythonAutoDetectOSX: Fix query of SDK path converting SDK version into a two-component string
> ci: Add GitHub Actions config for building & testing on macOS
> cmake/config-unix/pyconfig.h.in: Consistently specify #cmakedefine
> cmake/config-unix/pyconfig.h.in: Ensure HAVE\_GLIBC\_MEMMOVE\_BUG is defined
> circleci: Fix download of dashboard scripts using "git@" protocol
> cmake: Find SQLite3 using module provided by CMake
> cmake/config-unix/pyconfig.h.in: Consistently specify #cmakedefine
> Add support for building Python 3.8.x
> Add support for building Python 3.9.x
> cmake: Add tests at configure time based on files matching "test/test\_\*.py"
> 3.6.x: Fix test\_regrtest installing Tools/scripts/run\_tests.py
> 3.8.x: Fix test\_fcntl on macOS ensuring \_posixshmem module is built
> 3.7.x: Fix incorrect PYTHONFRAMEWORK value returned by sysconfig.get\_config\_var
> ci/appveyor: Speed up CI removing Python 3.x jobs
> README: Update default version from 3.8.5 to 3.9.9
> cmake: Add checksums for Python 3.9.0 to 3.9.7
> PythonApplyPatches: Remove duplicated set of patches
> cmake/patches-win32: Remove obsolete patches related to VS2008 Express and VS2010
> cmake/patches-win32: Manage MinGW 2.7.x patches using PythonApplyPatches module
> README: Remove "Remarks" subsection and add new entry to FAQ
> README: Improve readability of overview section adding blank lines
> README: Update windows build instruction using VS2019 generator
> \_testconsole: Fix link error when attempting to build extension as builtin on Linux
> cmake: Prevent some of 3.x built-in extensions from being registered twice
> datetime, time: Fix build conditionally including \_time.c or timemodule.c
> cmake: Remove duplicated sources between libpython and extensions
> cmake: Mark relevant modules as ALWAYS\_BUILTIN
> 
> Kai Hainke (1):
> PythonApplyPatches: Patch 2.7.\[11|12\] to support VS2015
> 
> Marcel Metz (1):
> cmake: Update extension BUILTIN to match CPython autoconf defaults
> 
> Minmin Gong (2):
> cmake: Skip CMP0045 on CMake \>= 3.0.1
> cmake/extensions: Call set\_target\_properties only for enabled extensions
> 
> Walter Oggioni (1):
> Fix install specifying DESTDIR env. var
> 
> Co-authored-by: Fernando Bordignon \<fernando@ltrace.com.br\>

And the build error:

```auto
[15%] Built target vtkITK
[15%] Building CXX object Libs/vtkITK/CMakeFiles/vtkITKPython.dir/vtkITKGradientAnisotropicDiffusionImageFilterPython.cxx.o
In file included from /opt/SB/build-test/Slicer-build/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilterPython.cxx:10:
In file included from /opt/SB/Slicer/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilter.h:18:
In file included from /opt/SB/Slicer/Libs/vtkITK/vtkITKImageToImageFilterFF.h:21:
In file included from /opt/SB/build-test/ITK/Modules/Bridge/VTK/include/itkVTKImageExport.h:143:
In file included from /opt/SB/build-test/ITK/Modules/Bridge/VTK/include/itkVTKImageExport.hxx:27:
In file included from /opt/SB/build-test/ITK/Modules/Core/Common/include/itkNumericTraitsDiffusionTensor3DPixel.h:22:
In file included from /opt/SB/build-test/ITK/Modules/Core/Common/include/itkDiffusionTensor3D.h:26:
In file included from /opt/SB/build-test/ITK/Modules/Core/Common/include/itkSymmetricSecondRankTensor.h:29:
/opt/SB/build-test/ITK/Modules/Core/Common/include/itkSymmetricEigenAnalysis.h:156:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
In file included from /opt/SB/build-test/Slicer-build/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilterPython.cxx:10:
In file included from /opt/SB/Slicer/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilter.h:19:
In file included from /opt/SB/build-test/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkGradientAnisotropicDiffusionImageFilter.h:21:
In file included from /opt/SB/build-test/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionImageFilter.h:21:
In file included from /opt/SB/build-test/ITK/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.h:21:
In file included from /opt/SB/build-test/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceImageFilter.h:21:
In file included from /opt/SB/build-test/ITK/Modules/Core/Common/include/itkInPlaceImageFilter.h:189:
/opt/SB/build-test/ITK/Modules/Core/Common/include/itkInPlaceImageFilter.hxx:97:5: error: use of undeclared identifier '__ASSERT_FUNCTION'
    itkAssertOrThrowMacro(inputAsOutput.IsNotNull(), "Unable to convert input image to output image as expected!");
    ^
/opt/SB/build-test/ITK/Modules/Core/Common/include/itkMacro.h:754:5: note: expanded from macro 'itkAssertOrThrowMacro'
    itkAssertInDebugOrThrowInReleaseMacro(msgstr.str().c_str()); \
    ^
/opt/SB/build-test/ITK/Modules/Core/Common/include/itkMacro.h:740:95: note: expanded from macro 'itkAssertInDebugOrThrowInReleaseMacro'
# define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail(msg,__FILE __,__ LINE __,__ ASSERT_FUNCTION);
                                                                                              ^
In file included from /opt/SB/build-test/Slicer-build/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilterPython.cxx:10:
In file included from /opt/SB/Slicer/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilter.h:19:
In file included from /opt/SB/build-test/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkGradientAnisotropicDiffusionImageFilter.h:21:
In file included from /opt/SB/build-test/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionImageFilter.h:21:
In file included from /opt/SB/build-test/ITK/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.h:21:
In file included from /opt/SB/build-test/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceImageFilter.h:380:
In file included from /opt/SB/build-test/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceImageFilter.hxx:21:
In file included from /opt/SB/build-test/ITK/Modules/Core/Common/include/itkImageRegionIterator.h:21:
In file included from /opt/SB/build-test/ITK/Modules/Core/Common/include/itkImageRegionConstIterator.h:21:
In file included from /opt/SB/build-test/ITK/Modules/Core/Common/include/itkImageIterator.h:21:
/opt/SB/build-test/ITK/Modules/Core/Common/include/itkImageConstIterator.h:210:7: error: use of undeclared identifier '__ASSERT_FUNCTION'
      itkAssertOrThrowMacro((bufferedRegion.IsInside(m_Region)),
      ^
/opt/SB/build-test/ITK/Modules/Core/Common/include/itkMacro.h:754:5: note: expanded from macro 'itkAssertOrThrowMacro'
    itkAssertInDebugOrThrowInReleaseMacro(msgstr.str().c_str()); \
    ^
/opt/SB/build-test/ITK/Modules/Core/Common/include/itkMacro.h:740:95: note: expanded from macro 'itkAssertInDebugOrThrowInReleaseMacro'
# define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail(msg,__FILE __,__ LINE __,__ ASSERT_FUNCTION);
                                                                                              ^
1 warning and 2 errors generated.
make[5]: *** [Libs/vtkITK/CMakeFiles/vtkITKPython.dir/vtkITKGradientAnisotropicDiffusionImageFilterPython.cxx.o] Error 1
make[4]: *** [Libs/vtkITK/CMakeFiles/vtkITKPython.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [Slicer-prefix/src/Slicer-stamp/Slicer-build] Error 2
make[1]: *** [CMakeFiles/Slicer.dir/all] Error 2
make: *** [all] Error 2

```

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [February 17, 2022, 2:36am UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/15 "2022-02-17T02:36:36Z")

</div>

Also, why the nightly builds aren’t broken, I have no idea. My guess is that machine isn’t running Monterey? I’m running 12.1 right now.

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [February 24, 2022, 2:34pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/16 "2022-02-24T14:34:51Z")

</div>

Hi Steve @pieper ,

I saw the change to ITK in the most recent commit but I still get this error, the failing target is vtkITKPython. Any ideas?

Thanks!

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [April 6, 2022, 8:25pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/17 "2022-04-06T20:25:03Z")

</div>

I tried compiling again and getting the same errors:

```auto
In file included from /Users/herzc/D/S4DD/ITK/Modules/Core/Common/include/itkInPlaceImageFilter.h:189:
/Users/herzc/D/S4DD/ITK/Modules/Core/Common/include/itkInPlaceImageFilter.hxx:93:5: error: use of undeclared identifier '__ASSERT_FUNCTION'
    itkAssertOrThrowMacro(inputAsOutput.IsNotNull(), "Unable to convert input image to output image as expected!");
    ^
/Users/herzc/D/S4DD/ITK/Modules/Core/Common/include/itkMacro.h:794:5: note: expanded from macro 'itkAssertOrThrowMacro'
    itkAssertInDebugOrThrowInReleaseMacro(msgstr.str().c_str()); \
    ^
/Users/herzc/D/S4DD/ITK/Modules/Core/Common/include/itkMacro.h:780:95: note: expanded from macro 'itkAssertInDebugOrThrowInReleaseMacro'
# define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail(msg,__FILE __,__ LINE __,__ ASSERT_FUNCTION);
                                                                                              ^
In file included from /Users/herzc/D/S4DD/Slicer-build/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilterPython.cxx:10:
In file included from /Users/herzc/sources/cpp/Slicer/Libs/vtkITK/vtkITKGradientAnisotropicDiffusionImageFilter.h:19:
In file included from /Users/herzc/D/S4DD/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkGradientAnisotropicDiffusionImageFilter.h:21:
In file included from /Users/herzc/D/S4DD/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionImageFilter.h:21:
In file included from /Users/herzc/D/S4DD/ITK/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.h:21:
In file included from /Users/herzc/D/S4DD/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceImageFilter.h:380:
In file included from /Users/herzc/D/S4DD/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceImageFilter.hxx:21:
In file included from /Users/herzc/D/S4DD/ITK/Modules/Core/Common/include/itkImageRegionIterator.h:21:
In file included from /Users/herzc/D/S4DD/ITK/Modules/Core/Common/include/itkImageRegionConstIterator.h:21:
In file included from /Users/herzc/D/S4DD/ITK/Modules/Core/Common/include/itkImageIterator.h:21:
/Users/herzc/D/S4DD/ITK/Modules/Core/Common/include/itkImageConstIterator.h:210:7: error: use of undeclared identifier '__ASSERT_FUNCTION'
      itkAssertOrThrowMacro((bufferedRegion.IsInside(m_Region)),
      ^
/Users/herzc/D/S4DD/ITK/Modules/Core/Common/include/itkMacro.h:794:5: note: expanded from macro 'itkAssertOrThrowMacro'
    itkAssertInDebugOrThrowInReleaseMacro(msgstr.str().c_str()); \
    ^
/Users/herzc/D/S4DD/ITK/Modules/Core/Common/include/itkMacro.h:780:95: note: expanded from macro 'itkAssertInDebugOrThrowInReleaseMacro'
# define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail(msg,__FILE __,__ LINE __,__ ASSERT_FUNCTION);
                                                                                              ^
1 warning generated.
1 warning and 2 errors generated.
make[5]: *** [Libs/vtkITK/CMakeFiles/vtkITKPython.dir/vtkITKGradientAnisotropicDiffusionImageFilterPython.cxx.o] Error 1
make[4]: *** [Libs/vtkITK/CMakeFiles/vtkITKPython.dir/all] Error 2

```

So far only reverting changes to early 2022 worked for me.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [April 6, 2022, 8:54pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/18 "2022-04-06T20:54:15Z")

</div>

Not a conflicting assert header in your path? re [c++ - Message "error: use of undeclared identifier 'assert'" - Stack Overflow](https://stackoverflow.com/a/64184500)

---

<div class="post-metadata">

**Author:** ![markasselin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/markasselin/32/5916_2.png) [@markasselin](https://discourse.slicer.org/u/markasselin)\
**Post date:** [April 10, 2022, 1:52pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/19 "2022-04-10T13:52:18Z")

</div>

@hherhold @che85

I’ve experienced the same issue on Monterey. I dug a little deeper, and it looks like the root cause is the preprocessor identifier \_POSIX\_SOURCE being defined during compile of vtkITK.This causes itkMacro.h file to conditionally include code which depends on Linux specific details of assert.h.

I sent a [PR](https://github.com/Slicer/ITK/pull/6) which uses the more granular \_\_linux preprocessor identifier for this conditional to Slicer/ITK and once approved will duplicate this to the main ITK repository.

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [April 10, 2022, 11:04pm UTC](https://discourse.slicer.org/t/slicer-build-on-macos-monterey/21940/20 "2022-04-10T23:04:41Z")

</div>

Good catch! This appears to work on my machine as well - vtkITKPython target was the one failing, and it just finished. Rest of the build proceeding.

Nicely done!
