# Nightly build TESTS failing for extensions with dependencies to other scriptable modules

**URL:** <https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483>\
**Category:** Development\
**Created:** [November 17, 2017, 7:45pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483 "2017-11-17T19:45:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [November 17, 2017, 7:45pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/1 "2017-11-17T19:45:16Z")

</div>

Hi there,

today I noticed that (for a long time) our extension tests has been failing (generic, but also our custom tests)

e.g. [http://slicer.cdash.org/testDetails.php?test=8407693&build=1124707](http://slicer.cdash.org/testDetails.php?test=8407693&build=1124707)

Our mpReview extension has a dependency to ‘SlicerDevelopmentToolbox’

As you will notice, there are no dependencies loaded as additional-module-paths in the following cli command:

```
   /Users/kitware/Dashboards/Nightly/Slicer-0-build/Slicer-build/Slicer \"--no-splash\" \"--testing\" 
\"--launcher-additional-settings\" \"/Users/kitware/Dashboards/Nightly/S-0-E-b/mpReview-build/AdditionalLauncherSettings.ini\" 
\"--no-main-window\" \"--disable-cli-modules\" \"--additional-module-path\" 
\"/Users/kitware/Dashboards/Nightly/S-0-E-b/mpReview-build/lib/Slicer-4.9/qt-scripted-modules\" 
\"--additional-module-paths\" \"/Users/kitware/Dashboards/Nightly/S-0-E-b/mpReview-build/lib/Slicer-4.9/qt-scripted-modules\" 
\"/Users/kitware/Dashboards/Nightly/S-0-E-b/mpReview-build/lib/Slicer-4.9/cli-modules\" 
\"/Users/kitware/Dashboards/Nightly/S-0-E-b/mpReview-build/\" 
\"--python-code\" \"import slicer.testing; slicer.testing.runUnitTest([\'/Users/kitware/Dashboards/Nightly/S-0-E-b/mpReview-build\', 
\'/Users/kitware/Dashboards/Nightly/S-0-E-b/mpReview\'], \'qSlicermpReviewModuleGenericTest\')\"

```

Solution:  
Slicer nightly tests just needs to have those additional dependencies loaded for running tests. Otherwise this doesn’t mirror the real world where I need to install an extension from the ExtensionManager where the downloaded extensions (dependencies) automatically get added to the Slicer “Additional module paths”. And after restarting the extension (optimally) works like a charm!

Hope we can find a simple and quick solution for that.

Thanks in advance.

---

<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:** [November 17, 2017, 8:32pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/2 "2017-11-17T20:32:10Z")

</div>

Does your additional launcher settings file contain all the necessary paths?

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [November 17, 2017, 8:48pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/3 "2017-11-17T20:48:41Z")

</div>

SlicerDevelopmentToolbox is definitely missing. When building an extension, would this file automatically get extended by the missing dependencies? That’s what I would expect.

The AdditionalLauncherSettings.ini of my local mpReview build looks like the following:

```
[General]
additionalPathVariables=PYTHONPATH

[LibraryPaths]
1\path=/Users/christian/sources/py/mpReview/Build/lib/Slicer-4.7/cli-modules/.
2\path=/Users/christian/sources/py/mpReview/Build/lib/Slicer-4.7/qt-loadable-modules/.
size=2

[Paths]
1\path=/Users/christian/sources/py/mpReview/Build/lib/Slicer-4.7/cli-modules/.
2\path=/Users/christian/sources/py/mpReview/Build/bin/.
size=2

[EnvironmentVariables]

[PYTHONPATH]
1\path=/Users/christian/sources/py/mpReview/Build/lib/Slicer-4.7/qt-scripted-modules
2\path=/Users/christian/sources/py/mpReview/Build/lib/Slicer-4.7/qt-loadable-modules/.
3\path=/Users/christian/sources/py/mpReview/Build/lib/Slicer-4.7/qt-loadable-modules/Python
size=3
```

---

<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 17, 2017, 8:51pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/4 "2017-11-17T20:51:25Z")

</div>

For reference I added a Mantis issue about the same thing  
[https://issues.slicer.org/view.php?id=4472](https://issues.slicer.org/view.php?id=4472)  
I haven’t figured it out yet either.

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [November 17, 2017, 8:53pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/5 "2017-11-17T20:53:42Z")

</div>

Oh yeah. When building an extension which depends on other extensions I would assume the AdditionalLauncherSettings.ini to be extended by the dependencies, which probably would fix that issue.

---

<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 17, 2017, 8:57pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/6 "2017-11-17T20:57:51Z")

</div>

In my case the extension GelDosimetryAnalysis depends on SlicerRT. The problem locally is that the SlicerRT\_DIR CMake variable is not set. Instead it gives me this

> **CMake warning message**
>
> CMake Warning at C:/d/Slicer4/Extensions/CMake/SlicerBlockAdditionalLauncherSettings.cmake:48 (MESSAGE):  
> Dependent extension SlicerRT cannot be found by CMake find\_package(),  
> therefore paths variables cannot be imported from this extension. The  
> problem can be resolved by generating SlicerRTConfig.cmake by adding  
> include(${Slicer\_EXTENSION\_GENERATE\_CONFIG}) to the top-level  
> CMakeLists.txt of the dependent exension.  
> Call Stack (most recent call first):  
> C:/d/S4R/Slicer-build/UseSlicer.cmake:281 (include)  
> CMakeLists.txt:24 (include)

However include(${Slicer\_EXTENSION\_GENERATE\_CONFIG}) is in the top-level CMakeLists, and SlicerRT does generate a SlicerRTConfig.cmake.

If I define SlicerRT\_DIR manually, then it works nicely. It’s not done on the factory unfortunately, and this is where I am stuck now. We have a factory machine and was going to take a look at the issue on it, but I haven’t gotten to that point yet.

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [November 17, 2017, 9:00pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/7 "2017-11-17T21:00:49Z")

</div>

There is also something wrong here. The attribute name is not split into three depending extensions

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/d/b/db1fa2c460acb7fd6656f253d7ac2b3835322d58.png)

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [November 17, 2017, 9:12pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/8 "2017-11-17T21:12:14Z")

</div>

Having more than one dependency was causing issues since I didn’t add those dependencies correctly within the CMakeLists.txt.

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

The following at leasts splits the dependencies into separate CMake attributes

```
set(EXTENSION_DEPENDS SlicerDevelopmentToolbox DCMQI PETDICOMExtension)

```

instead of

```
set(EXTENSION_DEPENDS "SlicerDevelopmentToolbox DCMQI PETDICOMExtension")

```

My mistake. But it still doesn’t resolve the dependencies. Not sure where find\_package() is looking

---

<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 17, 2017, 9:15pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/9 "2017-11-17T21:15:55Z")

</div>

Yep 🙂 I reported the same thing to @jcfr but haven’t added a Mantis issue for this one. See screenshot

 ![20171027_MultipleExtensionDependencies](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/0/f/0f0adb3426b259a70c2b4baee152ece4d68eaaca.png)

---

<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 17, 2017, 9:16pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/10 "2017-11-17T21:16:47Z")

</div>

Oh so if you don’t put them between quotation marks then it works? Thanks!!

---

<div class="post-metadata">

**Author:** ![che85](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/che85/32/636_2.png) [@che85](https://discourse.slicer.org/u/che85)\
**Post date:** [November 17, 2017, 9:20pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/11 "2017-11-17T21:20:39Z")

</div>

Don’t put it in quotation marks or separate it with semicolon:

Both work for me:

```
set(EXTENSION_DEPENDS dependency1 dependency2 dependency3)

set(EXTENSION_DEPENDS "dependency1;dependency2;dependency3")
```

---

<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 17, 2017, 9:23pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/12 "2017-11-17T21:23:25Z")

</div>

Right. The [template](https://github.com/Slicer/Slicer/blob/836639490e2257a2ba485b440ba05d850f14736a/Utilities/Templates/Extensions/SuperBuild/CMakeLists.txt#L13) mentions the space separation, so that was fine. However the example “NA” is within quotes, and that made me put them between quotes. Maybe if we remove the quotes from the template or explain this in the same comment, then it’s less error-prone.

---

<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:** [November 17, 2017, 10:01pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/13 "2017-11-17T22:01:54Z")

</div>

Additional directories are collected recursively from all extensions that your extension depends on, and added to the additional launcher settings. Does it work until this point?

---

<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 17, 2017, 10:12pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/14 "2017-11-17T22:12:47Z")

</div>

Without manually specifying SlicerRT\_DIR in the GelDosimetryAnalysis CMake, it is not found, see explanation in earlier [comment](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/6?u=cpinter)

---

<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:** [November 18, 2017, 2:21am UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/15 "2017-11-18T02:21:04Z")

</div>

Adding of \_DIR for all required extensions is implemented in SlicerBlockBuildPackageAndUploadExtensions.cmake:

> <https://github.com/Slicer/Slicer/blob/4edfa38fe94abf5b8c88ea336682e55efbf906a6/Extensions/CMake/SlicerBlockBuildPackageAndUploadExtensions.cmake#L103>

Maybe you could add a couple of MESSAGE prints in this file to see where things go wrong. If everything looks fine then you can go one step further and check if the generated CMake cache file content is correct (contains \_DIR and the value is correct). If not, you can add some MESSAGE prints here:

> <https://github.com/Slicer/Slicer/blob/4edfa38fe94abf5b8c88ea336682e55efbf906a6/Extensions/CMake/SlicerBlockBuildPackageAndUploadExtension.cmake#L159-L164>

---

<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 18, 2017, 7:16pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/16 "2017-11-18T19:16:52Z")

</div>

> [@cpinter](#):
>
> If I define SlicerRT\_DIR manually, then it works nicely. It’s not done on the factory unfortunately, and this is where I am stuck now. We have a factory machine and was going to take a look at the issue on it, but I haven’t gotten to that point yet.

As mentioned in [Developer FAQ / Extensions / Can an extension depend on other extensions ?](https://www.slicer.org/wiki/Documentation/Nightly/Developers/FAQ#Can_an_extension_depend_on_other_extensions_.3F), the build system should build extensions with the expected `<ExtensionName>_DIR` variables.

This is implemented here:

[https://github.com/Slicer/Slicer/blob/4edfa38fe94abf5b8c88ea336682e55efbf906a6/Extensions/CMake/SlicerBlockUploadExtension.cmake#L100-L105](https://github.com/Slicer/Slicer/blob/4edfa38fe94abf5b8c88ea336682e55efbf906a6/Extensions/CMake/SlicerBlockUploadExtension.cmake#L100-L105)

and here:

[https://github.com/Slicer/Slicer/blob/4edfa38fe94abf5b8c88ea336682e55efbf906a6/Extensions/CMake/SlicerBlockBuildPackageAndUploadExtension.cmake#L159-L164](https://github.com/Slicer/Slicer/blob/4edfa38fe94abf5b8c88ea336682e55efbf906a6/Extensions/CMake/SlicerBlockBuildPackageAndUploadExtension.cmake#L159-L164)

> mpReview extension has a dependency to ‘SlicerDevelopmentToolbox’

Looking at the [description file](https://github.com/Slicer/ExtensionsIndex/blob/55645f9f4b67495b6cd326545943e5af7eaf28ab/mpReview.s4ext#L15) confirms that.

> GelDosimetry dependencies - See [Automatic test for extension cannot find dependency on factory · Issue #4472 · Slicer/Slicer · GitHub](https://issues.slicer.org/view.php?id=4472)

As we can see in the [CMakeLists.txt](https://github.com/SlicerRt/GelDosimetryAnalysis/blob/b2ee130bd93e766822eed4371219877184ea9847/CMakeLists.txt#L19), the dependency is specified as `SlicerRT`

But looking at the `CMakeCache.txt` of both extension, the path is not properly set:

```auto
kitware@factory-south-ubuntu:~/Dashboards/Nightly/S-0-E-b/mpReview-build$ cat CMakeCache.txt | grep SlicerDevelopmentToolbox_DIR
SlicerDevelopmentToolbox_DIR:PATH=SlicerDevelopmentToolbox_DIR-NOTFOUND

```

```auto
kitware@factory-south-ubuntu:~/Dashboards/Nightly/S-0-E-b/GelDosimetryAnalysis-build$ cat CMakeCache.txt | grep SlicerRT_DIR
SlicerRT_DIR:PATH=SlicerRT_DIR-NOTFOUND

```

There is definitively a problem.

---

<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 18, 2017, 8:01pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/17 "2017-11-18T20:01:36Z")

</div>

Also worth noting that the current test check that `_DIR` variables are effectively set:

> <https://github.com/Slicer/Slicer/blob/63218815d127d2828e4806f43cc3a50163a0c6c5/Extensions/CMake/Testing/SlicerExtensionBuildSystemTest.py#L547-L575>

---

<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 18, 2017, 8:36pm UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/18 "2017-11-18T20:36:37Z")

</div>

The issue are the following:

- For `SlicerRT`, the config file is located in the top-level directory but the extension build system set `SlicerRT_DIR` using

- For `SlicerDevelopmentToolbox`, there is no `SlicerDevelopmentToolboxConfig.cmake` file and as @lassoan suggested, it can easily be fixed adding `include(${Slicer_EXTENSION_GENERATE_CONFIG})` in [https://github.com/fbudin69500/SlicerDeveloperToolsForExtensions/blob/5ceceabbb3ae35a669309389aa34e596699ca058/CMakeLists.txt#L26](https://github.com/fbudin69500/SlicerDeveloperToolsForExtensions/blob/5ceceabbb3ae35a669309389aa34e596699ca058/CMakeLists.txt#L26)

---

<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:** [November 19, 2017, 12:25am UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/19 "2017-11-19T00:25:25Z")

</div>

> [@jcfr](#):
>
> This means the call to find\_package(SlicerRT) fails because it can’t find a config file and reset the variable SlicerRT\_DIR

I’ve fixed this already earlier today ([https://github.com/Slicer/Slicer/commit/9d4634fada0d428e698de7c4a68d43db25d242ef](https://github.com/Slicer/Slicer/commit/9d4634fada0d428e698de7c4a68d43db25d242ef)).

---

<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:** [November 19, 2017, 12:35am UTC](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483/20 "2017-11-19T00:35:54Z")

</div>

Also pushed a fix to SlicerRT ([https://github.com/SlicerRt/SlicerRT/commit/eb5995488eeddcc9fb1a6be789dc63ac0e2448fa](https://github.com/SlicerRt/SlicerRT/commit/eb5995488eeddcc9fb1a6be789dc63ac0e2448fa)). SlicerRTConfig.cmake was generated too early (before any modules were configured), so no module paths were added to SlicerRT’s AdditionalLauncherSettings.ini file.

[Next page](https://discourse.slicer.org/t/nightly-build-tests-failing-for-extensions-with-dependencies-to-other-scriptable-modules/1483.md?page=2)
