title: How to use clang and distcc to compile on a slave of a different architecture (e.g. Mac/Linux)
body: <p>I want to use distcc to compile code from my Mac to a bunch of Linux hosts, but I can't figure out how to make everything "line up". I've successfully used distcc from Mac to Mac, so I have a general idea of how to set things up.</p>
  
  <p>I'm using Clang 4.0 and have it installed and working on both Mac and Linux. The following command compiles fine without the <code>distcc</code> at the beginning, but after adding distcc, I get the following issues:</p>
  
  <pre><code>distcc /Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/clang++   -I/usr/local/include -I/Users/xaxxon/v8toolkit/./include -I/Users/xaxxon/v8/include  -stdlib=libc++ -g -Werror=return-type -g   -std=gnu++1z -o CMakeFiles/v8toolkit_static.dir/src/v8toolkit.cpp.o -c /Users/xaxxon/v8toolkit/src/v8toolkit.cpp
  </code></pre>
  
  <p>I'm not sure what compiler is being picked up on Linux, nor do I know how to find out. It's possible it's picking up GCC instead of Clang.</p>
  
  <p>My first concern is this:</p>
  
  <pre><code>clang: warning: argument unused during compilation: '-stdlib=libc++'
  </code></pre>
  
  <p>My first error is:</p>
  
  <pre><code>In file included from /Users/xaxxon/v8toolkit/src/v8toolkit.cpp:5:
  In file included from /usr/include/assert.h:44:
  In file included from /Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../include/c++/v1/stdlib.h:94:
  /usr/include/stdlib.h:250:20: error: blocks support disabled - compile with -fblocks or pick a deployment target that supports them
  int atexit_b(void (^)(void)) __attribute__((availability(macosx,introduced=10.6)));
  </code></pre>
  
  <p>The next error I get (which becomes the first error if I manually add <code>-fblocks</code> to the compilation command (which isn't needed on a native Mac build) is:</p>
  
  <pre><code>/Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../include/c++/v1/__tuple:289:13: error: unknown type name '__type_pack_element'
      typedef __type_pack_element&lt;_Ip, _Types...&gt; type;
              ^
  /Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../include/c++/v1/__tuple:289:32: error: expected member name or ';' after declaration specifiers
      typedef __type_pack_element&lt;_Ip, _Types...&gt; type;
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  /Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../include/c++/v1/__tuple:356:43: error: use of undeclared identifier '__type_pack_element'
        typename _ApplyFn::template __apply&lt;__type_pack_element&lt;_Idx, _Types...&gt;&gt;...
                                            ^
  /Users/xaxxon/Downloads/clang+llvm-4.0.0-x86_64-apple-darwin/bin/../include/c++/v1/__tuple:357:6: error: expected a type
      &gt;;
  </code></pre>
  
  <p>I don't understand if I'm doing something fundamentally wrong or if there's something small I'm missing which is making the Linux compiler act differently.</p>
  
  <p>I just made sure to have Clang on Linux in the same named directory and now am only getting the <code>-fblocks</code> and <code>unused during compilation -stdlib=libc++</code> issues.</p>
  
  <p>I can get everything to compile (albeit with warnings), but when it links, I get:</p>
  
  <pre><code>ld: warning: ignoring file CMakeFiles/v8toolkit_shared.dir/src/debugger.cpp.o, file was built for
  unsupported file format ( 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00
  0x00 0x00 0x00 0x00 0x00 0x00 ) which is not the architecture being linked
  (x86_64): CMakeFiles/v8toolkit_shared.dir/src/debugger.cpp.o
  </code></pre>