# Possible to compile against a conda install ITK?

**URL:** https://discourse.itk.org/t/possible-to-compile-against-a-conda-install-itk/4319
**Category:** Engineering
**Created:** [August 6, 2021, 1:53pm UTC](https://discourse.itk.org/t/possible-to-compile-against-a-conda-install-itk/4319 "2021-08-06T13:53:05Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![imikejackson](https://discourse.itk.org/user_avatar/discourse.itk.org/imikejackson/32/35_2.png) [@imikejackson](https://discourse.itk.org/u/imikejackson)
#### Post date: [August 6, 2021, 1:53pm UTC](https://discourse.itk.org/t/possible-to-compile-against-a-conda-install-itk/4319/1 "2021-08-06T13:53:05Z")

</div>

I have installed ITK 5.0 using conda install libitk libitk-devel

I’m now trying to compile a c++ code against that version of ITK but I get:

```auto
In file included from /opt/local/anaconda3/envs/dream3d/include/ITK-5.0/itkImageToImageFilter.h:31:
In file included from /opt/local/anaconda3/envs/dream3d/include/ITK-5.0/itkImageSource.h:31:
In file included from /opt/local/anaconda3/envs/dream3d/include/ITK-5.0/itkProcessObject.h:31:
In file included from /opt/local/anaconda3/envs/dream3d/include/ITK-5.0/itkDataObject.h:31:
In file included from /opt/local/anaconda3/envs/dream3d/include/ITK-5.0/itkObject.h:31:
In file included from /opt/local/anaconda3/envs/dream3d/include/ITK-5.0/itkLightObject.h:21:
In file included from /opt/local/anaconda3/envs/dream3d/include/ITK-5.0/itkMacro.h:42:
In file included from /opt/local/anaconda3/envs/dream3d/include/ITK-5.0/itkConfigure.h:22:
/opt/local/anaconda3/envs/dream3d/include/ITK-5.0/itk_compiler_detection.h:158:6: error: Unsupported compiler
# error Unsupported compiler

```

The offending lines in itk\_compiler\_detection.h is:

# if ITK\_COMPILER\_IS\_Clang

# include “compilers/ITK\_COMPILER\_INFO\_Clang\_CXX.h”

# else

# error Unsupported compiler

# endif

I am on macOS 10.15.x Catalina using Xcode tools.

```auto
(dream3d) 1037:[mjackson@Jolder:Release]% clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

```

Any thoughts or ideas?

---

<div class="post-metadata">

### Author: ![imikejackson](https://discourse.itk.org/user_avatar/discourse.itk.org/imikejackson/32/35_2.png) [@imikejackson](https://discourse.itk.org/u/imikejackson)
#### Post date: [August 6, 2021, 2:24pm UTC](https://discourse.itk.org/t/possible-to-compile-against-a-conda-install-itk/4319/2 "2021-08-06T14:24:41Z")

</div>

Just to add a bit more to this I _think_ the issue is that conda-forge is not using Xcode to compile but and external LLVM/Clang toolkit. When this is used ITK will generate the following code from a macro:

```auto
# if ITK_COMPILER_IS_Clang

# include "compilers/ITK_COMPILER_INFO_Clang_CXX.h"

# else
# error Unsupported compiler
# endif

```

but then we come along and are trying to compile with Xcode and we error out. If we actually had compiled ITK with Xcode then the following code is produced:

```auto

# if ITK_COMPILER_IS_AppleClang

# include "compilers/ITK_COMPILER_INFO_AppleClang_CXX.h"

# else
# error Unsupported compiler
# endif

```

We can’t even just forcibly define ITK\_COMPILER\_IS\_Clang because that gets wiped out at the top of the itk\_compiler\_detection.h file. So thoughts on this? Should I file some sort of a bug? Can I compile the anaconda package version of ITK myself and install it into my conda environment so I can get the proper defines?

Thanks

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [August 6, 2021, 2:43pm UTC](https://discourse.itk.org/t/possible-to-compile-against-a-conda-install-itk/4319/3 "2021-08-06T14:43:20Z")

</div>

Mixing compilers proved to be problematic in the past, so that safeguard was added. I don’t use conda, so I don’t know whether you can make it use AppleClang instead of LLVM Clang.

---

<div class="post-metadata">

### Author: ![imikejackson](https://discourse.itk.org/user_avatar/discourse.itk.org/imikejackson/32/35_2.png) [@imikejackson](https://discourse.itk.org/u/imikejackson)
#### Post date: [August 6, 2021, 4:53pm UTC](https://discourse.itk.org/t/possible-to-compile-against-a-conda-install-itk/4319/4 "2021-08-06T16:53:46Z")

</div>

I’m not sure what compiler conda is using for their builds. We are using the precompiled ITK that is found on conda-forge. From the looks of it they seem to be using some version of clang.

For now I’m going to go done the path of “mixing” compilers although I’m pretty sure that isn’t going to work out in the end as there are some subtle differences between Apple clang and normal clang.

Thanks for the feedback.

---

<div class="post-metadata">

### Author: ![imikejackson](https://discourse.itk.org/user_avatar/discourse.itk.org/imikejackson/32/35_2.png) [@imikejackson](https://discourse.itk.org/u/imikejackson)
#### Post date: [August 6, 2021, 6:18pm UTC](https://discourse.itk.org/t/possible-to-compile-against-a-conda-install-itk/4319/5 "2021-08-06T18:18:02Z")

</div>

The solution is to use the anaconda supplied compilers:

[https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html](https://docs.conda.io/projects/conda-build/en/latest/resources/compiler-tools.html)
