# Build and install SimpleITK with SimpleITK\_USE\_ELASTIX option in linux environment

**URL:** https://discourse.itk.org/t/build-and-install-simpleitk-with-simpleitk-use-elastix-option-in-linux-environment/7128
**Category:** Beginner Questions
**Tags:** linux, simpleelastix, simpleitk
**Created:** [July 26, 2024, 2:04am UTC](https://discourse.itk.org/t/build-and-install-simpleitk-with-simpleitk-use-elastix-option-in-linux-environment/7128 "2024-07-26T02:04:01Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![thanuja](https://discourse.itk.org/letter_avatar_proxy/v4/letter/t/b487fb/32.png) [@thanuja](https://discourse.itk.org/u/thanuja)
#### Post date: [July 26, 2024, 2:04am UTC](https://discourse.itk.org/t/build-and-install-simpleitk-with-simpleitk-use-elastix-option-in-linux-environment/7128/1 "2024-07-26T02:04:02Z")

</div>

Hi All,

I’m trying to install simple elastix package using SimpleITK v2.2.1 source code in a python 3.10.13 virtual environment by following the documentation:[https://simpleitk.readthedocs.io/en/master/building.html](https://simpleitk.readthedocs.io/en/master/building.html)  
I’m getting an error when executing the built command after configuration:

```auto
cmake ../SimpleITK -D SimpleITK_USE_ELASTIX=ON
make -j$(nproc) > output.log

```

I have attached the error lines I got in the terminal as cmd.  
[cmd.out](https://discourse.itk.org/uploads/short-url/eeVLhMD1qcIkHv6mhVyf8klSNEj.out) (70.4 KB)  
out file here.

Could you please help to solve this issue?

Thank you!

---

<div class="post-metadata">

### Author: ![Niels\_Dekker](https://discourse.itk.org/letter_avatar_proxy/v4/letter/n/9d8465/32.png) [@Niels\_Dekker](https://discourse.itk.org/u/Niels_Dekker)
#### Post date: [July 26, 2024, 7:30am UTC](https://discourse.itk.org/t/build-and-install-simpleitk-with-simpleitk-use-elastix-option-in-linux-environment/7128/2 "2024-07-26T07:30:57Z")

</div>

Thanks @thanuja Just wondering, are those errors specific to the USE\_ELASTIX option, or do they also occur when you try to build without elastix? (`-D SimpleITK_USE_ELASTIX=OFF`)

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [July 26, 2024, 11:30am UTC](https://discourse.itk.org/t/build-and-install-simpleitk-with-simpleitk-use-elastix-option-in-linux-environment/7128/3 "2024-07-26T11:30:11Z")

</div>

Hello,

Can you share a few things about your system?

OS Version? Compiler version? CMake version? How much memory on your system, and now many cpus ( value of nproc)?

Any reason you are building the older “v2.2.1” tag? I’d building recommend the current master which is just after the v2.4rc2 tag with an update to Elastix 5.4.0 tag.

Looking at the log, I don’t see compiler errors just “Killed signal terminated program cc1plus” which may be due to running out of memory. A rule of thumb for the memory requirements for building SimpleITK if 4GB + 2 GB per core of memory when building in parallel.

P.S. If this is being run in a Docker container, the resources of the docker container need to be checked.

---

<div class="post-metadata">

### Author: ![thanuja](https://discourse.itk.org/letter_avatar_proxy/v4/letter/t/b487fb/32.png) [@thanuja](https://discourse.itk.org/u/thanuja)
#### Post date: [July 26, 2024, 3:09pm UTC](https://discourse.itk.org/t/build-and-install-simpleitk-with-simpleitk-use-elastix-option-in-linux-environment/7128/4 "2024-07-26T15:09:23Z")

</div>

@Niels_Dekker Thank you for the reply. Yes, I’m getting the same error when building the source code without USE\_ELASTIX option.

---

<div class="post-metadata">

### Author: ![thanuja](https://discourse.itk.org/letter_avatar_proxy/v4/letter/t/b487fb/32.png) [@thanuja](https://discourse.itk.org/u/thanuja)
#### Post date: [July 26, 2024, 3:49pm UTC](https://discourse.itk.org/t/build-and-install-simpleitk-with-simpleitk-use-elastix-option-in-linux-environment/7128/5 "2024-07-26T15:49:54Z")

</div>

@blowekamp Thank you for the reply. Please note that I’m installing Simple ITK 2.2.1 because ITK 5.3.0 is the available module in the virtual environment in the cluster. I have the privilege of installing packages as an end user. The details of the node where I have setup the virtual environment:

OS version:

```auto
NAME="Rocky Linux"
VERSION="8.9 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.9"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.9 (Green Obsidian)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2029-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8"
ROCKY_SUPPORT_PRODUCT_VERSION="8.9"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.9"

```

Compiler version:

```auto
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/libexec/gcc/x86_64-pc-linux-gnu/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: /cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/var/tmp/portage/sys-devel/gcc-12.3.1_p20230526/work/gcc-12-20230526/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr --bindir=/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/x86_64-pc-linux-gnu/gcc-bin/12 --includedir=/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/lib/gcc/x86_64-pc-linux-gnu/12/include --datadir=/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/share/gcc-data/x86_64-pc-linux-gnu/12 --mandir=/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/share/gcc-data/x86_64-pc-linux-gnu/12/man --infodir=/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/share/gcc-data/x86_64-pc-linux-gnu/12/info --with-gxx-include-dir=/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/12/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 12.3.1_p20230526 p2' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --with-sysroot=/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3 --with-build-sysroot=/cvmfs/soft.computecanada.ca/gentoo/2023/x86-64-v3 --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --with-multilib-list=m64 --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --disable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --with-isl --disable-isl-version-check --disable-default-pie --disable-default-ssp --without-cuda-driver --enable-offload-targets=nvptx-none --with-build-config=bootstrap-lto
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.3.1 20230526 (Gentoo 12.3.1_p20230526 p2) 

```

CMake version: cmake version 3.27.7

Memory details:

```auto
MemTotal: 263548452 kB
MemFree: 60815524 kB
MemAvailable: 79183712 kB
Percpu: 1626112 kB

```

Since the memory per core is less than 2GB, I will try to build the source code from compute node rather than login node and update you. If there are anything else I can do, please let me know.

Thank you!

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [July 26, 2024, 3:53pm UTC](https://discourse.itk.org/t/build-and-install-simpleitk-with-simpleitk-use-elastix-option-in-linux-environment/7128/6 "2024-07-26T15:53:47Z")

</div>

Yes, It sounds like your processes were rightfully killed if you were building on a head node of a cluster.

With the current command line configuration you will not be using the installed system ITK.

---

<div class="post-metadata">

### Author: ![thanuja](https://discourse.itk.org/letter_avatar_proxy/v4/letter/t/b487fb/32.png) [@thanuja](https://discourse.itk.org/u/thanuja)
#### Post date: [July 27, 2024, 4:44am UTC](https://discourse.itk.org/t/build-and-install-simpleitk-with-simpleitk-use-elastix-option-in-linux-environment/7128/7 "2024-07-27T04:44:24Z")

</div>

@blowekamp I am able to build v2.3.0 source code but 6 tests are failing when executing command:

```auto
cd SimpleITK-build/SimpleITK-build
ctest .

```

Please refer below:

```auto
99% tests passed, 6 tests failed out of 2756

Label Time Summary:
Lua = 353.65 sec*proc (536 tests)
Python = 728.56 sec*proc (590 tests)
Ruby = 484.63 sec*proc (535 tests)
Tcl = 207.89 sec*proc (534 tests)

Total Test time (real) = 3051.67 sec

The following tests FAILED:
	673 - Lua.ConfidenceConnectedImageFilter.3d (Failed)
	695 - Lua.ConnectedThresholdImageFilter.2d (Failed)
	696 - Lua.ConnectedThresholdImageFilter.2dwconnectivity (Failed)
	1850 - Lua.NeighborhoodConnectedImageFilter.2d (Failed)
	2545 - Lua.VectorConfidenceConnectedImageFilter.VM_segmentation (Failed)
	2668 - Python.Test.ConcurrentImageRead (SEGFAULT)
Errors while running CTest
Output from these tests are in: /home/uruththi/scratch/SimpleITK/SimpleITK-build/SimpleITK-build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.

```

Is there any additional command to install the binary after the build? I couldn’t import SimpleITK.

Thank you!

---

<div class="post-metadata">

### Author: ![thanuja](https://discourse.itk.org/letter_avatar_proxy/v4/letter/t/b487fb/32.png) [@thanuja](https://discourse.itk.org/u/thanuja)
#### Post date: [July 28, 2024, 12:36am UTC](https://discourse.itk.org/t/build-and-install-simpleitk-with-simpleitk-use-elastix-option-in-linux-environment/7128/8 "2024-07-28T00:36:45Z")

</div>

Sorry that I have not checked the [installation](https://simpleitk.readthedocs.io/en/master/building.html#installation-from-build-tree) part. Everything works fine for the v2.3.0 version.

Thank you!

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [July 29, 2024, 1:11pm UTC](https://discourse.itk.org/t/build-and-install-simpleitk-with-simpleitk-use-elastix-option-in-linux-environment/7128/9 "2024-07-29T13:11:28Z")

</div>

> [@thanuja](#):
>
> `Python.Test.ConcurrentImageRead`

The `Python.Test.ConcurrentImageRead` test is known to be unstable on some systems, most likely related it internal ITK concurrent issues.

The Lua failures do not look familiar and the output would need to be inspected for the reason of the failures.

> [@thanuja](#):
>
> Sorry that I have not checked the [installation](https://simpleitk.readthedocs.io/en/master/building.html#installation-from-build-tree) part. Everything works fine for the v2.3.0 version.

Glad to hear you have it working.
