title: How can I fix "The CMAKE_C_COMPILER is not a full path and was not found in the PATH"?
body: <p>I read <a href="http://timryan.org/2018/07/27/cross-compiling-linux-binaries-from-macos.html" rel="nofollow noreferrer">Using a Mac to cross-compile Linux binaries</a> and ran some commands from it. When I run <code>cargo build</code> on macOS, I receive the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>CMake Error at CMakeLists.txt:31 (project):
    The CMAKE_C_COMPILER:
  
      x86_64-unknown-linux-gnu-gcc
  
    is not a full path and was not found in the PATH.
  
    Tell CMake where to find the compiler by setting either the environment
    variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
    the compiler, or to the compiler name if it is in the PATH.
  </code></pre>
  
  <p>How can I fix it?</p>
  
  <p>I tried to set the <code>CC</code> environment variable with no success:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ which gcc
  /usr/bin/gcc
  $ export CC="/usr/bin/gcc"
  $ cargo build
  </code></pre>
  
  <p>and</p>
  
  <pre class="lang-none prettyprint-override"><code>$ xcrun -find cc
  /Library/Developer/CommandLineTools/usr/bin/cc
  $ export CC="/Library/Developer/CommandLineTools/usr/bin/cc"
  $ echo $CC
  /Library/Developer/CommandLineTools/usr/bin/cc
  </code></pre>
  
  <p>And then I received the same error.</p>