title: Detecting compiler ABI failed by CMAKE
body: <p>There is a CMake project simple enough but not compiling at all with Visual Studio Code. The source:</p>
  <pre><code>// main.cpp
  #include &lt;iostream&gt;
  int main(int argc, char * argv){
      return 0;
  }
  </code></pre>
  <p>The CMakeLists.txt:</p>
  <pre><code>cmake_minimum_required(VERSION 3.0.0)
  project(test VERSION 0.1.0)
  add_executable(test main.cpp)
  </code></pre>
  <p>CMake Tools in vscode build with errors in prompt as below:</p>
  <pre><code>[cmake] -- Detecting C compiler ABI info
  [cmake] -- Detecting C compiler ABI info - failed
  [cmake] -- Check for working C compiler: /bin/gcc-9
  [cmake] -- Check for working C compiler: /bin/gcc-9 - works
  [cmake] -- Detecting C compile features
  [cmake] -- Detecting C compile features - done
  [cmake] CMake Error at /usr/local/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:82 
  (configure_file):
  [cmake]   configure_file Problem configuring file
  [cmake] Call Stack (most recent call first):
  [cmake]   CMakeLists.txt:2 (project)
  [cmake] 
  [cmake] 
  [cmake] -- Detecting CXX compiler ABI info
  [cmake] -- Detecting CXX compiler ABI info - failed
  [cmake] -- Check for working CXX compiler: /bin/g++-9
  [cmake] -- Check for working CXX compiler: /bin/g++-9 - works
  [cmake] -- Detecting CXX compile features
  [cmake] -- Detecting CXX compile features - done
  [cmake] CMake Error at /usr/local/share/cmake-3.18/Modules/CMakeTestCXXCompiler.cmake:75 
  (configure_file):
  [cmake]   configure_file Problem configuring file
  [cmake] Call Stack (most recent call first):
  [cmake]   CMakeLists.txt:2 (project)
  </code></pre>
  <p>The CMakeError.log:</p>
  <pre><code>Cannot copy output executable
  '/data/solution/projects/test/build/CMakeFiles/CMakeTmp/cmTC_efc0d'
  to destination specified by COPY_FILE:
  '/data/solution/projects/test/build/CMakeFiles/3.18.4/CMakeDetermineCompilerABI_C.bin'
  
  Cannot copy output executable
  '/data/solution/projects/test/build/CMakeFiles/CMakeTmp/cmTC_26771'
  to destination specified by COPY_FILE:
  '/data/solution/projects/test/build/CMakeFiles/3.18.4/CMakeDetermineCompilerABI_CXX.bin'
  </code></pre>
  <p>A selection of the CMakeOutput.log:</p>
  <pre><code>The system is: Linux - 5.4.0-52-generic - x86_64
  Compiling the C compiler identification source file &quot;CMakeCCompilerId.c&quot; succeeded.
  Compiler: /bin/gcc-9 
  Build flags: 
  Id flags:  
  
  The output was:
  0
  
  
  Compilation of the C compiler identification source &quot;CMakeCCompilerId.c&quot; produced &quot;a.out&quot;
  
  The C compiler identification is GNU, found in 
  &quot;/data/solution/projects/test/build/CMakeFiles/3.18.4/CompilerIdC/a.out&quot;
  
  Compiling the CXX compiler identification source file &quot;CMakeCXXCompilerId.cpp&quot; succeeded.
  Compiler: /bin/g++-9 
  Build flags: 
  Id flags:  
  
  The output was:
  0
  
  
  Compilation of the CXX compiler identification source &quot;CMakeCXXCompilerId.cpp&quot; produced &quot;a.out&quot;
  
  The CXX compiler identification is GNU, found in 
  &quot;/data/solution/projects/test/build/CMakeFiles/3.18.4/CompilerIdCXX/a.out&quot;
  
  Determining if the C compiler works passed with the following output:
  Change Dir: /data/solution/projects/test/build/CMakeFiles/CMakeTmp
  
  Run Build Command(s):/usr/bin/make cmTC_3f39e/fast &amp;&amp; /usr/bin/make  -f 
  CMakeFiles/cmTC_3f39e.dir/build.make CMakeFiles/cmTC_3f39e.dir/build
  make[1]: Entering directory '/data/solution/projects/test/build/CMakeFiles/CMakeTmp'
  Building C object CMakeFiles/cmTC_3f39e.dir/testCCompiler.c.o
  /bin/gcc-9    -o CMakeFiles/cmTC_3f39e.dir/testCCompiler.c.o -c 
  /data/solution/projects/test/build/CMakeFiles/CMakeTmp/testCCompiler.c
  Linking C executable cmTC_3f39e
  /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3f39e.dir/link.txt --verbose=1
  /bin/gcc-9 -rdynamic CMakeFiles/cmTC_3f39e.dir/testCCompiler.c.o -o cmTC_3f39e 
  make[1]: Leaving directory '/data/solution/projects/test/build/CMakeFiles/CMakeTmp'
  </code></pre>
  <p>The project doesn't build anymore when the OS was upgraded from 18.04 to 20.04 all in a sudden, with later version (9.3) of GCC toolchain. The</p>
  <blockquote>
  <p>a.out</p>
  </blockquote>
  <p>exists under CMAKE building directory, but there is no output executable ABI testing program to copy to anyway, as we can tell from the above logs. Is there anyone to help me finding the real cause? Thank you.</p>
  <p>Solution: OK. There is an issue I could have noted, thanks to a comment. The project is under directory mounted to FAT32 file system where permission settings are tricky to configure. A correct /etc/fstab file:</p>
  <pre><code>UUID=3FCE-E5CB  /data   vfat    rw,user,exec,utf8,uid=jack,gid=jack 0      0
  </code></pre>