Crystal: Static compilation of empty project fails on macos (OSX)

Created on 23 Apr 2018  路  3Comments  路  Source: crystal-lang/crystal

This is the command I ran and the error I got:

$ crystal build --static src/something.cr
ld: library not found for -lcrt0.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/sherjil/Desktop/something/something'  -rdynamic -static  -lpcre -lgc -lpthread /usr/local/Cellar/crystal-lang/0.24.2_1/src/ext/libcrystal.a -levent -liconv -ldl -L/usr/lib -L/usr/local/lib`

I did a bit of googling, and it seems macos doesn't provide a static library for crt0.o, which is causing this problem.

Most helpful comment

We can add the information that static linking is not supported when using --static on macOS. with a macro triggered by the darwin flag.

All 3 comments

Building static binaries is unsupported by macOS. There is nothing we can do :(

We can add the information that static linking is not supported when using --static on macOS. with a macro triggered by the darwin flag.

Smart suggestion from @j8r.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cjgajard picture cjgajard  路  3Comments

asterite picture asterite  路  3Comments

asterite picture asterite  路  3Comments

RX14 picture RX14  路  3Comments

nabeelomer picture nabeelomer  路  3Comments