# \[ANN\] PackageCompiler.jl

**URL:** <https://discourse.julialang.org/t/ann-packagecompiler-jl/8154>\
**Category:** Community\
**Created:** [January 4, 2018, 12:21pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-jl/8154 "2018-01-04T12:21:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [January 4, 2018, 12:21pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-jl/8154/1 "2018-01-04T12:21:33Z")

</div>

[PackageCompiler.jl](https://github.com/SimonDanisch/PackageCompiler.jl) will make it easier to ahead of time compile your package and remove the JIT overhead by generating a custom user image.

[Blog article explaining some details](https://medium.com/@sdanisch/compiling-julia-binaries-ddd6d4e0caf4).

Let me know if you run into any issues via [opening an issue](https://github.com/SimonDanisch/PackageCompiler.jl/issues/new)!

Best,  
Simon

---

<div class="post-metadata">

**Author:** ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Post date:** [January 4, 2018, 3:49pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-jl/8154/2 "2018-01-04T15:49:57Z")

</div>

Hey Simon, this looks really good. I will test.

One question: What if `force=false`? This will not override the system image? But how do a invoke julia to use the newly created system image.

More general: What is if changes to a package have been made? Can we detect this and at least give a warning?

Best,

Tobi

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [January 4, 2018, 3:58pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-jl/8154/3 "2018-01-04T15:58:44Z")

</div>

> One question: What if force=false? This will not override the system image? But how do a invoke julia to use the newly created system image.

You will get a info message with the concrete path printed. E.g. something like `julia -J path/image/...`

> More general: What is if changes to a package have been made? Can we detect this and at least give a warning?

That’s a good suggestion. Not sure on what level to resolve this - @tim.holy, is there infrastructure in Revise.jl that we could use for that?

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [January 4, 2018, 4:03pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-jl/8154/4 "2018-01-04T16:03:54Z")

</div>

Most likely, yes. The best model is probably how `Revise.track(Base)` works, where (on 0.7) any change since you last built julia gets detected and `eval`ed appropriately. This depends on having a source-cache available, which julia now builds at the end of its build process (stored in `$JULIA/usr/share/julia/base.cache`).

Packages (on 0.7) work similarly, they now store a source-cache in the `*.ji` file so that Revise can compare current code against what it was when the package was precompiled.

So if you can create a source-cache, it should be pretty straightforward to load it into Revise and then to look for changes to the source files that occurred after the build.

---

<div class="post-metadata">

**Author:** ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Post date:** [January 4, 2018, 4:26pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-jl/8154/5 "2018-01-04T16:26:33Z")

</div>

Do either of you know if it is possible to build the system image in chunks. I.e. that it is possible to drop parts? This would be great since it would be possible to invalidate only those parts that were changed on disk.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [January 4, 2018, 5:04pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-jl/8154/6 "2018-01-04T17:04:45Z")

</div>

I haven’t looked into that yet and I’m not the right one to ask. My assumption is, that if it would be easy, we’d have it by now 😛  
It would make it pretty trivial to have e.g. `julia/v0.x/lib/Package.so`, and be over with this whole thing!

I hope I’m wrong!

---

<div class="post-metadata">

**Author:** ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Post date:** [January 4, 2018, 5:13pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-jl/8154/7 "2018-01-04T17:13:34Z")

</div>

This will have to work a little differently since modules X and Y may trigger the same code generation (e.g. of some Base method). But nevertheless this should be doable.

---

<div class="post-metadata">

**Author:** ![glemieux](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/glemieux/32/212792_2.png) [@glemieux](https://discourse.julialang.org/u/glemieux)\
**Post date:** [March 1, 2018, 8:31pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-jl/8154/8 "2018-03-01T20:31:50Z")

</div>

What’s the relationship between [Transpiler.jl](https://github.com/SimonDanisch/Transpiler.jl) and [PackageCompiler.jl](https://github.com/JuliaLang/PackageCompiler.jl)?

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [March 1, 2018, 9:42pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-jl/8154/9 "2018-03-01T21:42:43Z")

</div>

There is almost none. PackageCompiler is about generating standalone executables + shared libraries from a Julia library, while Transpiler translates Julia code to OpenCL/OpenGL

---

<div class="post-metadata">

**Author:** ![glemieux](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/glemieux/32/212792_2.png) [@glemieux](https://discourse.julialang.org/u/glemieux)\
**Post date:** [March 7, 2018, 6:44pm UTC](https://discourse.julialang.org/t/ann-packagecompiler-jl/8154/10 "2018-03-07T18:44:32Z")

</div>

Thanks for the clarification and please pardon my naivete on the subject at large (my questions probably should be in [First Steps](https://discourse.julialang.org/c/user/first-steps)). Reading through the Github documentation and the referenced Julia Computing [blog](https://juliacomputing.com/blog/2016/02/09/static-julia.html) [posts](https://juliacomputing.com/blog/2016/03/10/j2c-announcement.html) relating to AOT compilation, am I correct in assuming there is some relationship between [PackageCompileler.jl](https://github.com/SimonDanisch/PackageCompiler.jl) and [llvm-cbe.jl](https://github.com/JuliaComputing/llvm-cbe)?
