Skip to content

Instantly share code, notes, and snippets.

@FictionIO
Created August 18, 2017 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FictionIO/e89384c1305cb23bcf949c7f125006a1 to your computer and use it in GitHub Desktop.
Save FictionIO/e89384c1305cb23bcf949c7f125006a1 to your computer and use it in GitHub Desktop.
CMakeLinkerError
-- The CXX compiler identification is GNU 4.9.1
-- The CUDA compiler identification is NVIDIA 8.0.61
-- Check for working CXX compiler: /builds/gcc/4.9.1/d9048547a5/bin/c++
-- Check for working CXX compiler: /builds/gcc/4.9.1/d9048547a5/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working CUDA compiler: /builds/cuda/8.0.61/1acc13fe21/bin/nvcc
-- Check for working CUDA compiler: /builds/cuda/8.0.61/1acc13fe21/bin/nvcc -- works
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Found OpenGL: /usr/lib64/libGL.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib64/libX11.so
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /builds/cuda/8.0.61/1acc13fe21 (found version "8.0")
-- Configuring done
-- Generating done
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
project(MYLIB VERSION ${MYLIB_VERSION} LANGUAGES CXX CUDA)
enable_testing()
# Silence warnings about Compute 2.0 deprecation
add_definitions("-Wno-deprecated-gpu-targets")
# Enable RDC
string(APPEND CMAKE_CUDA_FLAGS " -rdc=true")
# Generate Cuda gencode
# Ref http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-compilation
# Ref http://docs.nvidia.com/cuda/cuda-c-programming-guide/#features-and-technical-specifications
# Ref http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#compute-capability
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_62,code=sm_62")
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_61,code=sm_61")
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_60,code=sm_60")
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_53,code=sm_53")
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_52,code=sm_52")
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_50,code=sm_50")
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_35,code=sm_35")
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_30,code=sm_30")
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_20,code=sm_20")
# Intermediate/JIT code generated architectures:
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_60,code=compute_60")
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_50,code=compute_50")
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_30,code=compute_30")
string(APPEND CMAKE_CUDA_FLAGS " -gencode=arch=compute_20,code=compute_20")
set(CXX_LANG "$<COMPILE_LANGUAGE:CXX>")
set(CUDA_LANG "$<COMPILE_LANGUAGE:CUDA>")
file(GLOB_RECURSE CPP_LIB_SOURCES src/*.cpp)
file(GLOB_RECURSE CUDA_LIB_SOURCES src/*.cu)
add_library(MYLIB ${CPP_LIB_SOURCES} ${CUDA_LIB_SOURCES})
target_compile_features(MYLIB PUBLIC cxx_std_11)
set_target_properties(MYLIB PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
set_target_properties(MYLIB PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON)
set_target_properties(MYLIB PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_compile_options( MYLIB
PRIVATE
$<${CXX_LANG}:$<BUILD_INTERFACE:-Wall>>
$<${CUDA_LANG}:$<BUILD_INTERFACE:-Xcompiler=-Wall --expt-relaxed-constexpr>>)
target_include_directories(MYLIB PRIVATE src/)
target_link_libraries(MYLIB pthread dl z)
install(TARGETS MYLIB DESTINATION lib)
install(DIRECTORY src/ DESTINATION "include/" FILES_MATCHING PATTERN "*.h")
[ 76%] Linking CUDA device code CMakeFiles/MYLIB.dir/cmake_device_link.o
/builds/cmake/3.9.0/b1120ec06b/bin/cmake -E cmake_link_script CMakeFiles/MYLIB.dir/dlink.txt --verbose=1
/builds/cuda/8.0.61/1acc13fe21/bin/nvcc -rdc=true -gencode=arch=compute_62,code=sm_62 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_53,code=sm_53 -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_60,code=compute_60 -gencode=arch=compute_50,code=compute_50 -gencode=arch=compute_30,code=compute_30 -gencode=arch=compute_20,code=compute_20 -O2 -g -DNDEBUG -Xcompiler=-fPIC -Wno-deprecated-gpu-targets -shared -dlink CMakeFiles/MYLIB.dir/src/MYLIB/UTILS.cpp.o CMakeFiles/MYLIB.dir/src/MYLIB/MKernels.cu.o CMakeFiles/MYLIB.dir/src/MYLIB/RKernels.cu.o -o CMakeFiles/MYLIB.dir/cmake_device_link.o -L/builds/cuda/8.0.61/1acc13fe21/lib64/stubs
nvlink error : Undefined reference to 'cudaEventDestroy' in 'CMakeFiles/MYLIB.dir/src/MYLIB/MKernels.cu.o' (target: sm_53)
nvlink error : Undefined reference to 'cudaGetErrorString' in 'CMakeFiles/MYLIB.dir/src/MYLIB/MKernels.cu.o' (target: sm_53)
nvlink error : Undefined reference to 'cudaStreamDestroy' in 'CMakeFiles/MYLIB.dir/src/MYLIB/MKernels.cu.o' (target: sm_53)
nvlink error : Undefined reference to 'cudaGetParameterBuffer' in 'CMakeFiles/MYLIB.dir/src/MYLIB/MKernels.cu.o' (target: sm_53)
nvlink error : Undefined reference to 'cudaLaunchDevice' in 'CMakeFiles/MYLIB.dir/src/MYLIB/MKernels.cu.o' (target: sm_53)
nvlink error : Undefined reference to 'cudaDeviceSynchronize' in 'CMakeFiles/MYLIB.dir/src/MYLIB/MKernels.cu.o' (target: sm_53)
nvlink error : Undefined reference to 'cudaEventCreateWithFlags' in 'CMakeFiles/MYLIB.dir/src/MYLIB/MKernels.cu.o' (target: sm_53)
nvlink error : Undefined reference to 'cudaEventRecord' in 'CMakeFiles/MYLIB.dir/src/MYLIB/MKernels.cu.o' (target: sm_53)
make[2]: *** [CMakeFiles/MYLIB.dir/cmake_device_link.o] Error 255
make[2]: Leaving directory `/user_data/RND/dev/MYLIB/build/'
make[1]: *** [CMakeFiles/MYLIB.dir/all] Error 2
make[1]: Leaving directory `/user_data/RND/dev/MYLIB/build/'
make: *** [all] Error 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment