# Ship custom sysimages created with PackageCompiler

**URL:** https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515
**Category:** General Usage
**Created:** [August 29, 2022, 7:46pm UTC](https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515 "2022-08-29T19:46:45Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jbrea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbrea/32/3879_2.png) [@jbrea](https://discourse.julialang.org/u/jbrea)
#### Post date: [August 29, 2022, 7:46pm UTC](https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515/1 "2022-08-29T19:46:45Z")

</div>

Currently I use [PrecompilePlutoCourse](https://github.com/jbrea/PrecompilePlutoCourse.jl) to reduce latency of some Pluto notebooks for teaching. This is great, except that every student needs to wait quite a while for the PackageCompiler to finish. As there are at least an order of magnitude more students than different platforms, I thought it would be nice, if one could just distribute the custom sysimages for each platform (via Artifacts or BinDeps).

Does this sound reasonable/feasible?  
Is it possible to create sysimages for other platforms on my linux machine or on some free servers in the cloud?

---

<div class="post-metadata">

### Author: ![SteffenPL](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steffenpl/32/206270_2.png) [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)
#### Post date: [August 29, 2022, 7:58pm UTC](https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515/2 "2022-08-29T19:58:07Z")

</div>

It’s in development, maybe not final yet, but there is this super nice project:

> **[GitHub - MichaelHatherly/CuratedSystemImages.jl: Julia package providing...](https://github.com/MichaelHatherly/CuratedSystemImages.jl)**
>
> Julia package providing curated system images. Contribute to MichaelHatherly/CuratedSystemImages.jl development by creating an account on GitHub.

---

<div class="post-metadata">

### Author: ![jbrea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbrea/32/3879_2.png) [@jbrea](https://discourse.julialang.org/u/jbrea)
#### Post date: [August 30, 2022, 8:11am UTC](https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515/3 "2022-08-30T08:11:09Z")

</div>

Thanks a lot, @SteffenPL! With your link I found a [github action](https://github.com/MichaelHatherly/curated-system-images/blob/main/.github/workflows/BuildImages.yml) that looks like the solution to my second question.

---

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [August 30, 2022, 9:31am UTC](https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515/4 "2022-08-30T09:31:07Z")

</div>

I pre-announced CuratedSystemImages.jl, then asked:

> > Was it too soon? It should work?

> Probably, but that’s fine. It should work.

---

<div class="post-metadata">

### Author: ![jbrea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbrea/32/3879_2.png) [@jbrea](https://discourse.julialang.org/u/jbrea)
#### Post date: [September 3, 2022, 9:43am UTC](https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515/5 "2022-09-03T09:43:28Z")

</div>

Following the CuratedSystemImages approach (thanks @mike) I got it working more or less (also thanks to the great julia package manager ;)). But now I have some follow-up questions:

1. I had to patch quite a few packages that use `@ __DIR__ ` in their ` __init__ ()` function with the `RelocatableFolders` approach. Is this the way we want to deal with relocatability in the whole ecosystem? If yes, I would open PRs for those packages.
2. ~~Is it possible that the `RelocatableFolders` approach doesn’t play well with `Requires`? I struggled making `Plots` relocatable and ended up avoiding any `@require`, but I didn’t investigate.~~ EDIT: all good.
3. The ubuntu and macOS build with github actions works fine. But for the windows build I always run into `LLVM ERROR: out of memory, Allocation failed`. Does somebody know what the problem might be?

---

<div class="post-metadata">

### Author: ![mike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike/32/39_2.png) [@mike](https://discourse.julialang.org/u/mike)
#### Post date: [September 3, 2022, 10:23am UTC](https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515/6 "2022-09-03T10:23:11Z")

</div>

> [@jbrea](#):
>
> I had to patch quite a few packages that use `@ __DIR__ ` in their ` __init__ ()` function with the `RelocatableFolders` approach. Is this the way we want to deal with relocatability in the whole ecosystem? If yes, I would open PRs for those packages.

That package, or using `Artifacts`, are the only approaches that I currently know of to deal with relocation correctly. `RelocatableFolders` has worked well in practise for what it was made to do, but just keep in mind the limitations noted in the readme, e.g. don’t use it for really large files, use artifacts instead in those cases.

> [@jbrea](#):
>
> - Is it possible that the `RelocatableFolders` approach doesn’t play well with `Requires`? I struggled making `Plots` relocatable and ended up avoiding any `@require`, but I didn’t investigate.

Haven’t come across issues before related to `@require` and `RelocatableFolders` used in conjunction. If you manage to get a reproducible case to look at we can try and resolve it. I don’t _think_ there should be an issue between the two, but could be the case perhaps.

> [@jbrea](#):
>
> The ubuntu and macOS build with github actions works fine. But for the windows build I always run into `LLVM ERROR: out of memory, Allocation failed`. Does somebody know what the problem might be?

Sorry, not hit anything like that on GHA windows runners, though I’ve not tried building anything particularly “big” on GHA. Is this with Julia 1.7 or 1.8?

---

<div class="post-metadata">

### Author: ![jbrea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbrea/32/3879_2.png) [@jbrea](https://discourse.julialang.org/u/jbrea)
#### Post date: [September 3, 2022, 10:31am UTC](https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515/7 "2022-09-03T10:31:54Z")

</div>

Thanks a lot for the prompt response!

> [@mike](#):
>
> Is this with Julia 1.7 or 1.8?

1.7. My images are pretty large, using Plots, MLJ, Flux and many more packages.

> [@mike](#):
>
> If you manage to get a reproducible case to look at we can try and resolve it.

Will try.

---

<div class="post-metadata">

### Author: ![mike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike/32/39_2.png) [@mike](https://discourse.julialang.org/u/mike)
#### Post date: [September 3, 2022, 10:43am UTC](https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515/8 "2022-09-03T10:43:14Z")

</div>

> [@jbrea](#):
>
> 1.7. My images are pretty large, using Plots, MLJ, Flux and many more packages.

Perhaps see if you’re able to build on a local Windows machine if you’ve not done so yet? We’ve built some pretty large images on Windows without issues, but are using much larger runners that GHA provides.
