# Cannot use apps created with PackageCompiler that have LLVM.jl in them

**URL:** https://discourse.julialang.org/t/cannot-use-apps-created-with-packagecompiler-that-have-llvm-jl-in-them/79986
**Category:** General Usage
**Tags:** question, package-compiler, app
**Created:** [April 25, 2022, 1:11pm UTC](https://discourse.julialang.org/t/cannot-use-apps-created-with-packagecompiler-that-have-llvm-jl-in-them/79986 "2022-04-25T13:11:29Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![thazhemadam](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@thazhemadam](https://discourse.julialang.org/u/thazhemadam)
#### Post date: [April 25, 2022, 1:11pm UTC](https://discourse.julialang.org/t/cannot-use-apps-created-with-packagecompiler-that-have-llvm-jl-in-them/79986/1 "2022-04-25T13:11:29Z")

</div>

I’m trying to create an app with LLVM.jl in it.  
The `create_app` call runs successfully, but I get an error when I try to run the app itself because the `LLVMExtra` artifact is apparently not downloaded and set up while the app is getting created.  
How can I fix this?

# Stacktrace

```julia
~ ❯ MyAppCompiled/bin/MyApp
  Downloaded artifact: LLVMExtra
  Downloaded artifact: LLVMExtra
fatal: error thrown and no exception handler available.
InitError(mod=:LLVMExtra_jll, error=ErrorException("Unable to automatically install 'LLVMExtra' from '/home/thazhemadam/.julia/packages/LLVMExtra_jll/y3M2E/Artifacts.toml'"))
error at ./error.jl:33
#ensure_artifact_installed#23 at /home/thazhemadam/packages/julias/julia-1.7/share/julia/stdlib/v1.7/Pkg/src/Artifacts.jl:441
ensure_artifact_installed##kw at /home/thazhemadam/packages/julias/julia-1.7/share/julia/stdlib/v1.7/Pkg/src/Artifacts.jl:413
unknown function (ip: 0x7f8352022a3d)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
#ensure_artifact_installed#22 at /home/thazhemadam/packages/julias/julia-1.7/share/julia/stdlib/v1.7/Pkg/src/Artifacts.jl:404
unknown function (ip: 0x7f8352014faa)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
ensure_artifact_installed##kw at /home/thazhemadam/packages/julias/julia-1.7/share/julia/stdlib/v1.7/Pkg/src/Artifacts.jl:399
unknown function (ip: 0x7f8352014c98)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
_artifact_str at /home/thazhemadam/packages/julias/julia-1.7/share/julia/stdlib/v1.7/Artifacts/src/Artifacts.jl:547
unknown function (ip: 0x7f8352012247)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
jl_f__call_latest at /buildworker/worker/package_linux64/build/src/builtins.c:757
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
do_apply at /buildworker/worker/package_linux64/build/src/builtins.c:713
#invokelatest#2 at ./essentials.jl:716
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
do_apply at /buildworker/worker/package_linux64/build/src/builtins.c:713
invokelatest at ./essentials.jl:714
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:126
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:215
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:166 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:587
jl_fptr_interpret_call at /buildworker/worker/package_linux64/build/src/interpreter.c:675
macro expansion at /home/thazhemadam/packages/julias/julia-1.7/share/julia/stdlib/v1.7/Artifacts/src/Artifacts.jl:689 [inlined]
find_artifact_dir at /home/thazhemadam/.julia/packages/JLLWrappers/QpMQW/src/wrapper_generators.jl:13
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
__init__ at /home/thazhemadam/.julia/packages/LLVMExtra_jll/y3M2E/src/wrappers/x86_64-linux-gnu-cxx11-llvm_version+12.jl:7
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2247 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2429
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1788 [inlined]
jl_module_run_initializer at /buildworker/worker/package_linux64/build/src/toplevel.c:73
_finish_julia_init at /buildworker/worker/package_linux64/build/src/init.c:796
julia_init at /buildworker/worker/package_linux64/build/src/init.c:730
jl_init_with_image at /buildworker/worker/package_linux64/build/src/jlapi.c:74
jl_init at /buildworker/worker/package_linux64/build/src/jlapi.c:90
main at MyAppCompiled/bin/MyApp (unknown line)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
_start at MyAppCompiled/bin/MyApp (unknown line)

```

# Reproducer

```julia
julia> using Pkg, PackageCompiler;
julia> Pkg.generate("MyApp");
julia> Pkg.activate("MyApp");
julia> Pkg.add("LLVM");
julia> open("MyApp/src/MyApp.jl", "w") do io
           write(io,
       """
       module MyApp
       using LLVM

       function julia_main()::Cint
           @info "Hello World from LLVM!"
           return 0
       end

       end
       """
       )
       end
julia> create_app("MyApp", "MyAppCompiled");

```

---

<div class="post-metadata">

### Author: ![guixien](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/guixien/32/34399_2.png) [@guixien](https://discourse.julialang.org/u/guixien)
#### Post date: [April 29, 2022, 8:45am UTC](https://discourse.julialang.org/t/cannot-use-apps-created-with-packagecompiler-that-have-llvm-jl-in-them/79986/2 "2022-04-29T08:45:01Z")

</div>

Seems like I am having the same problem as well.

`PackageCompiler: compiling incremental system imagejulia: /buildworker/worker/package_linux64/build/usr/include/llvm/Support/Casting.h:269: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::GlobalVariable; Y = llvm::GlobalValue; typename llvm::cast_retty<X, Y*>::ret_type = llvm::GlobalVariable*]: Assertion isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.`

---

<div class="post-metadata">

### Author: ![thazhemadam](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@thazhemadam](https://discourse.julialang.org/u/thazhemadam)
#### Post date: [May 3, 2022, 11:22am UTC](https://discourse.julialang.org/t/cannot-use-apps-created-with-packagecompiler-that-have-llvm-jl-in-them/79986/3 "2022-05-03T11:22:05Z")

</div>

Hi, @guixien! The issue you’re facing isn’t the same as the one I’ve posted.  
The issue you’re seeing has been fixed by [Multiversioning: support for aliases (from @ccallable) by maleadt · Pull Request #37530 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/37530). Hope this helps.
