mercredi 28 février 2018

Cmake compile errors. How to linke shared libraries?

I am writing a larger cmake file, where I want to link two shared libraries to a main.

CUDA_ADD_LIBRARY(cudnn_stereo SHARED ${HEADERS} ${SOURCES})
TARGET_LINK_LIBRARIES(cudnn_stereo ${CUDA_LIBRARIES} ${EXTERN_LIBS} cnpy)

cuda_add_library(stereo SHARED ${SRC_STEREO_LIB})
    TARGET_LINK_LIBRARIES(stereo ${IMAGEUTILITIES_LIBRARIES} ${LIBS}
    ${OpenCV_LIBRARIES} ${OpenCV_LIBS} cudnn_stereo ${SLACK_PROP_LIBRARY} ${ITK_LIBRARIES} cnpy png)

cuda_add_executable(stereo_img ${SRC_STEREO_IMG})
TARGET_LINK_LIBRARIES(stereo_img  ${IMAGEUTILITIES_LIBRARIES} ${EXTERN_LIBS} cudnn_stereo  cnpy png)

I created a new folder build. Then, cd build, cmake .. and make -j. I get this errors during compiling:

[ 60%] Linking CXX shared library libstereo.so                                                                                              
[ 80%] Linking CXX executable stereo_img                                                                                                    
[ 80%] Built target stereo                                                                                                                
libcudnn_stereo.so: undefined reference to `error_stream::error_stream(char const*)'                                                                                                                                 
libcudnn_stereo.so: undefined reference to `error_stream::~error_stream()'                                                                     
libcudnn_stereo.so: undefined reference to `typeinfo for error_stream'                                                                      
libcudnn_stereo.so: undefined reference to `error_stream::set_file_line(char const*, int)'                                                                      
libcudnn_stereo.so: undefined reference to `error_stream::error_stream(error_stream const&)'                                                                     
libcudnn_stereo.so: undefined reference to `demangle[abi:cxx11](char const*)'                                                                   
libcudnn_stereo.so: undefined reference to `error_stream::error_stream()'                                                                     
collect2: error: ld returned 1 exit status 

Any ideas, how to get rid of these errors?

Aucun commentaire:

Enregistrer un commentaire