# Error While Linking with Anari Library

**URL:** <https://discourse.vtk.org/t/error-while-linking-with-anari-library/13947>\
**Category:** Development\
**Created:** [May 28, 2024, 1:57am UTC](https://discourse.vtk.org/t/error-while-linking-with-anari-library/13947 "2024-05-28T01:57:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafael\_Scatena](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rafael_scatena/32/7820_2.png) [@Rafael\_Scatena](https://discourse.vtk.org/u/Rafael_Scatena)\
**Post date:** [May 28, 2024, 1:57am UTC](https://discourse.vtk.org/t/error-while-linking-with-anari-library/13947/1 "2024-05-28T01:57:33Z")

</div>

Hello,

I get this error while I try to perform a render pass with anari and then render:

```
2024-05-27 22:34:34.125 ( 70.237s) [7F3A0625F5C0]vtkAnariRendererNode.cx:603 ERR| [ANARI::FATAL] 'environment' library selected but ANARI_LIBRARY is not set

```

I don’t know why he is asking for the environmental variable…

I don’t know exaclty how to set the cmakelists file when using Anari, so I set this way.

```
     set(ANARI_LIBRARY_DIR "/home/3484681/miniconda3/envs/vtkenv/vtk-master/Anari Master/Anari-09/lib")

    # Specify the Anari library name
    set(ANARI_LIBRARY_NAME "anari")

    # Construct the full path to the Anari library file
    set(ANARI_LIBRARY "${ANARI_LIBRARY_DIR}/lib${ANARI_LIBRARY_NAME}.so.0")

    # Check if the Anari library file exists
    if(NOT EXISTS ${ANARI_LIBRARY})
        message(FATAL_ERROR "Anari library not found: ${ANARI_LIBRARY}")
    endif()

  target_link_libraries(PRISMAMESH PRIVATE ${VTK_LIBRARIES} ${ITK_LIBRARIES} ${OPENGL_LIBRARIES} ${Boost_LIBRARIES} ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY} fmt::fmt ${ANARI_LIBRARY}) 

```

Thank you,

Rafael Scatena

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [May 28, 2024, 7:56pm UTC](https://discourse.vtk.org/t/error-while-linking-with-anari-library/13947/2 "2024-05-28T19:56:24Z")

</div>

Hello,

What are doing exactly? Configure the build? Build the program? Run the program?

best,

PC

---

<div class="post-metadata">

**Author:** ![Rafael\_Scatena](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rafael_scatena/32/7820_2.png) [@Rafael\_Scatena](https://discourse.vtk.org/u/Rafael_Scatena)\
**Post date:** [May 29, 2024, 1:33am UTC](https://discourse.vtk.org/t/error-while-linking-with-anari-library/13947/3 "2024-05-29T01:33:20Z")

</div>

> [@Paulo\_Carvalho](#):
>
> What are doing exactly? Configure the build? Build the program? Run the program

The program crashes when the render pass is made. I says it can’t locate libanari.so.0

---

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [May 31, 2024, 2:24pm UTC](https://discourse.vtk.org/t/error-while-linking-with-anari-library/13947/4 "2024-05-31T14:24:03Z")

</div>

In which directory is `libanari.so.0` installed?

---

<div class="post-metadata">

**Author:** ![jaswantp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/jaswantp/32/10046_2.png) [@jaswantp](https://discourse.vtk.org/u/jaswantp)\
**Post date:** [June 3, 2024, 1:44pm UTC](https://discourse.vtk.org/t/error-while-linking-with-anari-library/13947/5 "2024-06-03T13:44:27Z")

</div>

> [@Rafael\_Scatena](#):
>
> Hello,
> 
> I get this error while I try to perform a render pass with anari and then render:
> 
> ```auto
> 2024-05-27 22:34:34.125 ( 70.237s) [7F3A0625F5C0]vtkAnariRendererNode.cx:603 ERR| [ANARI::FATAL] 'environment' library selected but ANARI_LIBRARY is not set
> 
> ```

It says that an anari implementation was not specified in your shell environment. You can try this.

```sh
# this can be visrtx, visgl or helide (software implementation)
export ANARI_LIBRARY=helide

```

And make sure `libanari_library_helide.so` or `libanari_library_<name_of_implementation>.so` can be discovered in your `LD_LIBRARY_PATH`

As an aside, I highly suggest checking whether you can run a simple anari viewer from [GitHub - KhronosGroup/ANARI-SDK at main](https://github.com/KhronosGroup/ANARI-SDK/tree/main?tab=readme-ov-file#running-the-examples).
