Problem with PackageCompiler

We have the following MWE. Project structure:

image

package1.jl

module package1

Base.@ccallable function julia_main()::Cint
    try
        testApp()
    catch
        Base.invokelatest(Base.display_error, Base.catch_stack())
        return 1
    end
    return 0
end

function testApp()
    filehandle = open("$(@__DIR__)/input.txt", "w")
    write(filehandle, "Hello world!")
    close(filehandle)
end 

end 

compile.jl

using Pkg
Pkg.activate("$(@__DIR__)")
Pkg.resolve()
Pkg.instantiate()

using PackageCompiler
create_app("$(@__DIR__)", "$(@__DIR__)\\generated"; force=true)

Project.toml

name = "package1"
uuid = "6c5e6a99-2dd1-4d89-97f7-17c00267c19c"

[deps]
PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"

Running include("compile.jl") on Julia 1.8.0-beta1 onward we see

julia> include("compile.jl")
  Activating project at `C:\Users\Win10\source\repos\julia\discourse\package1.jl`
  No Changes to `C:\Users\Win10\source\repos\julia\discourse\package1.jl\Project.toml` 
  No Changes to `C:\Users\Win10\source\repos\julia\discourse\package1.jl\Manifest.toml`
✔ [02m:21s] PackageCompiler: compiling base system image (incremental=false)
Precompiling project...
  7 dependencies successfully precompiled in 46 seconds
✔ [03m:03s] PackageCompiler: compiling incremental system image

On Julia 1.7.2 and below we get

julia> include("compile.jl")
  Activating project at `C:\Users\Win10\source\repos\julia\discourse\package1.jl`
  No Changes to `C:\Users\Win10\source\repos\julia\discourse\package1.jl\Project.toml`
  No Changes to `C:\Users\Win10\source\repos\julia\discourse\package1.jl\Manifest.toml`
✔ [02m:30s] PackageCompiler: compiling base system image (incremental=false)
Precompiling project...
  7 dependencies successfully precompiled in 44 seconds
⠙ [00m:21s] PackageCompiler: compiling incremental system imageAssertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible type!", file /cygdrive/c/buildbot/worker/package_win64/build/usr/include/llvm/Support/Casting.h, line 269

signal (22): SIGABRT

Who is to blame?

Of course T.J. is to blame… wait, oops, wrong game…

1 Like

Seriously, is this a problem of PackageCompiler, Julia or are we to blame?

Edit: I filed an issue.

I can confirm this issue - found this thread after googling the cast assertion for my own app. 1.8.0-beta1 works fine.

1 Like