# How to build a sysimage for Windows

**URL:** https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500
**Category:** General Usage
**Tags:** question, package-compiler
**Created:** [July 27, 2026, 9:45pm UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500 "2026-07-27T21:45:21Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [July 27, 2026, 9:45pm UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/1 "2026-07-27T21:45:21Z")

</div>

I built a system image on Windows 10 using Julia 1.12. But I cannot start Julia with this system image:

```julia-auto
C:\Users\ufechner\repos\IM_AWES_bench.jl\bin>julia -J sysimage.dll
ERROR: could not load library "C:\Users\ufechner\repos\IM_AWES_bench.jl\bin\sysimage.dll"
%1 is not a valid Win32 application.

```

```julia-auto
julia> versioninfo()
Julia Version 1.12.6
Commit 15346901f0 (2026-04-09 19:20 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × AMD Ryzen 9 7950X 16-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, znver4)
  GC: Built with stock GC
Threads: 1 default, 1 interactive, 1 GC (on 16 virtual cores)

```

Any idea?

Works fine on Linux.

And yes, Windows and Julia are both 64 bit. So the error message is a bit confusing.

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [July 28, 2026, 5:20am UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/2 "2026-07-28T05:20:13Z")

</div>

Any ideas how to debug?

```bash
ufechner@ufryzen:~/Shared_Windows$ objdump -f sysimage.dll 

sysimage.dll: file format pei-x86-64
architecture: i386:x86-64, flags 0x0000013b:
HAS_RELOC, EXEC_P, HAS_DEBUG, HAS_SYMS, HAS_LOCALS, D_PAGED
start address 0x00000003a4d61320

```

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [July 29, 2026, 2:05am UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/3 "2026-07-29T02:05:38Z")

</div>

Hmm. My one thought is do you have a msys2 environment you could work with?

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [July 29, 2026, 1:32pm UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/4 "2026-07-29T13:32:46Z")

</div>

I tested on Windows 11 and got the same error.

You can reproduce the problem like this:

```julia-auto
git clone https://github.com/c-nicomar/IM_AWES_bench.jl.git
cd IM_AWES_bench.jl/bin
./install
./create_sys_image
cd ..
./bin/run_julia

```

Warning: Takes a long time.

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [July 29, 2026, 3:10pm UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/5 "2026-07-29T15:10:06Z")

</div>

> [@ufechner7](#):
>
> ```julia-auto
> %1 is not a valid Win32 application.
> 
> ```

If this is your main lead, then we need to create a Windows debugging environment. There are two paths, one is to use MSYS2 and use a GCC-based framework to analyze dynamic library loading.

There are also tools like WinDbg:

> **[Install WinDbg - Windows drivers](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/)**
>
> Start here for an overview on the Windows debugger and installing WinDbg.

Essentially, we need to do the eqiuvalent of `LD_DEBUG=libs`. You’ll need to use gflags.exe that should come with WinDbg to enable logging of shared library loading on the Julia executable.

PackageCompiler.jl does require a C compiler, and I’m not sure which one you are using.

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [July 29, 2026, 3:33pm UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/6 "2026-07-29T15:33:16Z")

</div>

How big is the sysimage?

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [July 29, 2026, 5:08pm UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/7 "2026-07-29T17:08:49Z")

</div>

> [@mkitti](#):
>
> [PackageCompiler.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/PackageCompiler) does require a C compiler, and I’m not sure which one you are using.

How shall I know that? I think PackageCompiler installs its own compiler as an artifact. One of the machines where I tried compiling it is quite virgin, not much on it, definitely no C compiler that I installed myself. I just installed Git for Windows, which comes with a Bash shell.

And a few months ago, this all worked fine.

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [July 30, 2026, 8:35pm UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/8 "2026-07-30T20:35:00Z")

</div>

> [@kristoffer.carlsson](#):
>
> How big is the sysimage?

```julia-auto
ufechner@ufryzen:~/Shared_Windows$ ls -la sysimage.dll 
-rwxrwxr-x 1 ufechner ufechner 2208050613 Jul 27 23:21 sysimage.dll
ufechner@ufryzen:~/Shared_Windows$ ls -lah sysimage.dll 
-rwxrwxr-x 1 ufechner ufechner 2.1G Jul 27 23:21 sysimage.dll

```

```julia-auto
const PACKAGES = [
    "ModelingToolkit",
    "OrdinaryDiffEq",
    "MakieControlPlots",
    "CSV",
    "DataFrames",
]

```

Is that too big?

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [July 31, 2026, 6:31pm UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/9 "2026-07-31T18:31:11Z")

</div>

Removing ModelingToolkit from the system image solved the problem:

This works:

```julia-auto
const PACKAGES = [
    "OrdinaryDiffEq",
    "MakieControlPlots",
    "CSV",
    "DataFrames",
]

```

Size now:

```julia-auto
ufechner@DESKTOP-USD9U6B MINGW64 ~/repos/InductionMachineDrives.jl/bin
$ ls -la sysimage.dll
-rwxr-xr-x 1 ufechner 197121 1733065543 Jul 31 20:04 sysimage.dll*
$ ls -lah sysimage.dll
-rwxr-xr-x 1 ufechner 197121 1.7G Jul 31 20:04 sysimage.dll*

```

This looks a bit as if there might be an upper limit of 2 GB on the size of the sysimage on Windows. If that should be the case, PackageCompiler should at least print a warning.

Any comments? Could this be fixed?

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [July 31, 2026, 7:59pm UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/10 "2026-07-31T19:59:05Z")

</div>

> [@ufechner7](#):
>
> Is that too big?

Yes, limit is 2 GB

> [@ufechner7](#):
>
> This looks a bit as if there might be an upper limit of 2 GB on the size of the sysimage on Windows. If that should be the case, PackageCompiler should at least print a warning.

That’s a good idea. [Add compression option and warn on too big sysimage sizes on windows - Pull Request #1114 - JuliaLang/PackageCompiler.jl - GitHub](https://github.com/JuliaLang/PackageCompiler.jl/pull/1114) should warn and also on 1.13 add the compress option that significantly reduces the size of the sysimage (but makes it slightly slower to load).

---

<div class="post-metadata">

### Author: ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)
#### Post date: [July 31, 2026, 8:13pm UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/11 "2026-07-31T20:13:41Z")

</div>

Is there also such a size limit on macOS, or is it only on Windows?

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [July 31, 2026, 8:19pm UTC](https://discourse.julialang.org/t/how-to-build-a-sysimage-for-windows/138500/12 "2026-07-31T20:19:04Z")

</div>

There could be something around 4GB for those but I am not 100% sure
