Skip to content

Instantly share code, notes, and snippets.

@iamcaleberic
Last active May 13, 2017 13:22
Show Gist options
  • Save iamcaleberic/53c5a7ce391e60949234b7ab807bdb53 to your computer and use it in GitHub Desktop.
Save iamcaleberic/53c5a7ce391e60949234b7ab807bdb53 to your computer and use it in GitHub Desktop.
This is a bit of a hack when your default gcc is greater than 6.0.0 and you are compiling arrayfire from source on Arch

So when building arrayfire on Arch you kind of run into the error below if the default gcc version is more than 6.0.0

Make Error: NVCC does not support GCC version 6.0 or greater.

So here is a hack that might help you fix that particular snag.

  • Make sure you intall an alternate version of gcc that is < 6 but > 4.3 in this case gcc-5

  • Make sure you are in the arrayfire directory

     cd path/to/arrayfire
    
  • Modify the CMake configuration file

     nano src/backend/cuda/CMakeLists.txt
    
  • Add this line

     CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
     
     FIND_PACKAGE(CUDA 7.0 REQUIRED)
     set(CMAKE_CXX_COMPILER_VERSION /usr/bin/gcc-5) # this one
     INCLUDE(CLKernelToH)
     INCLUDE(FindNVVM)
     
     OPTION(USE_LIBDEVICE "Use libdevice for CUDA JIT" ON)
     SET(CUDA_LIBDEVICE_DIR "${CUDA_NVVM_HOME}/libdevice" CACHE PATH "Path where lib$
     
     MARK_AS_ADVANCED(
         CUDA_BUILD_CUBIN
         CUDA_BUILD_EMULATION
         CUDA_SDK_ROOT_DIR
         CUDA_VERBOSE_BUILD)
    
  • So basically what that does is point arrayfire to the right compatible compiler. You should be good to go my flags to cmake were

      cmake .. -DCMAKE_BUILD_TYPE=Release BUILD_CUDA=ON
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment