On Linux, you can list the shared libraries that an executable needs to execute with the ldd command. In OSX, otool -L can be used for the same purpose.
Typically, the linker will use shared libraries when creating an executable file if it can find them. So what you need to do is make the linker use static libraries instead. (In the future, we could add a flag to the compiler for forced selection)
You should find some of these static libraries in / opt / crystal / embedded / lib. We use them to create the Crystal portable compiler.
To use these libraries, you can run:
$ LIBRARY_PATH=/opt/crystal/embedded/lib crystal build my_app.cr
This should prefer the libraries available in this directory before considering others installed in standard places.
Unfortunately, OpenSSL does not apply to Crystal, so you must either copy or create a static version of libssl and libcrypto . This is a regular library anyway, available on any Linux distribution.
Regarding libc , this is more complicated. We collect Crystal binaries for releases using the old CentOS and Debian distributions to make it compatible with many other versions of libc.
source share