Anyone compiled ITK withTBB on Mac OSX x86

I made a pull request for condo-forge to build ITK v5.4rc02. There are some build errors related to TBB, and C++17. I believe 5.4 will be the first release with c++17 as the requirement.

In file included from $PREFIX/include/tbb/../oneapi/tbb/parallel_for.h:23:
$PREFIX/include/tbb/../oneapi/tbb/detail/_task.h:216:13: error: aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on macOS 10.13 or newer
    virtual ~task() = default;
            ^
$PREFIX/include/tbb/../oneapi/tbb/detail/_task_handle.h:49:5: note: in defaulted destructor for 'tbb::detail::d1::task' first required here
    task_handle_task(d1::wait_context& wo, d1::task_group_context& ctx, d1::small_object_allocator& alloc)
    ^
$PREFIX/include/tbb/../oneapi/tbb/detail/_task.h:216:13: note: if you supply your own aligned allocation functions, use -faligned-allocation to silence this diagnostic
    virtual ~task() = default;

And the compile command line:

$BUILD_PREFIX/bin/x86_64-apple-darwin13.4.0-clang++ -DITKCommon_EXPORTS -DTBB_DEPRECATED=0 -DTBB_USE_CAPTURED_EXCEPTION=0 -I$SRC_DIR/Modules/ThirdParty/DoubleConversion/src -I$SRC_DIR/build/Modules/ThirdParty/DoubleConversion/src/double-conversion -I$SRC_DIR/build/Modules/ThirdParty/Eigen3/src -I$SRC_DIR/build/Modules/ThirdParty/KWSys/src -I$SRC_DIR/Modules/ThirdParty/VNL/src/vxl/v3p/netlib -I$SRC_DIR/Modules/ThirdParty/VNL/src/vxl/vcl -I$SRC_DIR/Modules/ThirdParty/VNL/src/vxl/core -I$SRC_DIR/build/Modules/ThirdParty/VNL/src/vxl/v3p/netlib -I$SRC_DIR/build/Modules/ThirdParty/VNL/src/vxl/vcl -I$SRC_DIR/build/Modules/ThirdParty/VNL/src/vxl/core -I$SRC_DIR/build/Modules/Core/Common -I$SRC_DIR/Modules/Core/Common/include -I$SRC_DIR/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo -I$SRC_DIR/Modules/ThirdParty/VNL/src/vxl/core/vnl -I$SRC_DIR/build/Modules/ThirdParty/VNL/src/vxl/core/vnl -isystem $PREFIX/include/eigen3 -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem $PREFIX/include -fdebug-prefix-map=$SRC_DIR=/usr/local/src/conda/libitk-5.4rc02 -fdebug-prefix-map=$PREFIX=/usr/local/src/conda-prefix  -mtune=generic -march=corei7 -Wall -Wcast-align -Wdisabled-optimization -Wextra -Wformat=2 -Winvalid-pch -Wno-format-nonliteral -Wpointer-arith -Wshadow -Wunused -Wwrite-strings -Wno-strict-overflow -Wno-deprecated -Wno-invalid-offsetof -Wno-undefined-var-template -Woverloaded-virtual -Wctad-maybe-unsupported  -O3 -DNDEBUG -std=c++17 -isysroot /Applications/Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.9 -fPIC -MD -MT Modules/Core/Common/src/CMakeFiles/ITKCommon.dir/itkTBBMultiThreader.cxx.o -MF Modules/Core/Common/src/CMakeFiles/ITKCommon.dir/itkTBBMultiThreader.cxx.o.d -o Modules/Core/Common/src/CMakeFiles/ITKCommon.dir/itkTBBMultiThreader.cxx.o -c $SRC_DIR/Modules/Core/Common/src/itkTBBMultiThreader.cxx

Looks like conda is requiring support of an earlier version of macOS than was ITK is requiring. From looking at the compile error, requiring macOS 10.13 seems bit aggressive for support. 10.12 I think is reasonable and should be doable. The version of TBB probably just needs to be walked back a bit and then you should be able to compile.

Although looking at the linked Azure run TBB 2021.11 is being used which is probably pretty reasonable. We use TBB 2021.4 for our own app through vcpkg. Would be interesting to see if I can reproduce as we set macOS 11.0 as our minimum requirement.

1 Like

@matt.mccormick In the ITK5.4RC it has:

  • TBB version updated to latest stable version, disabled on Intel macOS

Do you have any information on why TBB was disable on Mac intel here? Might it be related to the issues encounter on conda-forge here?

From this I gather that MacOS Intel just would not have multi-threaded algorithms?

Or does this completely remove the ability to compile ITK 5.4RC on intel MacOS systems?

No, ITK on Mac will still have threaded algorithms. ITK has 3 potential threading implementations.

I am not sure where it’s clearly documented in ITK, but in. SimpleITK it is clearly here:
https://simpleitk.org/doxygen/latest/html/classitk_1_1simple_1_1ProcessObject.html#a709f1c6f88d214826f2e864aff85abd4

The default threader is a compile time option, it would be TBB if it is enabled by default. In the above condo-forge recipe it’s set to “POOL” for consistency.

2 Likes

I ran into TBB build errors with macOS Intel for the ITK Python packages. Since there is already a reasonably performant C++11 thread pool, I disabled it for the builds.

1 Like