# Anyone compiled ITK withTBB on Mac OSX x86

**URL:** https://discourse.itk.org/t/anyone-compiled-itk-withtbb-on-mac-osx-x86/6525
**Category:** Uncategorized
**Created:** [March 18, 2024, 7:12pm UTC](https://discourse.itk.org/t/anyone-compiled-itk-withtbb-on-mac-osx-x86/6525 "2024-03-18T19:12:31Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [March 18, 2024, 7:12pm UTC](https://discourse.itk.org/t/anyone-compiled-itk-withtbb-on-mac-osx-x86/6525/1 "2024-03-18T19:12:31Z")

</div>

I made a pull request for condo-forge to build ITK v5.4rc02. There are some [build errors](https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=889575&view=logs&j=5919e0e2-8634-58c1-7e2d-cc5398f52f3f&t=f395cd69-c266-53d9-bd41-0b417b09501f) related to TBB, and C++17. I believe 5.4 will be the first release with c++17 as the requirement.

```auto
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:

```auto
$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

```

---

<div class="post-metadata">

### Author: ![imikejackson](https://discourse.itk.org/user_avatar/discourse.itk.org/imikejackson/32/35_2.png) [@imikejackson](https://discourse.itk.org/u/imikejackson)
#### Post date: [March 26, 2024, 4:27pm UTC](https://discourse.itk.org/t/anyone-compiled-itk-withtbb-on-mac-osx-x86/6525/2 "2024-03-26T16:27:16Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [April 26, 2024, 4:45pm UTC](https://discourse.itk.org/t/anyone-compiled-itk-withtbb-on-mac-osx-x86/6525/3 "2024-04-26T16:45:14Z")

</div>

@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?

---

<div class="post-metadata">

### Author: ![imikejackson](https://discourse.itk.org/user_avatar/discourse.itk.org/imikejackson/32/35_2.png) [@imikejackson](https://discourse.itk.org/u/imikejackson)
#### Post date: [April 30, 2024, 4:51pm UTC](https://discourse.itk.org/t/anyone-compiled-itk-withtbb-on-mac-osx-x86/6525/4 "2024-04-30T16:51:12Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [April 30, 2024, 5:03pm UTC](https://discourse.itk.org/t/anyone-compiled-itk-withtbb-on-mac-osx-x86/6525/5 "2024-04-30T17:03:41Z")

</div>

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](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”](https://github.com/conda-forge/libitk-feedstock/blob/8a10f2b3440da53eb36693a55a47c9599e5b6052/recipe/build.sh#L49) for consistency.

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [May 19, 2024, 9:08pm UTC](https://discourse.itk.org/t/anyone-compiled-itk-withtbb-on-mac-osx-x86/6525/6 "2024-05-19T21:08:20Z")

</div>

> [@blowekamp](#):
>
> Do you have any information on why TBB was disable on Mac intel here?

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.
