Is that true still? If it is, does anyone know when support for "real" fat binaries (no need for Crystal on the server) will be available?
Is that true still? If it is, does anyone know when support for "real" fat binaries (no need for Crystal on the server) will be available?
If someone wants to generate some good tooling around this workflow, it'd be greatly appreciated.
I'll be updating it later today with 0.25.1 support.
You can statically compile a local crystal file using a docker one-liner that is included in the description.
Golang produces one single binary you can deploy to your target environment and doesn't really require anything else installed.
From what I've read, Crystal generates a binary but you also need to ensure Crystal is installed on your target environment.
By default, Crystal generates dynamically linked binaries. You absolutely do not need Crystal to run them. But you do need:
- Boehm GC (libgc-threaded)
- libevent
- PCRE if the program uses regexps
- libyaml if the program uses yaml
- OpenSSL if the program uses crypto/TLS (?)
Here's an example ldd output:
/usr/local/bin/shards:
libyaml-0.so.2 => /usr/local/lib/libyaml-0.so.2 (0x8c0bb1e000)
libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x8c0bd3c000)
libm.so.5 => /lib/libm.so.5 (0x8c0bfb8000)
libgc-threaded.so.1 => /usr/local/lib/libgc-threaded.so.1 (0x8c0c1e6000)
libthr.so.3 => /lib/libthr.so.3 (0x8c0c444000)
libevent-2.1.so.6 => /usr/local/lib/libevent-2.1.so.6 (0x8c0c66c000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x8c0c8c3000)
libc.so.7 => /lib/libc.so.7 (0x8c0cad2000)
libdl.so.1 => /usr/lib/libdl.so.1 (0x8c0ce8f000)
libcrypto.so.42 => /usr/local/lib/libcrypto.so (0x8c0d091000)
You can try `crystal build --static` though :)https://crystal-lang.org/docs/using_the_compiler/ "Creating a standalone executable":
crystal build some_program.cr --release --static
Builds a static binary (just tried it on Ubuntu 18.04 with a simple hello-world).