CUDNN Static Linking Error

Hi,
I have installed CUDA 9.1 and cuDNN v7.1.3. I want to link my application against cudnn_static.a.

My build system is based on cmake.

The build goes fine, but at the time of linking - I’m seeing these errors

[100%] Linking CXX executable Deepsight_Face/dsFace
/usr/local/cuda/lib64/libcudnn_static.a(cudnn.o): In function `InitCULIBOS()':
cudnn.cpp:(.text+0xb90): undefined reference to `culibosInit'
cudnn.cpp:(.text+0xb9b): undefined reference to `culibosInitializeCriticalSection'
cudnn.cpp:(.text+0xba4): undefined reference to `culibosInitializeCriticalSection'
cudnn.cpp:(.text+0xbad): undefined reference to `culibosInitializeCriticalSection'

How to fix this issue. Please help.

This is the findcudnn.cmake code:

SET(CUDNN_LIBNAME "cudnn_static")

find_path(CUDNN_INCLUDE_DIR cudnn.h
    HINTS ${CUDNN_ROOT_DIR} ${CUDA_TOOLKIT_ROOT_DIR}
    PATH_SUFFIXES cuda/include include)

find_library(CUDNN_LIBRARY ${CUDNN_LIBNAME}
    HINTS ${CUDNN_ROOT_DIR} ${CUDA_TOOLKIT_ROOT_DIR}
    PATH_SUFFIXES lib lib64 cuda/lib cuda/lib64 lib/x64)

Forget it, I had to link against culibos as well. I added this to my findcudnn.cmake and it worked!

set(CUDNN_ROOT_DIR "" CACHE PATH "Folder contains NVIDIA cuDNN")

SET(CUDNN_LIBNAME "cudnn_static")
SET(CULIBOS_LIBNAME "culibos")

find_path(CUDNN_INCLUDE_DIR cudnn.h
    HINTS ${CUDNN_ROOT_DIR} ${CUDA_TOOLKIT_ROOT_DIR}
    PATH_SUFFIXES cuda/include include)

find_library(CUDNN_LIBRARY ${CUDNN_LIBNAME}
    HINTS ${CUDNN_ROOT_DIR} ${CUDA_TOOLKIT_ROOT_DIR}
    PATH_SUFFIXES lib lib64 cuda/lib cuda/lib64 lib/x64)
    
find_library(CULIBOS_LIBRARY ${CULIBOS_LIBNAME}
    HINTS ${CUDNN_ROOT_DIR} ${CUDA_TOOLKIT_ROOT_DIR}
    PATH_SUFFIXES lib lib64 cuda/lib cuda/lib64 lib/x64)

set(CUDNN_LIBRARIES ${CUDNN_LIBRARY} ${CULIBOS_LIBRARY})