# Package keeps precompiling after starting Julia every single time

**URL:** <https://discourse.julialang.org/t/package-keeps-precompiling-after-starting-julia-every-single-time/112843>\
**Category:** Performance\
**Created:** [April 11, 2024, 7:02pm UTC](https://discourse.julialang.org/t/package-keeps-precompiling-after-starting-julia-every-single-time/112843 "2024-04-11T19:02:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![claud10c](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/claud10c/32/208423_2.png) [@claud10c](https://discourse.julialang.org/u/claud10c)\
**Post date:** [April 11, 2024, 7:02pm UTC](https://discourse.julialang.org/t/package-keeps-precompiling-after-starting-julia-every-single-time/112843/1 "2024-04-11T19:02:57Z")

</div>

I have created a package for computing maximum independent sets. The package uses two JLL wrappers built by me as well.

The package is registered and you can load it using `] add MaximumIndependentSet`. The source code is available at [https://github.com/claud10cv/MaximumIndependentSet.jl](https://github.com/claud10cv/MaximumIndependentSet.jl). Please find below a MWE to use it:

```julia
using MaximumIndependentSet
using Graphs

g = random_regular_graph(20, 5; seed = 0)
mis_heuristic(g)
mis_cut_branching(g)

```

The problem I am having is with precompilation. The package keeps precompiling after starting a new session every single time and I do not understand why.

I am using this package in developing another module, for which I get the following warning upon running `julia test/runtests.jl` when run using julia 1.11 beta (we observe the same behavior with 1.10):

```julia
Precompiling pDPC...
  2 dependencies successfully precompiled in 39 seconds. 130 already precompiled.
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for pDPC [0199f61d-1342-4d9a-8db3-fcbec540a409]
│ exception = Required dependency Base.PkgId(Base.UUID("9e812ceb-42a3-473a-b295-b8bb2099a8ce"), "MaximumIndependentSet") failed to load from a cache file.
└ @ Base loading.jl:2407
Precompiling MaximumIndependentSet...
  1 dependency successfully precompiled in 4 seconds. 83 already precompiled.

```

I believe that this issue is related to [Precompiling module each time without any change](https://discourse.julialang.org/t/precompiling-module-each-time-without-any-change/99711) but the solution proposed (add the lib extension to the line `@wrapmodule () ...`) looks more like a workaround to me, and moreover I tried it without success

---

<div class="post-metadata">

**Author:** ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Post date:** [April 11, 2024, 8:38pm UTC](https://discourse.julialang.org/t/package-keeps-precompiling-after-starting-julia-every-single-time/112843/2 "2024-04-11T20:38:58Z")

</div>

I think this is a regression in loading due to the pkgimage relocation feature in v1.11. Will take a look!

---

<div class="post-metadata">

**Author:** ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Post date:** [April 11, 2024, 9:14pm UTC](https://discourse.julialang.org/t/package-keeps-precompiling-after-starting-julia-every-single-time/112843/3 "2024-04-11T21:14:22Z")

</div>

> … when run using julia 1.11 beta (we observe the same behavior with 1.10)

Sorry, I overlooked that this also happens on v1.10. Then its unrelated to relocation.

The problem is caused by `CxxWrap.@wrapmodule`. That macro adds an `include_dependency(path)` to your pkg, but it does not generate a file or directory there. This causes the repeated precompilation.

Need to understand whether that’s a problem of `CxxWrap` or Julia Base.
