Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ jobs:
coverage: 'false'
app-configuration: default
extended-tests: none
- julia-version: '1.12' # current stable
- julia-version: '1.13' # current stable
github-runner: ubuntu-latest
coverage: 'true'
app-configuration: filtered
extended-tests: sysimage
- julia-version: '1.12'
- julia-version: '1.13'
github-runner: windows-latest
coverage: 'false'
app-configuration: default
extended-tests: library
- julia-version: '1.12'
- julia-version: '1.13'
github-runner: macos-15 # Apple Silicon
coverage: 'false'
app-configuration: default
extended-tests: library
- julia-version: '1.12'
- julia-version: '1.13'
github-runner: macos-15-intel
coverage: 'false'
app-configuration: incremental
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
matrix:
julia-version:
- '1.10' # current LTS
- '1.12' # current stable
- '1.13' # current stable
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: julia-actions/setup-julia@5c9647d97b78a5debe5164e9eec09d653d29bd71 # v2.6.1
Expand Down
18 changes: 18 additions & 0 deletions src/PackageCompiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ else
end
const TLS_SYNTAX = `-DNEW_DEFINE_FAST_TLS_SYNTAX`

# Resolve the `sysimage` cpu target keyword (Julia 1.13+) to the concrete target of
# `sysimage`. Child processes started without a sysimage (non-incremental builds) would
# otherwise expand it to `native`, and Julia 1.13.0 stores the keyword itself in the image
# it builds, which breaks loading that image with `--cpu-target=sysimage`
# (JuliaLang/julia#63220). The target is queried in a fresh process because
# `Sys.sysimage_target()` reports the most recently loaded image, so its value is
# overwritten as soon as any package image is loaded.
function expand_sysimage_cpu_target(cpu_target::String,
sysimage::String=unsafe_string(Base.JLOptions().image_file))
(cpu_target == "sysimage" || startswith(cpu_target, "sysimage;")) || return cpu_target
isdefined(Sys, :sysimage_target) || return cpu_target
target = read(`$(get_julia_cmd()) --sysimage=$sysimage -e 'print(Sys.sysimage_target())'`, String)
return target * cpu_target[9:end]
end

const DEFAULT_EMBEDDING_WRAPPER = @path joinpath(@__DIR__, "embedding_wrapper.c")
const DEFAULT_JULIA_INIT = @path joinpath(@__DIR__, "julia_init.c")
const DEFAULT_JULIA_INIT_HEADER = @path joinpath(@__DIR__, "julia_init.h")
Expand Down Expand Up @@ -802,6 +817,9 @@ function create_sysimage(packages::Union{Nothing, String, Symbol, Vector{String}
@debug "instantiating project at $(repr(project))"
Pkg.instantiate(ctx, verbose=true, allow_autoprecomp = false)

cpu_target = expand_sysimage_cpu_target(cpu_target,
something(base_sysimage, unsafe_string(Base.JLOptions().image_file)))

if !incremental
if base_sysimage !== nothing
error("cannot specify `base_sysimage` when `incremental=false`")
Expand Down
10 changes: 10 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ end
@testset "PackageCompiler.jl" begin
expected_sysimage_cpu_target = VERSION >= v"1.13-" ? "sysimage" : "native"
@test PackageCompiler.DEFAULT_SYSIMAGE_CPU_TARGET == expected_sysimage_cpu_target
@test PackageCompiler.expand_sysimage_cpu_target("native") == "native"
if VERSION >= v"1.13-"
# Query in a fresh process: package images loaded here overwrite `Sys.sysimage_target()`
sysimage_target = read(`$(Base.julia_cmd()) --startup-file=no -e 'print(Sys.sysimage_target())'`, String)
@test sysimage_target != "sysimage"
@test PackageCompiler.expand_sysimage_cpu_target("sysimage") == sysimage_target
@test PackageCompiler.expand_sysimage_cpu_target("sysimage;native") == sysimage_target * ";native"
else
@test PackageCompiler.expand_sysimage_cpu_target("sysimage") == "sysimage"
end

@testset "julia_libdir / julia_private_libdir" begin
lib_dir = PackageCompiler.julia_libdir()
Expand Down
Loading