The Crystal Programming Language Forum

Cannot compile statically : ld: library not found for -lcrt0.o

Hi, I tried to compile a hello world statically on a Mac M1 (Monterey)

Is that a bug or do I have to install a specific library via Brew ?

I installed Crystal using brew:

brew -v
Homebrew 3.3.4
crystal build --static
ld: library not found for -lcrt0.o (this usually means you need to install the development package for libcrt0.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: execution of command failed with code: 1: `cc "${@}" -o /Users/sergehulne/

Fully-static linking is not supported on MacOS exactly because such system libraries are not available as static libraries. See Static Linking - Crystal

1 Like

Thank you!