arrayfire: [Build]Undefined reference to afcu_set_native_id

Error while trying to build the program.

Description

I’m trying to use the setNativeId function from af/cuda.h. but Cmake can not find any reference to that function. I’m including correctly the af/cuda.h file in C++, so i think the issue is in Cmake. Cmake gets /opt/arrayfire/include included, but it still doesn’t work properly. My AF Version is 3.6.2. I don’t know if i need some additional headers for this function. I also tried to include /opt/arrayfire/include/af/cuda.h as an additional path, but it also failed.

Error Log

develop@f8d1de7629c9:/workspaces/fiber/Debug> cmake .. -DBUILD_CUDA=ON
Disabling BUILD_NIGHTLY_TESTS due to BUILD_TESTS
-- Found libaf : ArrayFire::afcuda
-- ArrayFire Include Dir /opt/arrayfire/include
Enabled building tests
Enabled building matio due to building tests
-- Found PythonInterp: /usr/bin/python (found suitable version "3.4.6", minimum required is "3") 
Build Test spot
Build Test alpha
Build Test interpolation
Build Test ioMatlab
Build Test param
Build Test pmd
Build Test raman
Build Test smf_ssfm
Build Test stepSizeDistribution
Build Test utility
Build Test fiber
 ##### Final Configuration ##### 
SPOT_VERSION : v3.2-76-g351b46a
CMAKE_BUILD_TYPE : DEBUG
BUILD_MATLAB : ON
BUILD_TESTS : ON
BUILD_NIGHTLY_TESTS : OFF
BUILD_SINGLETEST : 
BUILD_PYTHON : ON
BUILD_MATIO : ON
BUILD_CUDA : ON
CIRUNNER : OFF
TEST_GPU : OFF
BENCHMARK_LINEAR : ON
BENCHMARK_NONLINEAR : ON
 ##### End of Configuration ##### 
/opt/arrayfire/include
-- Found MatLibs
-- Found libmatio : /usr/local/lib/libmatio.so
-- Found PythonInterp: /usr/bin/python (found version "3.4.6") 
-- Configuring done
-- Generating done
-- Build files have been written to: /workspaces/fiber/Debug
develop@f8d1de7629c9:/workspaces/fiber/Debug> make -j8
[  0%] Built target header_obj
Scanning dependencies of target source_obj
[  2%] Built target cuda_kernels
[  9%] Built target gmock_main
[  5%] Built target gmock
[ 21%] Built target gtest
[ 25%] Built target obj
[ 27%] Built target gtest_main
[ 42%] Built target test_obj
Scanning dependencies of target cuda_kernel
[ 43%] Building Fortran object CMakeFiles/source_obj.dir/src/bvp_solver/BVP_M-2.f90.o
[ 44%] Linking CXX executable interpolation
[ 45%] Linking CXX executable ioMatlab
[ 46%] Linking CXX executable pmd
[ 47%] Linking CXX executable smf_ssfm
[ 48%] Linking CXX executable alpha
[ 50%] Building CXX object test/cuda/CMakeFiles/cuda_kernel.dir/cuda_kernels.cpp.o
[ 51%] Linking CXX executable param
f951: Warning: Nonexistent include directory '/usr/include/eigen3' [-Wmissing-include-dirs]
f951: Fatal Error: '/opt/arrayfire/include/af/cuda.h' is not a directory
compilation terminated.
CMakeFiles/source_obj.dir/build.make:166: recipe for target 'CMakeFiles/source_obj.dir/src/bvp_solver/BVP_M-2.f90.o' failed
make[2]: *** [CMakeFiles/source_obj.dir/src/bvp_solver/BVP_M-2.f90.o] Error 1
CMakeFiles/Makefile2:109: recipe for target 'CMakeFiles/source_obj.dir/all' failed
make[1]: *** [CMakeFiles/source_obj.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/test_obj.dir/__/src/param.cpp.o: in function `afcu::setNativeId(int)':
/opt/arrayfire/include/af/cuda.h:115: undefined reference to `afcu_set_native_id'
collect2: error: ld returned 1 exit status
test/CMakeFiles/alpha.dir/build.make:166: recipe for target 'test/alpha' failed
make[2]: *** [test/alpha] Error 1
CMakeFiles/Makefile2:544: recipe for target 'test/CMakeFiles/alpha.dir/all' failed
make[1]: *** [test/CMakeFiles/alpha.dir/all] Error 2
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/test_obj.dir/__/src/param.cpp.o: in function `afcu::setNativeId(int)':
/opt/arrayfire/include/af/cuda.h:115: undefined reference to `afcu_set_native_id'
collect2: error: ld returned 1 exit status
test/CMakeFiles/interpolation.dir/build.make:166: recipe for target 'test/interpolation' failed
make[2]: *** [test/interpolation] Error 1
CMakeFiles/Makefile2:387: recipe for target 'test/CMakeFiles/interpolation.dir/all' failed
make[1]: *** [test/CMakeFiles/interpolation.dir/all] Error 2
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/test_obj.dir/__/src/param.cpp.o: in function `afcu::setNativeId(int)':
/opt/arrayfire/include/af/cuda.h:115: undefined reference to `afcu_set_native_id'
collect2: error: ld returned 1 exit status
test/CMakeFiles/ioMatlab.dir/build.make:166: recipe for target 'test/ioMatlab' failed
make[2]: *** [test/ioMatlab] Error 1
CMakeFiles/Makefile2:307: recipe for target 'test/CMakeFiles/ioMatlab.dir/all' failed
make[1]: *** [test/CMakeFiles/ioMatlab.dir/all] Error 2
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/test_obj.dir/__/src/param.cpp.o: in function `afcu::setNativeId(int)':
/opt/arrayfire/include/af/cuda.h:115: undefined reference to `afcu_set_native_id'
collect2: error: ld returned 1 exit status
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/test_obj.dir/__/src/param.cpp.o: in function `afcu::setNativeId(int)':
/opt/arrayfire/include/af/cuda.h:115: undefined reference to `afcu_set_native_id'
collect2: error: ld returned 1 exit status
test/CMakeFiles/pmd.dir/build.make:166: recipe for target 'test/pmd' failed
make[2]: *** [test/pmd] Error 1
CMakeFiles/Makefile2:347: recipe for target 'test/CMakeFiles/pmd.dir/all' failed
make[1]: *** [test/CMakeFiles/pmd.dir/all] Error 2
test/CMakeFiles/smf_ssfm.dir/build.make:166: recipe for target 'test/smf_ssfm' failed
make[2]: *** [test/smf_ssfm] Error 1
CMakeFiles/Makefile2:427: recipe for target 'test/CMakeFiles/smf_ssfm.dir/all' failed
make[1]: *** [test/CMakeFiles/smf_ssfm.dir/all] Error 2
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/test_obj.dir/__/src/param.cpp.o: in function `afcu::setNativeId(int)':
/opt/arrayfire/include/af/cuda.h:115: undefined reference to `afcu_set_native_id'
collect2: error: ld returned 1 exit status
test/CMakeFiles/param.dir/build.make:166: recipe for target 'test/param' failed
make[2]: *** [test/param] Error 1
CMakeFiles/Makefile2:467: recipe for target 'test/CMakeFiles/param.dir/all' failed
make[1]: *** [test/CMakeFiles/param.dir/all] Error 2
[ 52%] Linking CUDA device code CMakeFiles/cuda_kernel.dir/cmake_device_link.o
[ 53%] Linking CXX executable cuda_kernel
/usr/lib64/gcc/x86_64-suse-linux/6/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/obj.dir/__/__/src/param.cpp.o: in function `afcu::setNativeId(int)':
/opt/arrayfire/include/af/cuda.h:115: undefined reference to `afcu_set_native_id'
collect2: error: ld returned 1 exit status
test/cuda/CMakeFiles/cuda_kernel.dir/build.make:162: recipe for target 'test/cuda/cuda_kernel' failed
make[2]: *** [test/cuda/cuda_kernel] Error 1
CMakeFiles/Makefile2:932: recipe for target 'test/cuda/CMakeFiles/cuda_kernel.dir/all' failed
make[1]: *** [test/cuda/CMakeFiles/cuda_kernel.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2

Build Environment

Compiler version: gcc 6.3.0 Operating system: Debian GNU/Linux 9.13 Build environment: CMake variables: cmake … -DBUILD_CUDA=ON

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 30 (16 by maintainers)

Most upvoted comments

I will do this as soon as possible. Thanks for your help. The next days I will not have a lot of time because I’m writing an exam on Thursday and one at the beginning of march. Is it okay for you, if I keep this issue open and I will contact you when i start working again on it?