# Building Slicer with MABMIS extension failed

**URL:** <https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742>\
**Category:** Development\
**Tags:** extensions-manager\
**Created:** [November 13, 2018, 10:02am UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742 "2018-11-13T10:02:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rasoul](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rasoul/32/1493_2.png) [@rasoul](https://discourse.slicer.org/u/rasoul)\
**Post date:** [November 13, 2018, 10:02am UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742/1 "2018-11-13T10:02:38Z")

</div>

Hi everyone  
I want to build slicer with an Extension(MABMIS) but I have errors. the system specification is:  
Windows 7.  
Visual studio 2015 x64.  
cmake 3.12 x64.

The steps I did are as follows:  
1- As I want to build an extension(MABMIS), I put it in D:\S\Modules\CLI folder and added its name to D:\S\Modules\CLI\CMakeLists.txt .  
2- I configured the source Successfully using CMake GUI and adding QT5.1 path variable and also turning SimpleITK bool to off. Then I generated it and closed the Cmake UI.  
3- As there were no Slicer.exe in S4D\Slicer-build folder, I Open Slicer.sln in S4D directory using Visual studio and built All\_Build in debug mode.  
The error is:

```
49> CMake Error at Modules/CLI/MultiAtlas/CMakeLists.txt:12 (find_package):
49> By not providing "FindSlicer.cmake" in CMAKE_MODULE_PATH this project has
49> asked CMake to find a package configuration file provided by "Slicer", but
49> CMake did not find one.
49>
49> Could not find a package configuration file provided by "Slicer" with any
49> of the following names:
49>
49> SlicerConfig.cmake
49> slicer-config.cmake
49>
49> Add the installation prefix of "Slicer" to CMAKE_PREFIX_PATH or set
49> "Slicer_DIR" to a directory containing one of the above files. If "Slicer"
49> provides a separate development package or SDK, be sure it has been
49> installed.
49>
49>
49> -- Configuring incomplete, errors occurred!
49> See also "D:/S4D13/Slicer-build/CMakeFiles/CMakeOutput.log".
49> See also "D:/S4D13/Slicer-build/CMakeFiles/CMakeError.log".
49>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error 
MSB6006: "cmd.exe" exited with code 1.
50>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------
50> Building Custom Rule D:/S4/CMakeLists.txt
50> CMake does not need to re-run because D:/S4D13/CMakeFiles/generate.stamp is up-to-date.
========== Build: 48 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
```

---

<div class="post-metadata">

**Author:** ![fedorov](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fedorov/32/14_2.png) [@fedorov](https://discourse.slicer.org/u/fedorov)\
**Post date:** [November 13, 2018, 2:49pm UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742/2 "2018-11-13T14:49:28Z")

</div>

That extension is failing on all platforms on the dashboard: [http://slicer.cdash.org/index.php?project=SlicerPreview&filtercount=1&showfilters=1&field1=buildname&compare1=63&value1=mabmis](http://slicer.cdash.org/index.php?project=SlicerPreview&filtercount=1&showfilters=1&field1=buildname&compare1=63&value1=mabmis)

I am not sure if developers of that extension are on this forum. You may need to contact them directly. See contact info at [https://www.slicer.org/wiki/Documentation/Nightly/Extensions/MABMIS](https://www.slicer.org/wiki/Documentation/Nightly/Extensions/MABMIS)

---

<div class="post-metadata">

**Author:** ![dzenanz](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dzenanz/32/1992_2.png) [@dzenanz](https://discourse.slicer.org/u/dzenanz)\
**Post date:** [November 13, 2018, 3:12pm UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742/3 "2018-11-13T15:12:39Z")

</div>

Commit [1f54e8d](https://github.com/BrainMeasurement/MultiAtlas/commit/1f54e8d939e03adc8feb22d5e39bda70314d231e), which is referenced in the extensions index is severely out of date. [PR4](https://github.com/BrainMeasurement/MultiAtlas/pull/4), which is based on [my fork](https://github.com/dzenanz/MultiAtlas), was building with 4.8.1 in February.

@rasoul Your build process sounds good. It looks like Slicer failed to compile for some reason, and then `FindSlicer` call in `MABMIS` failed. You could

- look higher up in the build log for errors
- build solution again - that should try to build only the projects which failed to build the first time and the build log will be much shorter, making errors easier to spot
- build Slicer.sln in S4D\Slicer-build (the so called inner build) - this should give more detailed errors related to building Slicer itself

---

<div class="post-metadata">

**Author:** ![rasoul](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rasoul/32/1493_2.png) [@rasoul](https://discourse.slicer.org/u/rasoul)\
**Post date:** [November 14, 2018, 5:58am UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742/4 "2018-11-14T05:58:03Z")

</div>

Thanks @fedorov and @dzenanz. I built it again and the error is the same one. I am building it again with Slicer 4.8.1.  
What wondering me is that **there is no slicer.sln in S4D\Slicer-build directory**. Have I forgotten something during my building?

---

<div class="post-metadata">

**Author:** ![rasoul](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rasoul/32/1493_2.png) [@rasoul](https://discourse.slicer.org/u/rasoul)\
**Post date:** [November 14, 2018, 11:20am UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742/5 "2018-11-14T11:20:41Z")

</div>

Building with slicer 4.8.1 faced with error. But now the error changed to this one.

> ```
> 49> CMake Error at Modules/CLI/MultiAtlas/CMakeLists.txt:13 (include):
> 49> include called with wrong number of arguments. include() only takes one
> 49> file.
> 49> -- ITKIOImageBaseITKCommonitksysitkvnl_algoitkvnlitkv3p_netlibitknetlibitkvclITKTransformITKStatisticsitkNetlibSlatecITKIOTransformBaseITKSpatialObjectsITKPathITKMetaIOD:/S481B/zlib-install/lib/zlib.libITKTransformFactoryITKIOXML
> 49> -- Configuring SEM CLI module: IGR3D_MABMIS_Training
> 49> -- Configuring SEM CLI module: IGR3D_MABMIS_Testing
> 49> -- Configuring SEM CLI module: IGR3D_MABMIS_Direct_Invoke
> 49> CMake Error at Modules/CLI/MultiAtlas/CMakeLists.txt:75 (include):
> 49> include called with wrong number of arguments. include() only takes one
> 49> file.
> 49>
> 49> CMake Error at Modules/CLI/MultiAtlas/CMakeLists.txt:76 (include):
> 49> include called with wrong number of arguments. include() only takes one
> 49> file.
> 
> ```

---

<div class="post-metadata">

**Author:** ![rasoul](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rasoul/32/1493_2.png) [@rasoul](https://discourse.slicer.org/u/rasoul)\
**Post date:** [November 14, 2018, 12:13pm UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742/6 "2018-11-14T12:13:49Z")

</div>

I remove all lines that contains include() in CMakelist.txt and it built successfully.😀😀😀  
Thank you guys for your helps

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [November 14, 2018, 2:06pm UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742/7 "2018-11-14T14:06:33Z")

</div>

As a side note, make sure you download the code from @dzenanz fork, it contains the latest improvements. See [GitHub - dzenanz/MultiAtlas: 3D Slicer Extension for a multi-atlas segmentation technique from UNC's IDEA Group.](https://github.com/dzenanz/MultiAtlas)

> [@rasoul](#):
>
> it built successfully

👍

> [@rasoul](#):
>
> Modules/CLI/MultiAtlas/CMakeLists.txt

Our of curiosity, where is this file ? I failed to find it the extension source repository or the Slicer source repository:

- [GitHub - dzenanz/MultiAtlas: 3D Slicer Extension for a multi-atlas segmentation technique from UNC's IDEA Group.](https://github.com/dzenanz/MultiAtlas)
- [Slicer/Modules/CLI at v4.8.1 · Slicer/Slicer · GitHub](https://github.com/Slicer/Slicer/tree/v4.8.1/Modules/CLI)

---

<div class="post-metadata">

**Author:** ![rasoul](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rasoul/32/1493_2.png) [@rasoul](https://discourse.slicer.org/u/rasoul)\
**Post date:** [November 14, 2018, 2:50pm UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742/8 "2018-11-14T14:50:50Z")

</div>

> [@jcfr](#):
>
> make sure you download the code from

Yes it was downloaded from @dzenanz fork.

> [@jcfr](#):
>
> where is this file

After I downloaded MABMIS I put it to Slicer-source\Modules\CLI\MultiAtlas directory.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [November 14, 2018, 3:14pm UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742/9 "2018-11-14T15:14:16Z")

</div>

> [@rasoul](#):
>
> I downloaded MABMIS I put it to Slicer-source\Modules\CLI\MultiAtlas directory.

That makes sense now.

To avoid modifying Slicer source tree, there are few other approaches:

### build against Slicer build tree

An alternative solution could be to build the extension against your Slicer build tree configuring the extension passing `-DSlicer_DIR:PATH=C:\path\to\Slicer-Superbuild\Slicer-build`, and then starting Slicer specifying `--launcher-additional-settings` and `--additional-module-paths`

In the recent Slicer, a launcher is setup for you in the extension build directory.

### configure passing additional extension source dir

[https://github.com/Slicer/Slicer/blob/589e6b8d29cb13b434c97bd504f386d6e7503038/CMakeLists.txt#L1052-L1054](https://github.com/Slicer/Slicer/blob/589e6b8d29cb13b434c97bd504f386d6e7503038/CMakeLists.txt#L1052-L1054)

---

<div class="post-metadata">

**Author:** ![rasoul](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rasoul/32/1493_2.png) [@rasoul](https://discourse.slicer.org/u/rasoul)\
**Post date:** [November 15, 2018, 5:03am UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742/11 "2018-11-15T05:03:25Z")

</div>

Thank you @jcfr for your suggestions.

---

<div class="post-metadata">

**Author:** ![FelixBoy](https://avatars.discourse-cdn.com/v4/letter/f/977dab/32.png) [@FelixBoy](https://discourse.slicer.org/u/FelixBoy)\
**Post date:** [December 2, 2019, 10:17am UTC](https://discourse.slicer.org/t/building-slicer-with-mabmis-extension-failed/4742/12 "2019-12-02T10:17:34Z")

</div>

Hi,I just contacted MABMIS.And the same mistake you’ve encountered.Do you require QT？
