This page shows how to create a sysimage with a precompile file.
My precompile script file (that would be precompile_plots.jl in the above URL) contains commands with arguments:
some_var = parse(Int64, ARGS[1]) == 1 ? "foo" : "bar"
However, when creating my System image, I get the following error that I guess is telling me that ARGS[1] is empty
julia> create_sysimage([
"JuMP",
"Gurobi",
"GLPK",
"Combinatorics",
"DelimitedFiles",
"Dates",
"Random",
"Distributions",
"Graphs",
"GraphsFlows",
"GraphPlot",
"Parameters",
"Formatting",
"Cairo",
"Suppressor"],
sysimage_path="sys_RRSP.so", precompile_execution_file="./src/RRSP_script.jl")
[ Info: PackageCompiler: Executing /home/julien/Documents/Travail/Thèse/Code/remote-Longchamp/1-R-RSP/src/RRSP_script.jl => /tmp/jl_packagecompiler_OvsG5w/jl_odOEfG
[ Info: Loading packages... (1/3)
[ Info: Loading packages... (2/3)
[ Info: Loading packages... DONE (3/3)
[ Info: Loading .jl files 0%
[ Info: Loading .jl files 25%
[ Info: Loading .jl files 50%
[ Info: Loading .jl files 75%
[ Info: Loading .jl files 100%
[ Info: 10.813912868499756
ERROR: LoadError: BoundsError: attempt to access 0-element Vector{String} at index [1]
Stacktrace:
[1] getindex(A::Vector{String}, i1::Int64)
@ Base ./essentials.jl:13
[2] top-level scope
@ ~/Documents/Travail/Thèse/Code/remote-Longchamp/1-R-RSP/src/RRSP_script.jl:55
in expression starting at /home/julien/Documents/Travail/Thèse/Code/remote-Longchamp/1-R-RSP/src/RRSP_script.jl:55
ERROR: failed process: Process(setenv(`/home/julien/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/bin/julia --color=yes --startup-file=no --pkgimages=no --sysimage=/home/julien/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/lib/julia/sys.so --compile=all --trace-compile=/tmp/jl_packagecompiler_OvsG5w/jl_odOEfG ./src/RRSP_script.jl`,["LSCOLORS=Gxfxcxdxbxegedabagacad", "QT_ACCESSIBILITY=1", "PAPERSIZE=a4", "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus", "GTK_OVERLAY_SCROLLING=1", "XDG_SESSION_TYPE=x11", "USER=julien", "XDG_CONFIG_DIRS=/etc/xdg/xdg-cinnamon:/etc/xdg", "INSIDE_NEMO_PYTHON=", "LC_NUMERIC=fr_FR.UTF-8" … "_=/home/julien/.juliaup/bin/julia", "ZSH=/home/julien/.oh-my-zsh", "XDG_SESSION_CLASS=user", "XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0", "MANDATORY_PATH=/usr/share/gconf/cinnamon.mandatory.path", "XDG_SESSION_ID=c2", "LC_NAME=fr_FR.UTF-8", "LC_IDENTIFICATION=fr_FR.UTF-8", "JULIA_LOAD_PATH=/home/julien/.julia/environments/v1.10:@stdlib", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:"]), ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error
@ Base ./process.jl:565 [inlined]
[2] run(::Cmd; wait::Bool)
@ Base ./process.jl:480
[3] run
@ ./process.jl:477 [inlined]
[4] run_precompilation_script(project::String, sysimg::String, precompile_file::String, precompile_dir::String)
@ PackageCompiler ~/.julia/packages/PackageCompiler/1fx6C/src/PackageCompiler.jl:305
[5] create_sysimg_object_file(object_file::String, packages::Vector{…}, packages_sysimg::Set{…}; project::String, base_sysimage::String, precompile_execution_file::Vector{…}, precompile_statements_file::Vector{…}, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, extra_precompiles::String, incremental::Bool)
@ PackageCompiler ~/.julia/packages/PackageCompiler/1fx6C/src/PackageCompiler.jl:343
[6] create_sysimg_object_file
@ ~/.julia/packages/PackageCompiler/1fx6C/src/PackageCompiler.jl:310 [inlined]
[7] create_sysimage(packages::Vector{…}; sysimage_path::String, project::String, precompile_execution_file::String, precompile_statements_file::Vector{…}, incremental::Bool, filter_stdlibs::Bool, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, include_transitive_dependencies::Bool, base_sysimage::Nothing, julia_init_c_file::Nothing, julia_init_h_file::Nothing, version::Nothing, soname::Nothing, compat_level::String, extra_precompiles::String)
@ PackageCompiler ~/.julia/packages/PackageCompiler/1fx6C/src/PackageCompiler.jl:620
[8] top-level scope
@ REPL[3]:1
Some type information was truncated. Use `show(err)` to see complete types.
How can I create a sysimage and handle user input arguments?