JuliaLang / JuliaLang/PackageCompiler.jl

create_app doesn't include artifacts needed by Pkg

Open
#719 6 comments 1 reaction 0 assignees View on GitHub
bug fixed
Dominant language
Julia
Stars
1.6k
Forks
205
Avg merge
18h 37m
Merged PRs (30d)
7

Description

I'm unable to create a functioning app that uses `Pkg`.
# Recreating the error
1. Generate a package with `Pkg` as a dependency:
```
julia> using Pkg
julia> Pkg.generate("MyPackage")
pkg> activate MyPackage
pkg> add Pkg
```
2. Edit `MyPackage/src/MyPackage.jl`:
```
module MyPackage
export julia_main
using Pkg

function julia_main()::Cint
Pkg.status()
return 0
end

end # module MyPackage
```
3. Make an app:
```
pkg> activate --temp
julia> using PackageCompiler
julia> create_app("MyPackage", "Compiled", incremental=true)
```
The app compiles successfully, but running it returns an error due to `p7zip_jll` being missing. This occurs even if I insert the standard libraries into the Project file with `Pkg.add([x[1] for x in values(Pkg.Types.stdlibs())])`. The issue exists on Linux, MacOS, and Windows.

# Workaround
If I manually install 7Zip, the error message becomes clearer:
```
IOError: readdir("/home/aharri69/temp/Compiled/share/julia/stdlib/v1.8"): no such file or directory (ENOENT)
```
Then, if I copy `share/julia/stdlib/v1.8/` from my local Julia install, the executable works as expected.

# Question
Should the artifacts for standard libraries be copied by default, since they are required for the executable to run?

# Note
My goal is to assemble a standalone Julia installation that can be copied onto a secure server with no internet access. @DilumAluthge recommended trying `create_sysimage()` or `create_app()` for this, even though this is a tangential use case. Essentially, I'd like to make an app but delete the executable, leaving behind a Julia installation without external dependencies.

# Update
I ended up using `create_sysimage` to generate the sysimage, bundling this with the artifacts directory and Julia files, and setting the environment manually. An example workflow can be found [here](https://github.com/bcbi/SIEGE).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the documented create_app("MyPackage", "Compiled", incremental=true) workflow with Pkg as a dependency on an offline system. Inspect the generated Compiled tree for the missing p7zip_jll artifact and share/julia/stdlib/v1.8 files. Done means the resulting app runs without manually copying Julia standard-library files or installing 7Zip.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.