JuliaLang / JuliaLang/PackageCompiler.jl

[FR] Do basic checks before compilation

Open
#735 1 comment 1 reaction 0 assignees View on GitHub
feature request good first issue
Dominant language
Julia
Stars
1.6k
Forks
205
Avg merge
18h 37m
Merged PRs (30d)
7

Description

Hi! First, thanks for your work.
I tried to compile a sysimage and I ran into a trivial error:
```julia
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

No contributing guide indexed for this repository

Research direction

Start by tracing create_sysimage and create_sysimg_from_object_file in src/PackageCompiler.jl, especially the referenced lines around 529 and 557, and reproduce the failure with a sysimage_path containing `~`. Determine which path and permission checks can happen before compilation; done means invalid paths fail early while valid sysimage compilation still proceeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.