Skip to content
This repository was archived by the owner on Jun 9, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/src/sysimages.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ If this is the first time `create_sysimage` is called with `replace_default`, a
backup of the default sysimage is created. The default sysimage can then be
restored with [`restore_default_sysimage()`](@ref).

!!! note

Automatically replacing the default sysimage does not work well on Windows
since replacing open files is problematic there. Therefore, on
Windows, it is in general better to manually replace the default sysimage
(the `lib/julia/sys.dll` file in the installation folder) than to use the
more automatic functionalities.

Note that sysimages are created "incrementally" in the sense that they add to
the sysimage of the process running PackageCompilerX. If the default sysimage
has been replaced, the next `create_sysimage` call will create a new sysimage
Expand Down
17 changes: 13 additions & 4 deletions src/PackageCompilerX.jl
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,13 @@ by setting the envirnment variable `JULIA_CC` to a path to a compiler
- `filter_stdlibs::Bool`: If `true`, only include stdlibs that are in the project file.
Defaults to `false`, only set to `true` if you know the potential pitfalls.

- `replace_default::Bool`: If `true`, replaces the default system image which is automatically
used when Julia starts. To replace with the one Julia ships with, use [`restore_default_sysimage()`](@ref)
- `replace_default::Bool`: If `true`, replaces the default system image which
is automatically used when Julia starts. To restore the default sysimage to one
Julia ships with, use [`restore_default_sysimage()`](@ref). Note that this
option does not work well on Windows since replacing open files is problematic
on Windows. Therefore, on Windows, it is in general better to manually replace
the default sysimage (the `lib/julia/sys.dll` file in the installation folder)
than to use this option.

- `cpu_target::String`: The value to use for `JULIA_CPU_TARGET` when building the system image.
"""
Expand Down Expand Up @@ -382,8 +387,12 @@ end
"""
restore_default_sysimage()

Restores the default system image to the one that Julia shipped with.
Useful after running [`create_sysimage`](@ref) with `replace_default=true`.
Restores the default system image to the one that Julia shipped with. Useful
after running [`create_sysimage`](@ref) with `replace_default=true`. Note that
this function does not work well on Windows since replacing open files is
problematic on Windows. Therefore, on Windows, it is in general better to
manually replace and restore the default sysimage (the `lib/julia/sys.dll`
file in the installation folder) than to use this function.
"""
function restore_default_sysimage()
if !isfile(backup_default_sysimg_path())
Expand Down