title: How can I target my Rust application and it's dependencies to musl?
body: <p>I'm trying to run my rust application on Alpine but I'm having problems with either using musl as a target or using the compatibility layer for glibc.
  When I try to use from the <code>libc6-compat</code> I'm having this problem:</p>
  
  <pre><code>Error relocating my_app: __register_atfork: symbol not found
  Error relocating my_app: __res_init: symbol not found
  </code></pre>
  
  <p>Is this a bug or this symbols are not at all supported by the compatibility layer?</p>
  
  <p>When I try to target musl, I have a different problem. I cannot compile my application directly on musl, because some features from the rust compiler are not supported. What I did was compiling on a debian image targeting musl and moving my binary to my alpine image. It looks like even targeting musl, the linker still uses some glibc variants at build time, which my little experience with C doesn't help me being sure if this would be a problem or not.My application depends on glib2 which I installed through apk and when it starts it fails with the following:</p>
  
  <pre><code>**
  GLib-GObject:ERROR:../gobject/gtype.c:2743:g_type_register_static: assertion failed: (static_quark_type_flags)
  Aborted
  </code></pre>
  
  <p>I've trying to compile a C example directly in my alpine container and it works in there, so that made me believe I'm having some problems with the cross compilation/linking in my glibc container. Any ideas on how can I solve this? </p>
  
  <p>Note: I could just use a glibc container, but neither the ones I know have a minimal package manager. The debian variants install too much bloatware that are not needed from my dependencies (I don't understand why they insert optional dependencies as required in the package manager) making the image bigger than 1GB, whereas my alpine version is 100MB. The same pattern with RPM variants. I would be fine with a bigger image than 100MB, but not 1GB.</p>