# Elastix build error

**URL:** <https://discourse.slicer.org/t/elastix-build-error/9995>\
**Category:** Support\
**Tags:** elastix\
**Created:** [January 29, 2020, 1:22pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995 "2020-01-29T13:22:32Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [January 29, 2020, 1:22pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/1 "2020-01-29T13:22:32Z")

</div>

As seen here [http://slicer.cdash.org/buildSummary.php?buildid=1809996](http://slicer.cdash.org/buildSummary.php?buildid=1809996)

elastix is failing and it is not being built, there is any schedule to solve this issue, it seems quite complicated errors there

---

<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:** [January 29, 2020, 5:32pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/2 "2020-01-29T17:32:42Z")

</div>

Thank you, probably we just need to update to a more recent Elastix version that is compatible with the ITK version that Slicer uses. Could you give it a try?

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [January 30, 2020, 11:12am UTC](https://discourse.slicer.org/t/elastix-build-error/9995/3 "2020-01-30T11:12:02Z")

</div>

Since Elastix is not core part of slicer I don’t know how to test this:

- Shall I build slicer, then elastix?
- Shall I build only elastix?

Never tried this before

---

<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:** [January 30, 2020, 2:47pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/4 "2020-01-30T14:47:40Z")

</div>

Yes, first you need to [build Slicer](https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions) and then build [SlicerElastix extension](https://github.com/lassoan/SlicerElastix).

---

<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:** [January 30, 2020, 9:57pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/5 "2020-01-30T21:57:42Z")

</div>

I had a look at this build error. It is due to recent backward-incompatible changes in ITK related to typed enums. I [applied a quick patch to Elastix in my fork](https://github.com/lassoan/elastix/commit/dbb5a0e88feceee92b5c72be6c45d305a6fb0854) and switched to this patched version for now. This should fix the build problem in SlicerElastix.

@dzenanz I don’t know if these kind of issues are expected with ITK-v5.1rc01 but it would be nice if the final ITK-v5.1 release would not have such problems.

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [January 31, 2020, 12:28pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/6 "2020-01-31T12:28:39Z")

</div>

Well, that was not enough accordingly to [http://slicer.cdash.org/buildSummary.php?buildid=1811816](http://slicer.cdash.org/buildSummary.php?buildid=1811816)

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [January 31, 2020, 1:06pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/7 "2020-01-31T13:06:24Z")

</div>

I anm currently running a test in a container with

```auto
# only one stage, since gitlab-ci does not support passing images between stages
image: unnmdnwb3/slicer3d-nightly:0.7.0

build-and-test:
  variables:
    DISPLAY: ":99.0"
  script:
    - mkdir $CI_BUILDS_DIR/elastix-build && cd $CI_BUILDS_DIR/elastix-build
    - cmake -DSlicer_DIR:PATH=/usr/src/Slicer-build/Slicer-build -DITK_DIR:PATH$
    - make -j32

```

---

<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:** [January 31, 2020, 1:07pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/8 "2020-01-31T13:07:22Z")

</div>

Build is successful on Windows and Linux now, but yes, the compiler on MacOS still struggles with some type conversion. I saw similar issue when we first built Slicer and BRAINSTools with ITK5 a d probably the solution will be similar, too. I’ll try to fix it today, but I don’t have a Mac to test on, so it may take a few more days until we converge to a solution.

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [January 31, 2020, 1:33pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/9 "2020-01-31T13:33:03Z")

</div>

For reference this is the container output (truncated)

```auto
/builds/project-0/Common/Transforms/itkAdvancedRigid2DTransform.hxx:125:5: warning: ‘vnl_matrix_fixed<T, num_rows, num_cols>::operator const vnl_matrix_ref<T>() const [with T = double; unsigned int num_rows = 2u; unsigned int num_cols = 2u]’ is deprecated: Implicit cast conversion is dangerous.
USE: .as_vector() or .as_ref() member function for clarity. [-Wdeprecated-declarations]
   p = this->GetMatrix().GetVnlMatrix();
     ^
In file included from /usr/src/Slicer-build/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.hxx:9:0,
                 from /usr/src/Slicer-build/ITK/Modules/Core/Common/include/itkMatrix.h:25,
                 from /usr/src/Slicer-build/ITK/Modules/Core/Common/include/itkSymmetricSecondRankTensor.h:28,
                 from /usr/src/Slicer-build/ITK/Modules/IO/ImageBase/include/itkImageIOBase.h:30,
                 from /usr/src/Slicer-build/ITK/Modules/IO/ImageBase/include/itkImageFileReader.h:24,
                 from /builds/project-0/Core/Kernel/elxElastixBase.h:39,
                 from /builds/project-0/Core/Kernel/elxElastixTemplate.h:21,
                 from /builds/project-0/Core/Install/elxIncludes.h:39,
                 from /builds/project-0/Components/Transforms/EulerStackTransform/elxEulerStackTransform.h:21,
                 from /builds/project-0/Components/Transforms/EulerStackTransform/elxEulerStackTransform.cxx:19:
/usr/src/Slicer-build/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_matrix_fixed.h:687:3: note: declared here
   operator const vnl_matrix_ref<T>() const { return this->as_ref(); }
   ^

[99%] Linking CXX executable ../bin/elastix
[100%] Linking CXX executable ../bin/transformix
[100%] Built target elastix
[100%] Built target transformix
e[0KAuthenticating with credentials from /home/alex/.docker/config.json
e[0;me[0KAuthenticating with credentials from /home/alex/.docker/config.json
e[0;me[32;1mJob succeeded
e[0;m

```

---

<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:** [February 1, 2020, 11:42pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/10 "2020-02-01T23:42:48Z")

</div>

I’ve committed a [change](https://github.com/lassoan/elastix/commit/e82e1fde91ad90cd0a5dc398a503237a6c5f0856) in Elastix that fixed a similar issue in Slicer core. We’ll see tomorrow on the dashboard if this fixes the Mac build error.

---

<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:** [February 2, 2020, 7:09pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/11 "2020-02-02T19:09:43Z")

</div>

Elastix build error is now fixed on Mac. It would be great if you could check if it works well.

---

<div class="post-metadata">

**Author:** ![Alex\_Vergara](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/alex_vergara/32/15205_2.png) [@Alex\_Vergara](https://discourse.slicer.org/u/Alex_Vergara)\
**Post date:** [February 4, 2020, 3:01pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/12 "2020-02-04T15:01:34Z")

</div>

Well It is being built

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

And it is running very well

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/f/9/f9db66331216a4477ef8dd1035e9bae2bb82aac8.jpeg)

---

<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:** [February 4, 2020, 3:02pm UTC](https://discourse.slicer.org/t/elastix-build-error/9995/13 "2020-02-04T15:02:50Z")

</div>

Great, thanks for testing!
