title: Linker fails to find 32-bit libraries under 64-bit Mint OS when compiling with Clang
body: <p>I just installed Clang 3.5 on 64-bit Mint OS (version 17). I'm trying to compile my program in 32-bit, however I'm running into problems.</p>
  
  <p>I have a file called <code>test.cpp</code> in my home directory with the following code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main()
  {
      std::cout &lt;&lt; "Hello" &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>I then run the following command:</p>
  
  <pre><code>$ clang++ -m32 -Wl,--verbose test.cpp | grep libgcc
  </code></pre>
  
  <p>I get the following output:</p>
  
  <pre><code>$ clang++ -m32 -Wl,--verbose test.cpp | grep libgcc
  /usr/bin/ld: skipping incompatible /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/libstdc++.so when searching for -lstdc++
  /usr/bin/ld: skipping incompatible /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/libstdc++.a when searching for -lstdc++
  /usr/bin/ld: cannot find -lstdc++
  /usr/bin/ld: skipping incompatible /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so succeeded
  /usr/bin/ld: cannot find -lgcc_s
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.a failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../i386-linux-gnu/libgcc_s.so failed
  /usr/bin/ld: skipping incompatible /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../i386-linux-gnu/libgcc_s.a failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../lib32/libgcc_s.so failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../lib32/libgcc_s.a failed
  attempt to open /usr/bin/../lib/i386-linux-gnu/libgcc_s.so failed
  /usr/bin/ld: cannot find -lgcc
  attempt to open /usr/bin/../lib/i386-linux-gnu/libgcc_s.a failed
  attempt to open /usr/bin/../lib32/libgcc_s.so failed
  attempt to open /usr/bin/../lib32/libgcc_s.a failed
  attempt to open /lib/i386-linux-gnu/libgcc_s.so failed
  attempt to open /lib/i386-linux-gnu/libgcc_s.a failed
  attempt to open /lib/../lib32/libgcc_s.so failed
  attempt to open /lib/../lib32/libgcc_s.a failed
  attempt to open /usr/lib/i386-linux-gnu/libgcc_s.so failed
  attempt to open /usr/lib/i386-linux-gnu/libgcc_s.a failed
  attempt to open /usr/lib/../lib32/libgcc_s.so failed
  attempt to open /usr/lib/../lib32/libgcc_s.a failed
  attempt to open /usr/lib/x86_64-linux-gnu/../../lib32/libgcc_s.so failed
  attempt to open /usr/lib/x86_64-linux-gnu/../../lib32/libgcc_s.a failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../libgcc_s.so failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../libgcc_s.a failed
  attempt to open /usr/bin/../lib/libgcc_s.so failed
  attempt to open /usr/bin/../lib/libgcc_s.a failed
  attempt to open /lib/libgcc_s.so failed
  attempt to open /lib/libgcc_s.a failed
  attempt to open /usr/lib/libgcc_s.so failed
  attempt to open /usr/lib/libgcc_s.a failed
  attempt to open /usr/i386-linux-gnu/lib32/libgcc_s.so failed
  attempt to open /usr/i386-linux-gnu/lib32/libgcc_s.a failed
  attempt to open /usr/x86_64-linux-gnu/lib32/libgcc_s.so failed
  attempt to open /usr/x86_64-linux-gnu/lib32/libgcc_s.a failed
  attempt to open //usr/local/lib/i386-linux-gnu/libgcc_s.so failed
  attempt to open //usr/local/lib/i386-linux-gnu/libgcc_s.a failed
  attempt to open //usr/local/lib32/libgcc_s.so failed
  attempt to open //usr/local/lib32/libgcc_s.a failed
  attempt to open //lib/i386-linux-gnu/libgcc_s.so failed
  attempt to open //lib/i386-linux-gnu/libgcc_s.a failed
  attempt to open //lib32/libgcc_s.so failed
  attempt to open //lib32/libgcc_s.a failed
  attempt to open //usr/lib/i386-linux-gnu/libgcc_s.so failed
  attempt to open //usr/lib/i386-linux-gnu/libgcc_s.a failed
  attempt to open //usr/lib32/libgcc_s.so failed
  attempt to open //usr/lib32/libgcc_s.a failed
  attempt to open //usr/local/lib/libgcc_s.so failed
  attempt to open //usr/local/lib/libgcc_s.a failed
  attempt to open //lib/libgcc_s.so failed
  attempt to open //lib/libgcc_s.a failed
  attempt to open //usr/lib/libgcc_s.so failed
  attempt to open //usr/lib/libgcc_s.a failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/libgcc.so failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/libgcc.a succeeded
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../i386-linux-gnu/libgcc.so failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../i386-linux-gnu/libgcc.a failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../lib32/libgcc.so failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../lib32/libgcc.a failed
  attempt to open /usr/bin/../lib/i386-linux-gnu/libgcc.so failed
  attempt to open /usr/bin/../lib/i386-linux-gnu/libgcc.a failed
  attempt to open /usr/bin/../lib32/libgcc.so failed
  attempt to open /usr/bin/../lib32/libgcc.a failed
  attempt to open /lib/i386-linux-gnu/libgcc.so failed
  attempt to open /lib/i386-linux-gnu/libgcc.a failed
  attempt to open /lib/../lib32/libgcc.so failed
  attempt to open /lib/../lib32/libgcc.a failed
  attempt to open /usr/lib/i386-linux-gnu/libgcc.so failed
  attempt to open /usr/lib/i386-linux-gnu/libgcc.a failed
  attempt to open /usr/lib/../lib32/libgcc.so failed
  attempt to open /usr/lib/../lib32/libgcc.a failed
  attempt to open /usr/lib/x86_64-linux-gnu/../../lib32/libgcc.so failed
  attempt to open /usr/lib/x86_64-linux-gnu/../../lib32/libgcc.a failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../libgcc.so failed
  attempt to open /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../libgcc.a failed
  attempt to open /usr/bin/../lib/libgcc.so failed
  attempt to open /usr/bin/../lib/libgcc.a failed
  attempt to open /lib/libgcc.so failed
  attempt to open /lib/libgcc.a failed
  attempt to open /usr/lib/libgcc.so failed
  attempt to open /usr/lib/libgcc.a failed
  attempt to open /usr/i386-linux-gnu/lib32/libgcc.so failed
  attempt to open /usr/i386-linux-gnu/lib32/libgcc.a failed
  attempt to open /usr/x86_64-linux-gnu/lib32/libgcc.so failed
  attempt to open /usr/x86_64-linux-gnu/lib32/libgcc.a failed
  attempt to open //usr/local/lib/i386-linux-gnu/libgcc.so failed
  attempt to open //usr/local/lib/i386-linux-gnu/libgcc.a failed
  attempt to open //usr/local/lib32/libgcc.so failed
  attempt to open //usr/local/lib32/libgcc.a failed
  attempt to open //lib/i386-linux-gnu/libgcc.so failed
  attempt to open //lib/i386-linux-gnu/libgcc.a failed
  attempt to open //lib32/libgcc.so failed
  attempt to open //lib32/libgcc.a failed
  attempt to open //usr/lib/i386-linux-gnu/libgcc.so failed
  attempt to open //usr/lib/i386-linux-gnu/libgcc.a failed
  attempt to open //usr/lib32/libgcc.so failed
  attempt to open //usr/lib32/libgcc.a failed
  attempt to open //usr/local/lib/libgcc.so failed
  attempt to open //usr/local/lib/libgcc.a failed
  attempt to open //lib/libgcc.so failed
  attempt to open //lib/libgcc.a failed
  attempt to open //usr/lib/libgcc.so failed
  attempt to open //usr/lib/libgcc.a failed
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>I've done all of the Googling and self-investigation on this that I can, I'm not sure why this simple example isn't working. Can anyone help figure out what I'm missing?</p>