# ModelingToolkit takes forever to precompile on Windows 11

**URL:** <https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492>\
**Category:** Package Management\
**Created:** [May 21, 2024, 7:08am UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492 "2024-05-21T07:08:28Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![prbzrg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/prbzrg/32/23866_2.png) [@prbzrg](https://discourse.julialang.org/u/prbzrg)\
**Post date:** [May 23, 2024, 5:59pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/62 "2024-05-23T17:59:51Z")

</div>

I had the problem with `BoundaryValueDiffEq` precompilation going forever.  
I did uncheck the “Read-only” for the `.julia` folder, and it got fixed for me.  
 ![Screenshot 2024-05-23 212546](https://global.discourse-cdn.com/julialang/original/3X/1/7/170630522bbe0206e05496f8d4731532cb77c11a.png)

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 23, 2024, 7:09pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/63 "2024-05-23T19:09:21Z")

</div>

Some updates:

1. Still mysterious, maybe even more mysterious than yesterday due to the stochastic behavior.
2. It was reproduced with `using Parsers` without having ModelingToolkit or OrdinaryDiffEq installed, so it’s something deeper, though maybe OrdinaryDiffEq is just good at triggering it.
3. The compiler team is looking into it.

---

<div class="post-metadata">

**Author:** ![Zentrik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zentrik/32/35409_2.png) [@Zentrik](https://discourse.julialang.org/u/Zentrik)\
**Post date:** [May 23, 2024, 8:18pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/64 "2024-05-23T20:18:16Z")

</div>

By the way Parsers.jl does have a buffer overflow problem during precompilation on 1.11 and above, [Buffer Overflow during precompile · Issue #189 · JuliaData/Parsers.jl (github.com)](https://github.com/JuliaData/Parsers.jl/issues/189). I’m guessing that’s not causing this issue especially because the reports seem to be from 1.10, but just thought you might want to be aware.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 23, 2024, 8:20pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/65 "2024-05-23T20:20:37Z")

</div>

No, people have recreated the same GC segfault exception on Windows on v1.10.3.

---

<div class="post-metadata">

**Author:** ![Wenzhe\_Ma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wenzhe_ma/32/13020_2.png) [@Wenzhe\_Ma](https://discourse.julialang.org/u/Wenzhe_Ma)\
**Post date:** [May 23, 2024, 8:34pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/66 "2024-05-23T20:34:20Z")

</div>

Parsers and MKT will install on Julia 1.9.4 without issue. Not sure if the information help to diagnose or not.

---

<div class="post-metadata">

**Author:** ![topolarity](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/topolarity/32/209470_2.png) [@topolarity](https://discourse.julialang.org/u/topolarity)\
**Post date:** [May 23, 2024, 11:30pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/67 "2024-05-23T23:30:18Z")

</div>

Together with @gbaraldi, we are fairly certain we’ve isolated this to a linker problem, related to pseudo relocation support in MinGW.

The problem has been present for a long time, but only causes major issues in sufficiently large pkgimages.

This probably won’t get a workaround in the mean time - It will almost certainly need a hotfix release to fix properly, but we’re trying to get that out asap.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 24, 2024, 1:43am UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/68 "2024-05-24T01:43:46Z")

</div>

We put out a few releases that we believe might work around the issue. Could someone who has the issue update (specifically OrdinaryDiffEq and MTK) and see if the probability of hitting the issue is now near 0?

---

<div class="post-metadata">

**Author:** ![natlampen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/natlampen/32/36640_2.png) [@natlampen](https://discourse.julialang.org/u/natlampen)\
**Post date:** [May 24, 2024, 5:38am UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/69 "2024-05-24T05:38:16Z")

</div>

I hit the issue yesterday on my work laptop. For OrdinaryDiffEq and MTK it worked on first attempt today with the updates. I had another project pulling in the full DifferentialEquations package. There I hit the bug in BoundaryValueDiffEq on the first attempt but working on second attempt.

Thank you to everyone involved for providing a work around.

---

<div class="post-metadata">

**Author:** ![natlampen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/natlampen/32/36640_2.png) [@natlampen](https://discourse.julialang.org/u/natlampen)\
**Post date:** [May 24, 2024, 5:49am UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/70 "2024-05-24T05:49:19Z")

</div>

An update. Precompile seems to work but it seems the bug is now triggering for me during a call to solve. Not sure if I messed something else up.

---

<div class="post-metadata">

**Author:** ![anguille](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@anguille](https://discourse.julialang.org/u/anguille)\
**Post date:** [May 24, 2024, 6:53am UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/71 "2024-05-24T06:53:03Z")

</div>

I can confirm that for me ModelingToolkit 9.15.0 precompiles with either OrdinaryDiffEq@6.78.0 or @6.79.1.

Yesterday, on ModelingToolkit 9.14.0, it never precompiled on OrdinaryDiffEq@6.78.0 (I tried ~10 times), while it did on ODE@6.77.0 occasionally.

Thanks for the detective work!

---

<div class="post-metadata">

**Author:** ![natlampen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/natlampen/32/36640_2.png) [@natlampen](https://discourse.julialang.org/u/natlampen)\
**Post date:** [May 24, 2024, 8:07am UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/72 "2024-05-24T08:07:15Z")

</div>

Are you able to solve an ODE using the updated packages?

For me the most reliable solution is still to pin OrdinaryDiffEq to 6.75.

---

<div class="post-metadata">

**Author:** ![anguille](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@anguille](https://discourse.julialang.org/u/anguille)\
**Post date:** [May 24, 2024, 8:46am UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/73 "2024-05-24T08:46:28Z")

</div>

Indeed, if I run the example: [Acausal Component-Based Modeling · ModelingToolkit.jl](https://docs.sciml.ai/ModelingToolkit/stable/tutorials/acausal_components/)  
everything precompiles, but at the ‘solve’ I consistently hit:

```julia
Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffb847676bf -- gc_setmark_pool_ at C:/workdir/src\gc.c:876 [inlined]
gc_setmark_pool at C:/workdir/src\gc.c:895 [inlined]
gc_setmark at C:/workdir/src\gc.c:902 [inlined]
gc_setmark at C:/workdir/src\gc.c:898 [inlined]
gc_mark_outrefs at C:/workdir/src\gc.c:2606 [inlined]
gc_mark_loop_serial_ at C:/workdir/src\gc.c:2679
in expression starting at c:\Users\guill\Documents\AGU\MyPkg\test\tt.jl:86
...

```

On my usecase, I am dependent on ModelingToolkit via OptimisationMOI. For this scenario, the last releases did the trick.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 24, 2024, 2:33pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/74 "2024-05-24T14:33:05Z")

</div>

We can pull the new default ODE solver alg as it seems to hit the GC bug due to code size

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [May 24, 2024, 3:16pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/75 "2024-05-24T15:16:50Z")

</div>

Is the GC bug only influencing the precompilation stage? Or does it also influence the import (“using…”) and running of code?

If only precompilation, would it help to first add one of the larger dependencies of `ModelingToolkit` , e.g., `OrdinaryDiffEq`, then exit Julia (assuming that exit finishes GC), then restart Julia & add (the rest of) `ModelingToolkit`, exit and restart Julia, add a next package, and so on?

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [May 24, 2024, 3:38pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/76 "2024-05-24T15:38:56Z")

</div>

it’s not exactly a GC bug. The actual problem is a linker bug in lld, which causes the package images that precompilation creates to be loaded incorrectly. This incorrect loading means that the GC will see invalid data and segfault or throw an error.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 24, 2024, 6:43pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/77 "2024-05-24T18:43:23Z")

</div>

Try OrdinaryDiffEq v6.80.0. This should now work around this for even more cases. It should be put to rest finally.

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [May 24, 2024, 6:59pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/78 "2024-05-24T18:59:34Z")

</div>

The Pkg didn’t find 6.80.0 – so perhaps not published yet?

---

<div class="post-metadata">

**Author:** ![anguille](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@anguille](https://discourse.julialang.org/u/anguille)\
**Post date:** [May 24, 2024, 7:22pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/79 "2024-05-24T19:22:16Z")

</div>

Same error on `solve` for me on OrdinaryDiffEq v6.80.0 (commit 5144bfa).

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [May 24, 2024, 8:22pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/80 "2024-05-24T20:22:14Z")

</div>

that’s unfortunate. looks like this won’t be resolved until the issue is fixed for real on the Julia side.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [May 24, 2024, 8:45pm UTC](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492/81 "2024-05-24T20:45:29Z")

</div>

Which, as a breadcrumb, is being worked on in

> <https://github.com/JuliaLang/julia/pull/54572>
>
> Hopefully fixes https://github.com/JuliaLang/julia/issues/54550

[Previous page](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492.md?page=3)

[Next page](https://discourse.julialang.org/t/modelingtoolkit-takes-forever-to-precompile-on-windows-11/114492.md?page=5)
