Building Slicer with MABMIS extension failed


(rasoul) #1

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>    Could not find a package configuration file provided by "Slicer" with any
49>    of the following names:
49>      SlicerConfig.cmake
49>      slicer-config.cmake
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>  -- 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 ==========

(Andrey Fedorov) #2

That extension is failing on all platforms on the dashboard:

I am not sure if developers of that extension are on this forum. You may need to contact them directly. See contact info at

(Dženan Zukić) #3

Commit 1f54e8d, which is referenced in the extensions index is severely out of date. PR4, which is based on my fork, 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

(rasoul) #4

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?

(rasoul) #5

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>  CMake Error at Modules/CLI/MultiAtlas/CMakeLists.txt:76 (include):
49>    include called with wrong number of arguments.  include() only takes one
49>    file.

(rasoul) #6

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

(Jean Christophe Fillion Robin) #7

As a side note, make sure you download the code from @dzenanz fork, it contains the latest improvements. See


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

(rasoul) #8

Yes it was downloaded from @dzenanz fork.

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

(Jean Christophe Fillion Robin) #9

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

(rasoul) #11

Thank you @jcfr for your suggestions.