While building my extension I have set up a required extension (SlicerElastix) which runs fine, but when I want to test it in Docker it fails with this message:
144 CMake Warning at /usr/src/Slicer/Extensions/CMake/SlicerBlockAdditionalLauncherSettings.cmake:48 (message):
145 Dependent extension SlicerElastix cannot be found by CMake find_package(),
146 therefore paths variables cannot be imported from this extension. The
147 problem can be resolved by generating SlicerElastixConfig.cmake by adding
148 include(${Slicer_EXTENSION_GENERATE_CONFIG}) to the top-level
149 CMakeLists.txt of the dependent extension.
I have a look at the offending file and indeed, it contains that line. So, I don’t know what it is happening here.
It appears that another extension, SequenceRegistration, is also having the same issue. That extension depends on Sequences and SlicerElastix. Here’s the nightly Windows build for SequenceRegistration that has the same CMake warning: http://slicer.cdash.org/viewConfigure.php?buildid=1770198.
When you build an extension, you need to pass location of all other extensions that it depends on, as CMake variables. For example, if you want to build Sequence Registration, then you need to set SlicerElastix_DIR=…
For 1-2 extensions with simple dependencies you may do this manually, but it may be simpler (especially when you build several extensions) to use Slicer’s extensions index build script: copy s4ext files that you want to build into a folder and specify that as Slicer_EXTENSION_DESCRIPTION_DIR. See the complete command-line here. This script determines dependencies between extensions, builds them in the correct order and passes all required paths to dependent extensions.
@lassoan Do you have insight on how to fix the factory build of SequenceRegistration extension which specifies SlicerElastix as a dependent extension. Looking to solve this failing test specifically.
Make sure to add SlicerElastix_DIR when configuring you project in CMake (or put all s4ext files in a folder and let Slicer extension build script to figure out dependencies, build order, and set all necessary CMake variables).
Do you mean adding SlicerElastix_DIR even when it is not there in the first place?
How to copy the s4ext file, shall I copy from web or do I need to create a local copy? There is already a folder of s4ext inside Slicer
I have made an extension that depends on another (Elastix) and I want that Slicer installs the required extension automatically. My extension shall be able to install in vanilla slicer-nightly.
You need to specify the list of extensions yours depend on in the top-level CMakeLists.txt file (EXTENSION_DEPENDS variable). After this, you also need to regenerate the s4ext file and update it in ExtensionsIndex repository.
I have found a way to force install SlicerElastix from within python, however this requires Slicer Restart, this is not optimal, I wanted to do it from within the gitlab-ci itself but I get several errors:
Traceback (most recent call last):
File "installElastix.py", line 2, in <module>
emm = slicer.app.extensionsManagerModel()
AttributeError: module 'slicer' has no attribute 'app'
vtkDebugLeaks has found no leaks.
I have tried to follow this circleci.yml in the slicer repository using the slicer-base docker image and it fails with
$ ../Slicer-build/BuildSlicer.sh
+ set -o pipefail
+ set -o
allexport off
braceexpand on
emacs off
errexit on
errtrace off
functrace off
hashall on
histexpand off
history off
ignoreeof off
interactive-comments on
keyword off
monitor off
noclobber off
noexec off
noglob off
nolog off
notify off
nounset off
onecmd off
physical off
pipefail on
posix off
privileged off
verbose off
vi off
xtrace on
+ cd /usr/src/Slicer-build
+ /usr/bin/cmake -E make_directory /usr/src/Slicer
+ /usr/bin/cmake -E make_directory /usr/src/Slicer-build/Slicer-build
+ /usr/bin/cmake -E make_directory /usr/src/Slicer-build/Slicer-prefix
+ /usr/bin/cmake -E make_directory /usr/src/Slicer-build/Slicer-prefix/tmp
+ /usr/bin/cmake -E make_directory /usr/src/Slicer-build/Slicer-prefix/src/Slicer-stamp
+ /usr/bin/cmake -E make_directory /usr/src/Slicer-build/Slicer-prefix/src
+ /usr/bin/cmake -E touch /usr/src/Slicer-build/Slicer-prefix/src/Slicer-stamp/Slicer-mkdir
+ cd /usr/src/Slicer-build/Slicer-prefix/src
+ /usr/bin/cmake -E echo_append
+ /usr/bin/cmake -E touch /usr/src/Slicer-build/Slicer-prefix/src/Slicer-stamp/Slicer-download
+ cd /usr/src/Slicer
+ /usr/bin/cmake -E echo_append
+ /usr/bin/cmake -E touch /usr/src/Slicer-build/Slicer-prefix/src/Slicer-stamp/Slicer-update
+ cd /usr/src/Slicer-build
+ /usr/bin/cmake -E echo_append
+ /usr/bin/cmake -E touch /usr/src/Slicer-build/Slicer-prefix/src/Slicer-stamp/Slicer-patch
+ cd /usr/src/Slicer-build/Slicer-build
+ /usr/bin/cmake -C/usr/src/Slicer-build/Slicer-prefix/tmp/Slicer-cache-Release.cmake -GNinja /usr/src/Slicer
loading initial cache file /usr/src/Slicer-build/Slicer-prefix/tmp/Slicer-cache-Release.cmake
CMake Error: The source directory "/usr/src/Slicer" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
+ exit 1
Authenticating with credentials from /Users/alexvergaragil/.docker/config.json
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x19196db]
I would recommend to build SlicerExtensions project, which downloads, builds, and tests a list of extensions (by default, it takes the list from ExtensionsIndex repository, but you can provide your own list instead). This project takes care of dependencies between extensinos: it builds them in the right order, and also passes all needed build directories to extensions that depend on others. This is used every night to build all the extensions.
I am trying to replicate the behaviour of the circleCI docker instance but I was unsuccessful. see:
alex@CRCTcalcul:~$ docker run -it slicer/slicer-base /bin/bash
Unable to find image 'slicer/slicer-base:latest' locally
latest: Pulling from slicer/slicer-base
a02a4930cb5d: Already exists
6a788e5d573f: Already exists
a9afa5c4a530: Already exists
6383f75ec3ac: Already exists
ec1353604d1f: Already exists
a6a7f5d80d82: Already exists
87bee5282cdd: Already exists
63309cde1def: Pull complete
Digest: sha256:4a69f356475c2974de6d35722474f674912300ee01ee50e3b8ff418bbc31865d
Status: Downloaded newer image for slicer/slicer-base:latest
[root@72bd75fc099d Slicer-build]# cd /usr/src/Slicer
bash: cd: /usr/src/Slicer: No such file or directory
[root@72bd75fc099d Slicer-build]# ../Slicer-build/BuildSlicer.sh
+ set -o pipefail
+ set -o
allexport off
braceexpand on
emacs off
errexit on
errtrace off
functrace off
hashall on
histexpand off
history off
ignoreeof off
interactive-comments on
keyword off
monitor off
noclobber off
noexec off
noglob off
nolog off
notify off
nounset off
onecmd off
physical off
pipefail on
posix off
privileged off
verbose off
vi off
xtrace on
+ cd /usr/src/Slicer-build
+ /usr/bin/cmake -E make_directory /usr/src/Slicer
+ /usr/bin/cmake -E make_directory /usr/src/Slicer-build/Slicer-build
+ /usr/bin/cmake -E make_directory /usr/src/Slicer-build/Slicer-prefix
+ /usr/bin/cmake -E make_directory /usr/src/Slicer-build/Slicer-prefix/tmp
+ /usr/bin/cmake -E make_directory /usr/src/Slicer-build/Slicer-prefix/src/Slicer-stamp
+ /usr/bin/cmake -E make_directory /usr/src/Slicer-build/Slicer-prefix/src
+ /usr/bin/cmake -E touch /usr/src/Slicer-build/Slicer-prefix/src/Slicer-stamp/Slicer-mkdir
+ cd /usr/src/Slicer-build/Slicer-prefix/src
+ /usr/bin/cmake -E echo_append
+ /usr/bin/cmake -E touch /usr/src/Slicer-build/Slicer-prefix/src/Slicer-stamp/Slicer-download
+ cd /usr/src/Slicer
+ /usr/bin/cmake -E echo_append
+ /usr/bin/cmake -E touch /usr/src/Slicer-build/Slicer-prefix/src/Slicer-stamp/Slicer-update
+ cd /usr/src/Slicer-build
+ /usr/bin/cmake -E echo_append
+ /usr/bin/cmake -E touch /usr/src/Slicer-build/Slicer-prefix/src/Slicer-stamp/Slicer-patch
+ cd /usr/src/Slicer-build/Slicer-build
+ /usr/bin/cmake -C/usr/src/Slicer-build/Slicer-prefix/tmp/Slicer-cache-Release.cmake -GNinja /usr/src/Slicer
loading initial cache file /usr/src/Slicer-build/Slicer-prefix/tmp/Slicer-cache-Release.cmake
CMake Error: The source directory "/usr/src/Slicer" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
+ exit 1
[root@72bd75fc099d Slicer-build]#
I want to create an image with Slicer extensions built by default.