Open krynju opened 4 months ago
It looks like the issue is not type piracy but method overwriting?
Yes, but technically type piracy is the only(?) way to achieve this
I'm glad it's validating this and it's throwing warnings/errors, although it would be nice to somehow opt out of errors for this use case.
Currently the only workaround for this is to remove any type piracy on Base from the base sysimage layer, which turns out to be a difficult thing to do (not impossible though)
There's piracy in many major packages like:
Also Compat.jl is a type piracy factory when used in some Julia version / Compat.jl version configurations
We also ran into this as we previously used method overwriting as an ugly hack to workaround the problem described here: https://github.com/JuliaLang/PackageCompiler.jl/issues/743#issuecomment-1889969005
In Julia versions 1.9 and earlier, during sysimg compilation we were able to overwrite _artifact_str
to download all artifacts rather than just the lazy ones, so that any missing artifacts would be downloaded during julia_init
. In 1.10+, that is no longer an option because of this change - obviously the previous solution was pretty hacky but at least was functional. Of course if there is any suggestion for a better solution that would be great
https://github.com/JuliaLang/julia/pull/50578 for reference when this was introduced.
Let's assume you have two different packages that do the same type piracy on
Base
. For exampleBase.any(a::Float64) = "a"
(as in the attached example)While unlikely in standard situations it can happen when you artifically modify the UUID on one package to effectively have two versions of the same package in separate sysimage layers.
A simple example could be that you have DataFrames.jl in the base layer with OrderedCollections.jl (which has type piracy) and then in the next layer you add a different package that also depends on OrderedCollections.jl. Note that in this example you swap the uuids of DataFrames.jl and OrderedCollections in the base layer to allow adding any packags in the next layer without any conflicts.
This used to work in 1.9, but now in 1.10 it doesn't.
Example (also everything attached in a zip below) sysimage_issue.zip
Package A
Package B
Script
Runs
1.9
1.10