Error While Linking with Anari Library

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

Hello,

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

best,

PC

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

In which directory is libanari.so.0 installed?

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

# 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.