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.

貢獻者指南