79431340

Date: 2025-02-11 21:24:06
Score: 0.5
Natty:
Report link

This may not be the solution for everyone but the answer comes down to how cross compilation and linking works. What I am attempting to do here is create a static binary, there are two commands that can be used:

RUSTFLAGS="-Ctarget-feature=-crt-static" - dynamic linking of the c runtime.

RUSTFLAGS="-Ctarget-feature=+crt-static" - fully static compilation of C runtime.

There is also a separate issue here, the use of openssl-dev - this requires glibc to compile by default, you need to set this up to be compiled statically. I haven't got to the bottom of this yet but the three solutions I have found (2 work, 1 I haven't tried yet).

  1. Copy all certs and openssl object files to the scratch container - works.
  2. Compile and use static file in openssl OS distro - not tried.
  3. Use Cargo vendored openssl implementation

I am planning on writing a medium article where I added all my problems and findings, just think it might help others when I post this.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Joel Earps