dimanche 28 juin 2015

Cuda CMake : undefined reference

I am trying to compile my project with cmake, but it's difficult... My project compile with one simple make, but not with cmake. The error is during the link. CMake prefers launch g++ ... -o ... instead of nvcc ... -o .... If I force nvcc, the error is -rdynamic is unknown.

So, it's my cmake file

cmake_minimum_required(VERSION 2.8)
project(LightRays)

find_package(CUDA QUIET REQUIRED)

list(APPEND CUDA_NVCC_FLAGS "-std=c++11;-rdc=true")

file(GLOB_RECURSE
        source_file
        src/*
        include/*)


CUDA_ADD_EXECUTABLE(LightRays ${source_file})

target_link_libraries(LightRays -lSDL -L/opt/cuda/lib64 -lcuda -lcudart)

add_definitions(-std=c++11)

target_link_libraries(LightRays -lSDL -L/opt/cuda/lib64 -lcuda -lcudart)

add_definitions(-std=c++11)

and here errors :

/tmp/tmpxft_00006509_00000000-4_global.cudafe1.stub.c:8: référence indéfinie vers « __cudaRegisterLinkedBinary_41_tmpxft_00006509_00000000_7_global_cpp1_ii_0ad406bb »
CMakeFiles/http://ift.tt/1NpeY9G: dans la fonction « __sti____cudaRegisterAll_40_tmpxft_00006518_00000000_7_tools_cpp1_ii_278b9139() »:
....

Thanks for all and sorry for english...

Aucun commentaire:

Enregistrer un commentaire