# Standalone PackageCompiler app with Plots fails with GR\_jll error

**URL:** <https://discourse.julialang.org/t/standalone-packagecompiler-app-with-plots-fails-with-gr-jll-error/81507>\
**Category:** General Usage\
**Tags:** question, package-compiler, plots\
**Created:** [May 23, 2022, 12:36pm UTC](https://discourse.julialang.org/t/standalone-packagecompiler-app-with-plots-fails-with-gr-jll-error/81507 "2022-05-23T12:36:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ConnectedSystems](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/connectedsystems/32/16815_2.png) [@ConnectedSystems](https://discourse.julialang.org/u/ConnectedSystems)\
**Post date:** [May 23, 2022, 12:36pm UTC](https://discourse.julialang.org/t/standalone-packagecompiler-app-with-plots-fails-with-gr-jll-error/81507/1 "2022-05-23T12:36:52Z")

</div>

Putting together an app that displays a plot of results at the end. Unfortunately, the plot never displays at the end. Instead, there is an error message about GR\_jll, although I see it listed when it is compiling (see below).

Does anyone know of a workaround or know what’s missing here?

Minimum example:

```julia
] generate PlotApp

cd("PlotApp")

] activate .
] add Plots

```

`PlotApp.jl` has inside it:

```julia
module PlotApp

using Plots

function julia_main()::Cint
    a = [0.0, 1.0, 2.0, 3.0]

    p = plot(a, label="x", xlabel="xlabel", ylabel="ylabel")
    gui(p) # display() and @show have same results

    return 0
end

end # module

```

After installing PackageCompiler:

```julia
# Here I thought lazy artifacts might be necessary but still produces same error
create_app("./", "app"; include_lazy_artifacts=true, force=true)

PackageCompiler: bundled artifacts:
  ├── Bzip2_jll - 2.232 MiB
  ├── Cairo_jll - 13.579 MiB
  ├── EarCut_jll - 678.178 KiB
  ├── Expat_jll - 1.132 MiB
  ├── FFMPEG_jll - 27.893 MiB
  ├── Fontconfig_jll - 3.017 MiB
  ├── FreeType2_jll - 4.737 MiB
  ├── FriBidi_jll - 570.671 KiB
  ├── GLFW_jll - 711.095 KiB
  ├── GR_jll - 30.940 MiB
  ├── Gettext_jll - 19.930 MiB
  ├── Glib_jll - 20.546 MiB
  ├── Graphite2_jll - 696.780 KiB
  ├── HarfBuzz_jll - 6.257 MiB
  ├── JpegTurbo_jll - 4.951 MiB
  ├── LAME_jll - 1.398 MiB
  ├── LERC_jll - 758.367 KiB
  ├── LZO_jll - 1.084 MiB
  ├── Libffi_jll - 205.667 KiB
  ├── Libgcrypt_jll - 6.433 MiB
  ├── Libgpg_error_jll - 2.227 MiB
  ├── Libiconv_jll - 2.245 MiB
  ├── Libtiff_jll - 9.779 MiB
  ├── Ogg_jll - 693.400 KiB
  ├── OpenSSL_jll - 14.619 MiB
  ├── OpenSpecFun_jll - 798.680 KiB
  ├── Opus_jll - 3.208 MiB
  ├── PCRE_jll - 4.222 MiB
  ├── Pixman_jll - 5.945 MiB
  ├── Qt5Base_jll - 83.605 MiB
  ├── Wayland_protocols_jll - 465.663 KiB
  ├── XML2_jll - 7.444 MiB
  ├── XSLT_jll - 2.226 MiB
  ├── Zstd_jll - 3.936 MiB
  ├── libass_jll - 1.424 MiB
  ├── libfdk_aac_jll - 8.899 MiB
  ├── libpng_jll - 1.714 MiB
  ├── libvorbis_jll - 1.385 MiB
  ├── x264_jll - 5.880 MiB
  └── x265_jll - 12.785 MiB
  Total artifact file size: 321.120 MiB
✔ [03m:37s] PackageCompiler: compiling base system image (incremental=false)
Precompiling project...
  134 dependencies successfully precompiled in 952 seconds
✔ [05m:46s] PackageCompiler: compiling incremental system image

```

Running the app results in the below:

```julia
$ ./app/bin/PlotApp.exe

┌ Error: Error importing GR_jll:
│ err =
│ ArgumentError: Package GR does not have GR_jll in its dependencies:
│ - If you have GR checked out for development and have
│ added GR_jll as a dependency but haven't updated your primary
│ environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with GR
└ @ GR C:\Users\username\.julia\packages\GR\DratL\src\funcptrs.jl:42
Your GR installation is incomplete. Rerunning build step for GR package.
┌ Info: Switching provider to GR due to error in depsfile
└ depsfile = "C:\\Users\\username\\.julia\\packages\\GR\\DratL\\deps\\deps.jl"
┌ Warning: GR attempted to rebuild but failed due to LoadError("C:\\Users\\username\\.julia\\packages\\GR\\DratL\\deps\\build.jl", 1, ArgumentError("Package GR does not have Pkg in its dependencies:\n- If you have GR checked out for development and have\n added Pkg as a dependency but haven't updated your primary\n environment's manifest file, try `Pkg.resolve()`.\n- Otherwise you may need to report an issue with GR")). Setting ENV["JULIA_GR_REBUILD"] = false.
└ @ GR C:\Users\username\.julia\packages\GR\DratL\src\GR.jl:378
GR was not built correctly and could not be automatically rebuilt.
get(ENV, "JULIA_GR_REBUILD", "true") == false
C:\Users\username\.julia\packages\GR\DratL\src\..\deps\gr is not a directory.
GR_jll could not be loaded.

Run the following commands:

ENV["GRDIR"] = ""
using Pkg; Pkg.build("GR")

```

---

<div class="post-metadata">

**Author:** ![jheinen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jheinen/32/2787_2.png) [@jheinen](https://discourse.julialang.org/u/jheinen)\
**Post date:** [May 23, 2022, 2:53pm UTC](https://discourse.julialang.org/t/standalone-packagecompiler-app-with-plots-fails-with-gr-jll-error/81507/2 "2022-05-23T14:53:12Z")

</div>

Could you try `using GR` after you `] add Plots`?

```julia
] generate PlotApp
cd("PlotApp")
] add Plots
using GR

```

and then `] add PackageCompiler` and create the `PlotApp`?

---

<div class="post-metadata">

**Author:** ![ConnectedSystems](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/connectedsystems/32/16815_2.png) [@ConnectedSystems](https://discourse.julialang.org/u/ConnectedSystems)\
**Post date:** [May 24, 2022, 2:03am UTC](https://discourse.julialang.org/t/standalone-packagecompiler-app-with-plots-fails-with-gr-jll-error/81507/3 "2022-05-24T02:03:22Z")

</div>

Hits the same error. I also tried recreating the project from scratch with PackageCompiler in the PlotApp project as well with both Plots and GR, with the same result.

---

<div class="post-metadata">

**Author:** ![ConnectedSystems](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/connectedsystems/32/16815_2.png) [@ConnectedSystems](https://discourse.julialang.org/u/ConnectedSystems)\
**Post date:** [May 24, 2022, 12:03pm UTC](https://discourse.julialang.org/t/standalone-packagecompiler-app-with-plots-fails-with-gr-jll-error/81507/4 "2022-05-24T12:03:41Z")

</div>

The figure gets saved without issue if I comment out the call to `gui()`, so I’m guessing it’s something to do with window creation or something.
