# TBB DLL problem with new version of Visual Studio

**URL:** <https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936>\
**Category:** Development\
**Tags:** build\
**Created:** [June 21, 2024, 9:53am UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936 "2024-06-21T09:53:45Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [June 21, 2024, 9:53am UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/1 "2024-06-21T09:53:45Z")

</div>

Hi all,

I recently encountered something really strange, and since I saw this problem on three different machines, I think it is caused by the latest versions of Visual Studio.

If we build Slicer (in Debug or Release, occurs with both), although the splash screen shows up, this error appears, and then Slicer exits.  
 ![Screenshot 2024-06-21 104356](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/a/e/ae30ef6e7cdf57a0c4893daccdf76658f0517f06.png)

The superbuild tree contains files with such name

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/a/7a7a5718ff55e9947e9e4ccc5234d22c3acbdec9.png)

What I suspect is that the issue was introduced with an update of Visual Studio, because everything worked with MSVC compiler version 14.39.33519, but we had the TBB issue with version 14.40.33807.

Does anyone have any idea how to fix this? Thank you very much!

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [June 21, 2024, 11:51am UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/2 "2024-06-21T11:51:11Z")

</div>

An update: I thought the name of the folder was the same as the MSVC version, which for some reason isn’t. For example the folder  
`C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.35.32215` contains MSVC `19.35.32215.0`. The versions above correspond to the directory name.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 21, 2024, 12:37pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/3 "2024-06-21T12:37:40Z")

</div>

Does copying tbb123.dll into the folder that contains `SlicerApp-real.exe` fix the issue?

Does the issue occur only in the build tree or also in the install tree (if you create an install package)?

---

<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:** [June 21, 2024, 2:00pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/4 "2024-06-21T14:00:37Z")

</div>

There is some FindVcvars.cmake update stuff needed for VS 17.10 which has MSVC 1940.

It had been updated on the scikit-built side, but I’ve backported the required changes on the Slicer side. I haven’t tried yet if this is all that is needed to fix your issue, but definitely required for MSVC 1940 usage.

> <https://github.com/Slicer/Slicer/pull/7815>
>
> This is based on FindVcvars.cmake as of https://github.com/scikit-build/cmake-Fi…ndVcvars/commit/ccf29dc00cde21d78140b1b9698d6bf075b3ab76.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [June 21, 2024, 4:30pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/5 "2024-06-21T16:30:02Z")

</div>

Thanks a lot for the answers!

I tried different things, but to unblock the work I ended up rebuilding with the v142 toolset. It worked. But I messed up my v143 build tree, so to be able to help solve this issue (I know about at least one other person who had it) I started a new build with the problematic compiler version. I’ll report back on Monday.

Have a great weekend!

(@jamesobutler I’ll update and try!)

---

<div class="post-metadata">

**Author:** ![RolandLau](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rolandlau/32/69691_2.png) [@RolandLau](https://discourse.slicer.org/u/RolandLau)\
**Post date:** [June 24, 2024, 1:11am UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/6 "2024-06-24T01:11:53Z")

</div>

I tried using v142 toolset and v143 toolset 14.39.33519,both encountered this tbb12 dll issue.  
So I think this may not be a toolset version problem?

---

<div class="post-metadata">

**Author:** ![sfrisken](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@sfrisken](https://discourse.slicer.org/u/sfrisken)\
**Post date:** [June 24, 2024, 11:41pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/7 "2024-06-24T23:41:39Z")

</div>

I get the same error trying to build with VS 2022. Has anyone been able to figure this out? I’m trying to build my first loadable module for Project week – should I install a different version of Visual Studio? If so, could you please tell me which one?

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [June 25, 2024, 9:01am UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/8 "2024-06-25T09:01:55Z")

</div>

v142 worked for me.

My latest clean v143 build also showed missing VTK OpenGL DLL issues, but I went ahead with updating Slicer as @jamesobutler suggested, I’ll see if they disappear. (Yesterday was holiday here so didn’t have access to the computers at the office)

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [June 25, 2024, 10:38am UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/9 "2024-06-25T10:38:28Z")

</div>

The very latest Slicer (b0ed88351af465159b101fc434802c83fd438522) did not work as is, I had the same TBB DLL errors.

> [@lassoan](#):
>
> Does copying tbb123.dll into the folder that contains `SlicerApp-real.exe` fix the issue?

I copied all DLLs from `S5R\tbb-install\redist\intel64\vc14` to `S5R\Slicer-build\bin\Release` and it solves the issue, Slicer starts. Although it took forever the first time (much longer than a normal “first time after restart”). I observed this long startup with v142 as well though, but this is a brand new computer so maybe it’s that (but definitely not performance issue, this is a really strong computer).

> [@lassoan](#):
>
> Does the issue occur only in the build tree or also in the install tree (if you create an install package)?

Packaging fails with

```auto
  CMake Error at C:/d/S5R/Slicer-build/CMake/LastConfigureStep/cmake_install.cmake:408 (file):
    file INSTALL cannot find "C:/d/S5R/tbb-install/redist/intel64/tbb12.dll":
    File exists.
  Call Stack (most recent call first):
    C:/d/S5R/Slicer-build/cmake_install.cmake:142 (include)

EXEC : CPack error : Error when generating package: Slicer [c:\d\S5R\Slicer-build\PACKAGE.vcxproj]

```

---

<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:** [June 25, 2024, 11:46am UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/10 "2024-06-25T11:46:56Z")

</div>

The following likely needs updating to say 1949 as it appears it is never setting tbb\_vsdir. It has been an unusual case that 1940 is still Visual Studio 2022.

> <https://github.com/Slicer/Slicer/blob/b0ed88351af465159b101fc434802c83fd438522/SuperBuild/External_tbb.cmake#L81-L83>

---

<div class="post-metadata">

**Author:** ![sfrisken](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@sfrisken](https://discourse.slicer.org/u/sfrisken)\
**Post date:** [June 25, 2024, 3:30pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/11 "2024-06-25T15:30:02Z")

</div>

Quick update: I tried Csaba’s dll move and that also worked on my laptop with VS 2022. Slicer builds and runs. I know its only a temporary solution but it allows me to keep moving :-). Thanks!  
Sarah

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 2, 2024, 11:46am UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/12 "2024-07-02T11:46:52Z")

</div>

Now that project week is over, I’d like to ask if there is any plan to address this issue? I remember we had a time several years ago when we had to use an older compiler. I’d be fine with that, but please give an update in case you had the chance to discuss it at the PW.

The reason I’m asking is that I typically have many different Slicer builds, and I’m just about to switch to a new machine, and I’d like to avoid rebuilding everything more times than needed. So the question is basically should I wait or help, or proceed with the build using the v142 switch everywhere? Thank you very much!

---

<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:** [July 2, 2024, 12:38pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/13 "2024-07-02T12:38:14Z")

</div>

> [@cpinter](#):
>
> So the question is basically should I wait or help

If you can help confirm that the change mentioned below works that would be great!

> [@TBB DLL problem with new version of Visual Studio](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/10):
>
> The following likely needs updating to say 1949 as it appears it is never setting tbb\_vsdir. It has been an unusual case that 1940 is still Visual Studio 2022.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 2, 2024, 12:54pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/14 "2024-07-02T12:54:37Z")

</div>

> [@jamesobutler](#):
>
> If you can help confirm that the change mentioned below works that would be great!

I already checked, it didn’t. See:

> [@cpinter](#):
>
> The very latest Slicer (b0ed88351af465159b101fc434802c83fd438522) did not work as is, I had the same TBB DLL errors.

Let me know if you were thinking of something else.

---

<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:** [July 2, 2024, 2:47pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/15 "2024-07-02T14:47:16Z")

</div>

I think there may be some confusion. What I described in the below link is code that is not in a Slicer PR and not on Slicer `main`. A local change needs to be applied and tested.

> [@TBB DLL problem with new version of Visual Studio](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/10):
>
> The following likely needs updating to say 1949 as it appears it is never setting tbb\_vsdir. It has been an unusual case that 1940 is still Visual Studio 2022.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 2, 2024, 2:48pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/16 "2024-07-02T14:48:02Z")

</div>

Sorry I’ll revise it again then and let you know!

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 2, 2024, 3:16pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/17 "2024-07-02T15:16:11Z")

</div>

@jamesobutler The change you propose (change 1939 to 1949) works. Is this acceptable for everyone? @jcfr @lassoan

If so I can do a PR. Thanks for the help!

---

<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:** [July 2, 2024, 3:21pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/18 "2024-07-02T15:21:28Z")

</div>

Yes I think that change makes sense considering Visual Studio 2022 having a MSVC version \> 1939 was unexpected and I think this place in TBB is the remaining location where this MSVC version stuff could go wrong. A PR would be appreciated! Thanks for your testing.

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [July 2, 2024, 3:35pm UTC](https://discourse.slicer.org/t/tbb-dll-problem-with-new-version-of-visual-studio/36936/19 "2024-07-02T15:35:05Z")

</div>

This is the PR: [COMP: Update acceptable VS2022 MSVC version for TBB install by cpinter · Pull Request #7833 · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/pull/7833)
