title: nvcc fatal : Unsupported gpu architecture 'compute_30'
body: <p>I am using this GitHub repo <a href="https://github.com/davidstutz/mesh-fusion" rel="nofollow noreferrer">https://github.com/davidstutz/mesh-fusion</a> and I am following its instructions. The error I get after <code>cmake ..</code> is as follows. How should I fix it?</p>
  <pre><code>Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
  </code></pre>
  <p>The error in <code>CMakeError.log</code> is:</p>
  <pre><code>/usr/bin/ld: cannot find -lpthreads
  </code></pre>
  <p>I followed this answer: <a href="https://stackoverflow.com/a/31948969/2414957">https://stackoverflow.com/a/31948969/2414957</a></p>
  <p>I do have the followings:</p>
  <pre><code>$ ls /usr/lib/x86_64-linux-gnu/libpthread.so
  lrwxrwxrwx 1 root root 37 Aug 17 16:02 /usr/lib/x86_64-linux-gnu/libpthread.so -&gt; /lib/x86_64-linux-gnu/libpthread.so.0
  
  $ nm /lib/x86_64-linux-gnu/libpthread.so.0 | grep &quot;pthread_create&quot;
  00000000000098d0 t __pthread_create_2_1
  0000000000007af7 t __pthread_create_2_1.cold
  00000000000098d0 T pthread_create@@GLIBC_2.2.5
  </code></pre>
  <p>I have:</p>
  <pre><code>[3645:3637 0:2047] 10:00:46 Tue Jan 12 [mona@goku:pts/0 +1] ~/mesh-fusion/libfusiongpu/build
  $ cmake ..
  CMake Warning (dev) in CMakeLists.txt:
    No project() command is present.  The top-level CMakeLists.txt file must
    contain a literal, direct call to the project() command.  Add a line of
    code such as
  
      project(ProjectName)
  
    near the top of the file, but after cmake_minimum_required().
  
    CMake is pretending there is a &quot;project(Project)&quot; command on the first
    line.
  This warning is for project developers.  Use -Wno-dev to suppress it.
  
  -- The C compiler identification is GNU 9.3.0
  -- The CXX compiler identification is GNU 9.3.0
  -- Check for working C compiler: /usr/bin/cc
  -- Check for working C compiler: /usr/bin/cc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Looking for pthread.h
  -- Looking for pthread.h - found
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
  -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
  -- 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: /usr/local/cuda-11.2 (found suitable version &quot;11.2&quot;, minimum required is &quot;6.5&quot;) 
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /home/mona/mesh-fusion/libfusiongpu/build
  </code></pre>
  <p>The <code>CMakeError.log</code> is:</p>
  <pre><code>[3645:3637 0:2051] 10:03:13 Tue Jan 12 [mona@goku:pts/0 +1] ~/mesh-fusion/libfusiongpu/build/CMakeFiles
  $ cat CMakeError.log 
  Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
  Change Dir: /home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp
  
  Run Build Command(s):/usr/bin/make cmTC_d8db1/fast &amp;&amp; /usr/bin/make -f CMakeFiles/cmTC_d8db1.dir/build.make CMakeFiles/cmTC_d8db1.dir/build
  make[1]: Entering directory '/home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp'
  Building C object CMakeFiles/cmTC_d8db1.dir/src.c.o
  /usr/bin/cc   -DCMAKE_HAVE_LIBC_PTHREAD   -o CMakeFiles/cmTC_d8db1.dir/src.c.o   -c /home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp/src.c
  Linking C executable cmTC_d8db1
  /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d8db1.dir/link.txt --verbose=1
  /usr/bin/cc  -DCMAKE_HAVE_LIBC_PTHREAD    -rdynamic CMakeFiles/cmTC_d8db1.dir/src.c.o  -o cmTC_d8db1 
  /usr/bin/ld: CMakeFiles/cmTC_d8db1.dir/src.c.o: in function `main':
  src.c:(.text+0x46): undefined reference to `pthread_create'
  /usr/bin/ld: src.c:(.text+0x52): undefined reference to `pthread_detach'
  /usr/bin/ld: src.c:(.text+0x63): undefined reference to `pthread_join'
  collect2: error: ld returned 1 exit status
  make[1]: *** [CMakeFiles/cmTC_d8db1.dir/build.make:87: cmTC_d8db1] Error 1
  make[1]: Leaving directory '/home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp'
  make: *** [Makefile:121: cmTC_d8db1/fast] Error 2
  
  
  Source file was:
  #include &lt;pthread.h&gt;
  
  void* test_func(void* data)
  {
    return data;
  }
  
  int main(void)
  {
    pthread_t thread;
    pthread_create(&amp;thread, NULL, test_func, NULL);
    pthread_detach(thread);
    pthread_join(thread, NULL);
    pthread_atfork(NULL, NULL, NULL);
    pthread_exit(NULL);
  
    return 0;
  }
  
  Determining if the function pthread_create exists in the pthreads failed with the following output:
  Change Dir: /home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp
  
  Run Build Command(s):/usr/bin/make cmTC_4d856/fast &amp;&amp; /usr/bin/make -f CMakeFiles/cmTC_4d856.dir/build.make CMakeFiles/cmTC_4d856.dir/build
  make[1]: Entering directory '/home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp'
  Building C object CMakeFiles/cmTC_4d856.dir/CheckFunctionExists.c.o
  /usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_4d856.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.16/Modules/CheckFunctionExists.c
  Linking C executable cmTC_4d856
  /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_4d856.dir/link.txt --verbose=1
  /usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_4d856.dir/CheckFunctionExists.c.o  -o cmTC_4d856  -lpthreads 
  /usr/bin/ld: cannot find -lpthreads
  collect2: error: ld returned 1 exit status
  make[1]: *** [CMakeFiles/cmTC_4d856.dir/build.make:87: cmTC_4d856] Error 1
  make[1]: Leaving directory '/home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/CMakeTmp'
  make: *** [Makefile:121: cmTC_4d856/fast] Error 2
  </code></pre>
  <p>I have:</p>
  <pre><code>$ lsb_release -a
  LSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
  Distributor ID: Ubuntu
  Description:    Ubuntu 20.04.1 LTS
  Release:    20.04
  Codename:   focal
  </code></pre>
  <p>Here's the <code>CMakeLists.txt</code> file (I added the first two lines):</p>
  <pre><code>cmake_minimum_required (VERSION 2.8.7) ## added by mona
  find_package(Threads) ## added by mona
  
  cmake_minimum_required(VERSION 2.8)
  set(CMAKE_CXX_STANDARD 11)
  
  # set(CMAKE_BUILD_TYPE Debug)
  set(CMAKE_BUILD_TYPE Release)
  set(CMAKE_C_FLAGS &quot;${CMAKE_C_FLAGS} -msse -msse2 -msse3 -msse4.2 -fPIC&quot;)
  set(CMAKE_CXX_FLAGS &quot;${CMAKE_CXX_FLAGS} -msse -msse2 -msse3 -msse4.2 -fPIC&quot;)
  
  find_package(CUDA 6.5 REQUIRED)
  set(CUDA_NVCC_FLAGS &quot;${CUDA_NVCC_FLAGS};-std=c++11&quot;)
  set(CMAKE_CXX_FLAGS &quot;${CMAKE_CXX_FLAGS} -D_FORCE_INLINES -Wall&quot;)
  
  set(CUDA_NVCC_FLAGS &quot;${CUDA_NVCC_FLAGS}; -gencode=arch=compute_30,code=sm_30&quot;)
  set(CUDA_NVCC_FLAGS &quot;${CUDA_NVCC_FLAGS}; -gencode=arch=compute_30,code=compute_30&quot;)
  
  set(FUSION_GPU_SRC
    fusion.cu
    fusion_zach_tvl1.cu
  )
  
  cuda_add_library(fusion_gpu SHARED ${FUSION_GPU_SRC})
  target_link_libraries(fusion_gpu ${CUDA_LIBRARIES})
  </code></pre>
  <p>Later, if I run the <code>make</code> command I'll get this error:</p>
  <pre><code>[3645:3637 0:2070] 10:33:37 Tue Jan 12 [mona@goku:pts/0 +1] ~/mesh-fusion/libfusiongpu/build
  $ make
  [ 33%] Building NVCC (Device) object CMakeFiles/fusion_gpu.dir/fusion_gpu_generated_fusion_zach_tvl1.cu.o
  nvcc fatal   : Unsupported gpu architecture 'compute_30'
  CMake Error at fusion_gpu_generated_fusion_zach_tvl1.cu.o.Release.cmake:220 (message):
    Error generating
    /home/mona/mesh-fusion/libfusiongpu/build/CMakeFiles/fusion_gpu.dir//./fusion_gpu_generated_fusion_zach_tvl1.cu.o
  
  
  make[2]: *** [CMakeFiles/fusion_gpu.dir/build.make:72: CMakeFiles/fusion_gpu.dir/fusion_gpu_generated_fusion_zach_tvl1.cu.o] Error 1
  make[1]: *** [CMakeFiles/Makefile2:75: CMakeFiles/fusion_gpu.dir/all] Error 2
  make: *** [Makefile:84: all] Error 2
  </code></pre>