Ask HN: What languages produce self contained binaries?
Go is one, are there any other languages which produce self contained binaries out of the box?
Or link dynamically but only to very few libraries like glibc so they are easy to distribute?
Or link dynamically but only to very few libraries like glibc so they are easy to distribute?
8 comments
[ 3.5 ms ] story [ 29.0 ms ] threadI guess with musl C, C++ and Rust can do that though it is a bit of work.
OCaml seems to link only to non OCaml stuff dynamically, which fits the bill too.
Also, the likes of Haskell let you build binaries dependent only on OS provided libraries whereas the likes of Nim compile to C. You might want to play with the short listed languages to get an idea. A simple Hello World will tell you what they link with by default. Anything beyond that is up to you.
I've done some work in rust, c++, and nim before. But looking at some of the comments here and rethinking the pros and cons it seems a fully self contained binary might be more trouble than it's worth and some dependency is fine as long as an easy to use packaging and deployment process is found.
Sorry the question was a bit vague. I don't think I explained well what I was looking for.
I guess packaging them through the relevant package manager is a better option from a security perspective as opposed to a big static binary.