Skip to content

Commit 6b0adaa

Browse files
authored
Avoid name clashes in PrecompileStagingArea (#837)
1 parent 7f0607c commit 6b0adaa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/PackageCompiler.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ function create_sysimg_object_file(object_file::String,
423423

424424
julia_code = String(take!(julia_code_buffer))
425425
outputo_file = tempname()
426+
@debug "writing precompile staging code to $outputo_file"
426427
write(outputo_file, julia_code)
427428
# Read the input via stdin to avoid hitting the maximum command line limit
428429

@@ -805,7 +806,7 @@ function create_app(package_dir::String,
805806
# add precompile statements for functions that will be called from the C main() wrapper
806807
precompiles = String[]
807808
for (_, julia_main) in executables
808-
push!(precompiles, "import $package_name")
809+
push!(precompiles, "@isdefined($package_name) || (import $package_name)")
809810
push!(precompiles, "isdefined($package_name, :$julia_main) && precompile(Tuple{typeof($package_name.$julia_main)})")
810811
end
811812
push!(precompiles, "precompile(Tuple{typeof(append!), Vector{String}, Vector{Any}})")

0 commit comments

Comments
 (0)