Remix.run Logo
3836293648 3 days ago

Which only works on linux. No other OS allows static binaries, you always need to link to libc for syscalls.

craftkiller 3 days ago | parent | next [-]

Also works on FreeBSD. FreeBSD maintains ABI compatibility within each major version (so 14.0 is compatible with 14.1, 14.2, and 14.3 but not 15.0): You also can install compatibility packages that make binaries compiled for older major versions run on newer major versions.

  $ pkg install git rust
  $ git clone https://github.com/BurntSushi/ripgrep.git
  $ cd ripgrep
  $ RUSTFLAGS='-C target-feature=+crt-static' cargo build --release
  
  $ ldd target/release/rg
  ldd: target/release/rg: not a dynamic ELF executable
  $ file target/release/rg
  target/release/rg: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), statically linked, for FreeBSD 14.3, FreeBSD-style, with debug_info, not stripped
exe34 3 days ago | parent | prev [-]

try cosmopolitan!

3836293648 2 days ago | parent [-]

Cosmopolitan isn't statically linked, it's just a hack that works on all systems, dynamically linking on windows and macos (I think with a statically linked custom dynamic linker?)