About cross compile

In the docker, I tried

crystal build ./src/myapp.cr  -o ./bin/app --release --no-debug --cross-compile --target x86_64-apple-darwi -s

got

Parse:                             00:00:00.000955442 (   1.16MB)
Semantic (top level):              00:00:01.240523666 ( 131.05MB)
Semantic (new):                    00:00:00.002161339 ( 131.05MB)
Semantic (type declarations):      00:00:00.029679116 ( 131.05MB)
Semantic (abstract def check):     00:00:00.012494202 ( 147.05MB)
Semantic (restrictions augmenter): 00:00:00.006989576 ( 147.05MB)
Semantic (ivars initializers):     00:00:00.025277393 ( 147.05MB)
Semantic (cvars initializers):     00:00:00.313082617 ( 179.11MB)
Semantic (main):                   00:00:08.039772605 ( 467.49MB)
Semantic (cleanup):                00:00:00.000409671 ( 467.49MB)
Semantic (recursive struct check): 00:00:00.000817676 ( 467.49MB)
Codegen (crystal):                 00:00:00.586772920 ( 515.49MB)
Codegen (bc+obj):                  00:00:25.007893951 ( 515.49MB)
cc ./bin/app.o -o ./bin/app  -rdynamic -L/usr/bin/../lib/crystal -lz `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lpcre2-8 -lgc -levent_pthreads -levent -levent -liconv

Macro runs:
 - /usr/share/crystal/src/ecr/process.cr: 00:00:07.232040376

Is there a question/problem here or?

I’d suggest reading thru Static Linking - Crystal if you haven’t already.

I’m trying to build an app that runs on Mac OS on the Alpine system.

I was able to compile it statically…emmm,
Does this have anything to do with cross compile?

Well, It’s all right now.

1 Like