JuliaLang/PackageCompiler.jl

[FR] Do basic checks before compilation

开放

#735 创建于 2022年11月2日

 (1 条评论) (1 个反应) (0 位负责人)Julia (200 个派生)batch import
feature requestgood first issue

仓库指标

星标
 (1,538 个星标)
PR 合并指标
 (平均合并 19天 6小时) (30 天内合并 4 个 PR)

描述

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.

贡献者指南