JuliaLang/PackageCompiler.jl

[FR] Do basic checks before compilation

Open

#735 opened on Nov 2, 2022

 (1 comment) (1 reaction) (0 assignees)Julia (200 forks)batch import
feature requestgood first issue

Repository metrics

Stars
 (1,538 stars)
PR merge metrics
 (Avg merge 19d 6h) (4 merged PRs in 30d)

Description

Hi! First, thanks for your work. I tried to compile a sysimage and I ran into a trivial error:

julia> create_sysimage(["Plots", "FFTW"]; sysimage_path="~/Julia/test.so")
✔ [05m:22s] PackageCompiler: compiling incremental system image
ERROR: IOError: mkdir("~"; mode=0o777): permission denied (EACCES)
Stacktrace:
 [1] uv_error
   @ ./libuv.jl:97 [inlined]
 [2] mkdir(path::String; mode::UInt16)
   @ Base.Filesystem ./file.jl:185
 [3] mkpath(path::String; mode::UInt16)
   @ Base.Filesystem ./file.jl:241
 [4] mkpath(path::String; mode::UInt16)
   @ Base.Filesystem ./file.jl:239
 [5] mkpath
   @ ./file.jl:235 [inlined]
 [6] create_sysimg_from_object_file(object_files::Vector{String}, sysimage_path::String; version::Nothing, compat_level::String, soname::Nothing)
   @ PackageCompiler ~/.julia/packages/PackageCompiler/DKijm/src/PackageCompiler.jl:557
 [7] create_sysimage(packages::Vector{String}; sysimage_path::String, project::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, 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, version::Nothing, soname::Nothing, compat_level::String, extra_precompiles::String)
   @ PackageCompiler ~/.julia/packages/PackageCompiler/DKijm/src/PackageCompiler.jl:529
 [8] top-level scope
   @ REPL[10]:1

I assumed Julia would recognize ~ as the home directory. No big problem, but I wondered: in this case, compilation took only about 5 min. In bigger use case, it would be more, and that time is wasted if you have to reissue the command. In basic errors like this (mispelled paths, or permission denied), would it make sense to move these checks before the compilation? In that way, the user could immediately correct the problem, and wait for compilation when they are (reasonably) confident the process will have success.

Contributor guide