4 ms·
How portable are Crystal binaries? Or more generally, how easy is it to share a Crystal program with someone who isn't a Crystal user? E.g. C and C++ requires a
by nerdponx 7y ago
How portable are Crystal binaries? Or more generally, how easy is it to share a Crystal program with someone who isn't a Crystal user? E.g. C and C++ requires a lot of esoteric knowledge w/ occasionally slow builds, Go isn't that bad but has an intrusive bad default GOPATH, Rust + Rustup is like Go with better defaults but relatively long compilation times, Python/Ruby need the runtime installed + some kind of isolating environment, NodeJS just needs the runtime + NPM, Perl needs some kind of CPAN setup which is really confusing for newbies, etc.
- ukd1 7y agoIt's actually pretty easy; I compile stuff on a mac, then run it on a Linux box regularly. Usually use Docker though.
- KenanSulayman 7y agoIt's not cross compilation in Docker because Docker on macOS is literally just a VM running a Linux kernel.
- derefr 7y agoN.B. unlike the other problems you listed, Go's "intrusive bad default GOPATH" is a development-time choice; presuming the developer used Go modules, the compiling-from-source user won't have to think about GOPATH.
- rvz 7y agoLike Go, Crystal embeds the runtime inside of the executable by default so it doesn't require the user to install the language runtime libraries on the users computer unlike Java, C#, etc. The only way to get a true portable statically-linked Crystal binary on Linux is to compile your program statically using an Alpine Linux Docker container. MacOS portability shouldn't be a problem since everything is static except for libSystem.dylib.
- pjmlp 7y agoLike Java and C# actually, it just doesn't get more known due to the amount of devs that don't deal with commercial AOT toolchains outside corporations.
- SomaticPirate 7y agoJust to clarify, Go has an extremely simple cross compilation story. GOOS=windows GOARCH=amd64 go build main.go will consistently create a windows binary. It also has great support for a wide variety of architectures. This has been true since Go 1.5 and GOPATH idiosyncrasies are largely going away with the move to go modules. https://golang.org/doc/install/source#environment https://golang.org/doc/install/source#environment