# SlicerRT build fails with new DCMTK

**URL:** <https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177>\
**Category:** Development\
**Tags:** build\
**Created:** [November 13, 2024, 5:16pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177 "2024-11-13T17:16:13Z")\
**Posts on this page:** 15\
**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:** [November 13, 2024, 5:16pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/1 "2024-11-13T17:16:13Z")

</div>

Just posting this quickly in case someone knows this off the top off their head.

I noticed lately that DCMTK probably changed under Slicer. Unfortunately besides some inconveniences (like having to do a clean build of Slicer), there are regressions such as this build error in SlicerRT.

[https://slicer.cdash.org/viewBuildError.php?buildid=3588396](https://slicer.cdash.org/viewBuildError.php?buildid=3588396)

Does anyone know what was the main change in DCMTK that causes this and how to fix it? SlicerRT is one of the most used extensions so it would be imperative to solve this before releasing 5.8 if this requires some change in Slicer itself. Thank you!

---

<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:** [November 13, 2024, 6:46pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/2 "2024-11-13T18:46:31Z")

</div>

As it looks to be a Plastimatch build error I would suggest that SlicerRT developers contact Plastimatch (cc @gregsharp.geo ?[Gregory C. Sharp · GitLab](https://gitlab.com/gregsharp)) about support for recent DCMTK versions. It appears the upstream specifies in its superbuild project to use DCMTK 3.6.2 so it appears there is currently not explicit support for the DCMTK 3.6.8 version that Slicer is using.

> <https://gitlab.com/plastimatch/plastimatch/-/blob/master/SuperBuild/External_DCMTK.cmake?ref_type=heads#L6>

However switching SlicerRT to use Plastimatch 1.10.0 (it currently use 1.9.2) [Version 1.10.0 (db24480d) · Commits · plastimatch / plastimatch · GitLab](https://gitlab.com/plastimatch/plastimatch/-/commit/db24480dc1086df3278992d62a86e70d8654cb5d) is probably a good starting point as it includes some likely important DCMTK linking fixes. So SlicerRT developers should try that update to keep their extension working well with latest Slicer.

---

<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:** [November 13, 2024, 8:02pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/3 "2024-11-13T20:02:26Z")

</div>

Yes I agree it is a Plastimatch issue. What I’m wondering about is if this apparent API change is something well-known. Otherwise it needs to be investigated. Good to know the Plastimatch used in SlicerRT is not the latest. I’ll start there. Thanks!

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [November 14, 2024, 9:35am UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/4 "2024-11-14T09:35:27Z")

</div>

I had such a problem a week ago, but after plastimatch update to the latest release the compilation process was successful. I had to turn-off Qt support in plastimatch.

Slicer commit: 98a05fbee8b7eb553ec2ae439e797415e727a984  
Plastimatch commit: 5036f97b213d37a0a07dd232c827fb5f35049ae4

---

<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:** [November 14, 2024, 12:45pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/5 "2024-11-14T12:45:40Z")

</div>

Thanks @Mik. Did you also have this error before turning off Qt support?  
`LINK : fatal error LNK1181: cannot open input file 'ofstd.lib'`

The reason I posted this in the first place is that I had to rebuild all Slicers that I had compiled from scratch because of the same error that I now get when trying to build SlicerRT with the latest Plastimatch. So I assumed that this is a common issue that people are aware of.

What I built exactly with the latest SlicerRT (and got the error above) is [this branch](https://github.com/SlicerRt/plastimatch/tree/slicerrt-1.10.0-2024.10.30-5036f97b), which I just pushed after rebasing the previous branch `slicerrt-1.9.3-2022.06.15-77b40bd3` on the latest Plastimatch on gitlab (the same hash as what @Mik mentions).

Update: what is strange is that the said file (ofstd.lib) is there (S5R\DCMTK-build\lib\Release\ofstd.lib).

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [November 14, 2024, 2:56pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/6 "2024-11-14T14:56:00Z")

</div>

There were link problems between plastimatch and DCMTK, i don’t remember vividly the exact error message, but it was similar.

Everything was done on Linux.

I had to disable Qt support because of plastimatch compilation error of a standalone program called `gamma_gui` or something like that, i think that issue doesn’t have a connection with linking problem.

---

<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:** [November 14, 2024, 3:18pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/7 "2024-11-14T15:18:43Z")

</div>

Thanks! Yes it seems unrelated. I’m trying to resolve the link errors one by one by adding `${DCMTK_LIBRARIES}` to the target libraries of the failing projects, there seems to be some progress (but it’s ugly). I’ll give an update when this is done, there are many projects and I find out what fails one by one.

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [November 14, 2024, 3:24pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/8 "2024-11-14T15:24:41Z")

</div>

I’m sorry for the misinformation, i’ve checked everything once again and for some reason i used an old DCMTK version 3.6.6. Now i recompiling both DCMTK and ITK to check plastimatch compilation once again, but i think the linking problem is still there.

Mia Culpa.

---

<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:** [November 14, 2024, 4:03pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/9 "2024-11-14T16:03:59Z")

</div>

Regarding this attempt (adding `${DCMTK_LIBRARIES}` into the CMakeLists.txt files of projects that showed the error `fatal error LNK1181: cannot open input file 'ofstd.lib'`):  
I added it to a dozen projects, because it seemed that it fixed the linking of the individual projects where I added them. In the end I reached `SlicerRtCommon`, and it seems that adding this does not fix that project. I get this when I add it to SlicerRtCommon:

```auto
  Performing build step for 'inner'
  MSBuild version 17.10.4+10fbfbf2e for .NET Framework

    Configuring: AdditionalLauncherSettings.ini
LINK : fatal error LNK1181: cannot open input file 'ofstd.lib' [C:\d\_Extensions\SlicerRT_R\inner-build\SlicerRtCommon\
vtkSlicerRtCommon.vcxproj] [C:\d\_Extensions\SlicerRT_R\inner.vcxproj]
LINK : fatal error LNK1181: cannot open input file 'ofstd.lib' [C:\d\_Extensions\SlicerRT_R\inner-build\DoseVolumeHisto
gram\MRML\vtkSlicerDoseVolumeHistogramModuleMRML.vcxproj] [C:\d\_Extensions\SlicerRT_R\inner.vcxproj]
LINK : fatal error LNK1181: cannot open input file 'ofstd.lib' [C:\d\_Extensions\SlicerRT_R\inner-build\Isodose\MRML\vt
kSlicerIsodoseModuleMRML.vcxproj] [C:\d\_Extensions\SlicerRT_R\inner.vcxproj]

```

I have absolutely no idea how to proceed, because the file is there, and don’t know what could be the reason that it is not found. Maybe this specific target is somehow not exposed? I’m not an expert of CMake unfortunately…

Happy to try stuff if someone has an idea!

---

<div class="post-metadata">

**Author:** ![PaoloZaffino](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/paolozaffino/32/81052_2.png) [@PaoloZaffino](https://discourse.slicer.org/u/PaoloZaffino)\
**Post date:** [November 14, 2024, 4:11pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/10 "2024-11-14T16:11:22Z")

</div>

Hi all,  
I confirm plastimatch did not compile with the new version of DCMTK, but this was fixed in September ([commit 1](https://gitlab.com/plastimatch/plastimatch/-/commit/fb3d4cbc8e4f4062cdc30fc001714b60c06dcd00), [commit 2](https://gitlab.com/plastimatch/plastimatch/-/commit/ed7722230c3106e99eb5b084e1afc4492527c1bc)).  
In the last palstimatch release (1.10.0) support for ITK 5.3 and DCMTK 3.6.8 was added.  
I can compile it Ubuntu and Arch Linux now.

Paolo

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [November 14, 2024, 5:16pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/11 "2024-11-14T17:16:34Z")

</div>

Plastimatch compiles successfully with ITK-5.4 and DCMTK-3.6.8. Linking errors in SlicerRT are the same.  
Typical output:  
`/usr/bin/ld: can't find -lofstd: Not such file or directory`.

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [November 15, 2024, 11:11am UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/12 "2024-11-15T11:11:36Z")

</div>

I’ve compiled SlicerRT master successfully on Linux!

I had to comment DCMTK libraries in logic of DicomRtImportExport and DicomSroImportExport modules.

SuperBuild is also compiled without problems.

---

<div class="post-metadata">

**Author:** ![Mik](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@Mik](https://discourse.slicer.org/u/Mik)\
**Post date:** [November 15, 2024, 11:52am UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/13 "2024-11-15T11:52:23Z")

</div>

[Pull request](https://github.com/SlicerRt/SlicerRT/pull/259) in SlicerRT for 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:** [November 15, 2024, 2:03pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/14 "2024-11-15T14:03:04Z")

</div>

Thank you very much! I integrated the PR with some minor changes. I’m doing a clean build as well to make sure it will work on the factory. Good to know it works on Linux too!

---

<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:** [November 16, 2024, 2:58pm UTC](https://discourse.slicer.org/t/slicerrt-build-fails-with-new-dcmtk/40177/15 "2024-11-16T14:58:05Z")

</div>

Just confirming that SlicerRT builds again on all platforms!

Thank you for helping!

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