Skip to content

Commit ea3a4ca

Browse files
committed
Revert "Allow setting a command prefix for the sysimage build command"
It is not necessary to provide a prefix in the build phase but it may be necessary when the script given by `precompile_execution_file` is executed, e.g. if some package requires the script to be run in an MPI context via `mpirun`. Thus, this reverts commit d3b7edc.
1 parent d3b7edc commit ea3a4ca

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

Diff for: src/PackageCompiler.jl

+6-26
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@ function rewrite_sysimg_jl_only_needed_stdlibs(stdlibs::Vector{String})
220220
r"stdlibs = \[(.*?)\]"s => string("stdlibs = [", join(":" .* stdlibs, ",\n"), "]"))
221221
end
222222

223-
function create_fresh_base_sysimage(stdlibs::Vector{String}; cpu_target::String,
224-
sysimage_build_args::Cmd, sysimage_build_prefix::Cmd)
223+
function create_fresh_base_sysimage(stdlibs::Vector{String}; cpu_target::String, sysimage_build_args::Cmd)
225224
tmp = mktempdir()
226225
sysimg_source_path = Base.find_source_file("sysimg.jl")
227226
base_dir = dirname(sysimg_source_path)
@@ -239,7 +238,7 @@ function create_fresh_base_sysimage(stdlibs::Vector{String}; cpu_target::String,
239238
TerminalSpinners.@spin spinner begin
240239
cd(base_dir) do
241240
# Create corecompiler.ji
242-
cmd = `$sysimage_build_prefix $(get_julia_cmd()) --cpu-target $cpu_target
241+
cmd = `$(get_julia_cmd()) --cpu-target $cpu_target
243242
--output-ji $tmp_corecompiler_ji $sysimage_build_args
244243
$compiler_source_path`
245244
@debug "running $cmd"
@@ -252,7 +251,7 @@ function create_fresh_base_sysimage(stdlibs::Vector{String}; cpu_target::String,
252251
new_sysimage_source_path = joinpath(tmp, "sysimage_packagecompiler_$(uuid1()).jl")
253252
write(new_sysimage_source_path, new_sysimage_content)
254253
try
255-
cmd = `$sysimage_build_prefix $(get_julia_cmd()) --cpu-target $cpu_target
254+
cmd = `$(get_julia_cmd()) --cpu-target $cpu_target
256255
--sysimage=$tmp_corecompiler_ji
257256
$sysimage_build_args --output-ji=$tmp_sys_ji
258257
$new_sysimage_source_path`
@@ -304,7 +303,6 @@ function create_sysimg_object_file(object_file::String,
304303
cpu_target::String,
305304
script::Union{Nothing, String},
306305
sysimage_build_args::Cmd,
307-
sysimage_build_prefix::Cmd,
308306
extra_precompiles::String,
309307
incremental::Bool)
310308
julia_code_buffer = IOBuffer()
@@ -431,7 +429,7 @@ function create_sysimg_object_file(object_file::String,
431429
write(outputo_file, julia_code)
432430
# Read the input via stdin to avoid hitting the maximum command line limit
433431

434-
cmd = `$sysimage_build_prefix $(get_julia_cmd()) --cpu-target=$cpu_target $sysimage_build_args
432+
cmd = `$(get_julia_cmd()) --cpu-target=$cpu_target $sysimage_build_args
435433
--sysimage=$base_sysimage --project=$project --output-o=$(object_file)
436434
$outputo_file`
437435
@debug "running $cmd"
@@ -489,9 +487,6 @@ compiler (can also include extra arguments to the compiler, like `-g`).
489487
490488
- `sysimage_build_args::Cmd`: A set of command line options that is used in the Julia process building the sysimage,
491489
for example `-O1 --check-bounds=yes`.
492-
493-
- `sysimage_build_prefix::Cmd`: A set of commands and command line options that will be
494-
prefixed to the call to Julia for building the sysimage, for example `srun -n 1`.
495490
"""
496491
function create_sysimage(packages::Union{Nothing, Symbol, Vector{String}, Vector{Symbol}}=nothing;
497492
sysimage_path::String,
@@ -503,7 +498,6 @@ function create_sysimage(packages::Union{Nothing, Symbol, Vector{String}, Vector
503498
cpu_target::String=NATIVE_CPU_TARGET,
504499
script::Union{Nothing, String}=nothing,
505500
sysimage_build_args::Cmd=``,
506-
sysimage_build_prefix::Cmd=``,
507501
include_transitive_dependencies::Bool=true,
508502
# Internal args
509503
base_sysimage::Union{Nothing, String}=nothing,
@@ -551,8 +545,7 @@ function create_sysimage(packages::Union{Nothing, Symbol, Vector{String}, Vector
551545
error("cannot specify `base_sysimage` when `incremental=false`")
552546
end
553547
sysimage_stdlibs = filter_stdlibs ? gather_stdlibs_project(ctx) : stdlibs_in_sysimage()
554-
base_sysimage = create_fresh_base_sysimage(sysimage_stdlibs; cpu_target,
555-
sysimage_build_args, sysimage_build_prefix)
548+
base_sysimage = create_fresh_base_sysimage(sysimage_stdlibs; cpu_target, sysimage_build_args)
556549
else
557550
base_sysimage = something(base_sysimage, unsafe_string(Base.JLOptions().image_file))
558551
end
@@ -610,7 +603,6 @@ function create_sysimage(packages::Union{Nothing, Symbol, Vector{String}, Vector
610603
cpu_target,
611604
script,
612605
sysimage_build_args,
613-
sysimage_build_prefix,
614606
extra_precompiles,
615607
incremental)
616608
object_files = [object_file]
@@ -796,9 +788,6 @@ compiler (can also include extra arguments to the compiler, like `-g`).
796788
- `sysimage_build_args::Cmd`: A set of command line options that is used in the Julia process building the sysimage,
797789
for example `-O1 --check-bounds=yes`.
798790
799-
- `sysimage_build_prefix::Cmd`: A set of commands and command line options that will be
800-
prefixed to the call to Julia for building the sysimage, for example `srun -n 1`.
801-
802791
- `script::String`: Path to a file that gets executed in the `--output-o` process.
803792
"""
804793
function create_app(package_dir::String,
@@ -813,7 +802,6 @@ function create_app(package_dir::String,
813802
cpu_target::String=default_app_cpu_target(),
814803
include_lazy_artifacts::Bool=false,
815804
sysimage_build_args::Cmd=``,
816-
sysimage_build_prefix::Cmd=``,
817805
include_transitive_dependencies::Bool=true,
818806
include_preferences::Bool=true,
819807
script::Union{Nothing, String}=nothing)
@@ -863,7 +851,6 @@ function create_app(package_dir::String,
863851
precompile_statements_file,
864852
cpu_target,
865853
sysimage_build_args,
866-
sysimage_build_prefix,
867854
include_transitive_dependencies,
868855
extra_precompiles = join(precompiles, "\n"),
869856
script)
@@ -999,9 +986,6 @@ compiler (can also include extra arguments to the compiler, like `-g`).
999986
1000987
- `sysimage_build_args::Cmd`: A set of command line options that is used in the Julia process building the sysimage,
1001988
for example `-O1 --check-bounds=yes`.
1002-
1003-
- `sysimage_build_prefix::Cmd`: A set of commands and command line options that will be
1004-
prefixed to the call to Julia for building the sysimage, for example `srun -n 1`.
1005989
"""
1006990
function create_library(package_or_project::String,
1007991
dest_dir::String;
@@ -1019,7 +1003,6 @@ function create_library(package_or_project::String,
10191003
cpu_target::String=default_app_cpu_target(),
10201004
include_lazy_artifacts::Bool=false,
10211005
sysimage_build_args::Cmd=``,
1022-
sysimage_build_prefix::Cmd=``,
10231006
include_transitive_dependencies::Bool=true,
10241007
include_preferences::Bool=true,
10251008
script::Union{Nothing,String}=nothing
@@ -1070,8 +1053,7 @@ function create_library(package_or_project::String,
10701053

10711054
create_sysimage_workaround(ctx, sysimg_path, precompile_execution_file,
10721055
precompile_statements_file, incremental, filter_stdlibs, cpu_target;
1073-
sysimage_build_args, sysimage_build_prefix,
1074-
include_transitive_dependencies, julia_init_c_file,
1056+
sysimage_build_args, include_transitive_dependencies, julia_init_c_file,
10751057
julia_init_h_file, version, soname, script)
10761058

10771059
if version !== nothing && Sys.isunix()
@@ -1131,7 +1113,6 @@ function create_sysimage_workaround(
11311113
filter_stdlibs::Bool,
11321114
cpu_target::String;
11331115
sysimage_build_args::Cmd,
1134-
sysimage_build_prefix::Cmd,
11351116
include_transitive_dependencies::Bool,
11361117
julia_init_c_file::Union{Nothing,String,Vector{String}},
11371118
julia_init_h_file::Union{Nothing,String,Vector{String}},
@@ -1170,7 +1151,6 @@ function create_sysimage_workaround(
11701151
version,
11711152
soname,
11721153
sysimage_build_args,
1173-
sysimage_build_prefix,
11741154
include_transitive_dependencies)
11751155

11761156
return

0 commit comments

Comments
 (0)