# Why can we not easily compile to standalone binary?

**URL:** https://discourse.julialang.org/t/why-can-we-not-easily-compile-to-standalone-binary/101936
**Category:** General Usage
**Created:** [July 22, 2023, 5:37pm UTC](https://discourse.julialang.org/t/why-can-we-not-easily-compile-to-standalone-binary/101936 "2023-07-22T17:37:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![The\_Mastermage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/the_mastermage/32/49444_2.png) [@The\_Mastermage](https://discourse.julialang.org/u/The_Mastermage)
#### Post date: [July 22, 2023, 5:37pm UTC](https://discourse.julialang.org/t/why-can-we-not-easily-compile-to-standalone-binary/101936/1 "2023-07-22T17:37:02Z")

</div>

So I am new to Julia and in recent time I was learning abit about Interpreters and Compilers, still dont understand much beyond Lexer and Tokenizer so go easy on me here. I was wondering if Julia does rely on the LLVM Compiler Infrastructure, why does it seem to be so difficult to “just” compile to a binary, as like Rust does which also works on LLVM. I know such things as PackageCompiler.jl exists but this only creates “massive” binaries bundling all of the julia dependencies in and you can not just take the exe file and drop it somewhere else.  
I would be realy interested what the problem here is such that I might be able to possibly contribute in the future (once I understand more about Compilers).  
Thanks for any answers I appreciate your time.

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [July 22, 2023, 5:45pm UTC](https://discourse.julialang.org/t/why-can-we-not-easily-compile-to-standalone-binary/101936/2 "2023-07-22T17:45:41Z")

</div>

There’s a number of threads on this, but I quite like this one - and I’m shamelessly linking to my own answer for why that’s a bit difficult 🙂

> [@Could Someone Explain To Me the Desire for Small Julia Binaries?](https://discourse.julialang.org/t/could-someone-explain-to-me-the-desire-for-small-julia-binaries/96484/17):
>
> One aspect that hasn’t been mentioned so far, and that to me is a reason why I don’t think it’s just 30-1000 LOC change with pkgimages like @tim.holy thinks, is cross compilation. In essence, cross compilation means compiling a program for an architecture other than the one where the compiler is running. Currently, all julia compilation happens under the assumption that the code will run on the same machine as the compiler itself - PkgCompiler and StaticCompiler weaken that assumption a bit, to …

---

<div class="post-metadata">

### Author: ![The\_Mastermage](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/the_mastermage/32/49444_2.png) [@The\_Mastermage](https://discourse.julialang.org/u/The_Mastermage)
#### Post date: [July 22, 2023, 6:18pm UTC](https://discourse.julialang.org/t/why-can-we-not-easily-compile-to-standalone-binary/101936/3 "2023-07-22T18:18:22Z")

</div>

so alot of problems lie in cross compilation do I understand your post right there?

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [July 22, 2023, 6:36pm UTC](https://discourse.julialang.org/t/why-can-we-not-easily-compile-to-standalone-binary/101936/4 "2023-07-22T18:36:41Z")

</div>

Essentially, yes - the way Julia works conceptually makes general static compilation pretty hard in the first place, and (good) cross compilation just adds more difficulties on top. It’s a very large amount of work.

As far as compilers go, Julia is quite unusual.
