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)
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.
[ 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?
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.
It looks like it was this one (below). The errors I get are the ones above, and included below for completeness.
And the build error:
[ 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
I tried compiling again and getting the same errors:
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.
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 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.