title: How to build a Rust app free of shared libraries?
body: <p>How does one compile a Rust application without having to load shared libraries at all?</p>
  
  <p>What have I tried:</p>
  
  <p><strong>ex.rs</strong></p>
  
  <pre><code>fn main() {
    println!("Try to compile me statically!");
  }
  </code></pre>
  
  <p>According to <a href="https://rust-lang.github.io/rfcs/1721-crt-static.html" rel="noreferrer">https://rust-lang.github.io/rfcs/1721-crt-static.html</a> I performed the following:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ rustc -C target-feature=+crt-static ./ex.rs
  $ ldd ./ex
      linux-vdso.so.1 (0x00007ffc4e3ef000)
      libdl.so.2 =&gt; /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc30b8c4000)
      librt.so.1 =&gt; /lib/x86_64-linux-gnu/librt.so.1 (0x00007fc30b6bc000)
      libpthread.so.0 =&gt; /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc30b49d000)
      libgcc_s.so.1 =&gt; /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc30b285000)
      libc.so.6 =&gt; /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc30ae94000)
      /lib64/ld-linux-x86-64.so.2 (0x00007fc30bcfb000)
  </code></pre>
  
  <p>Why isn't <code>libc</code> compiled statically?
  And how to get rid of linking all other shared libraries?</p>