# I can't use the PackageCompiler

**URL:** <https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732>\
**Category:** General Usage\
**Created:** [March 8, 2020, 10:24pm UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732 "2020-03-08T22:24:41Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 8, 2020, 10:24pm UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/1 "2020-03-08T22:24:41Z")

</div>

I am retrying to use PackageCompiler, for the second time (the first, I was unable to produce an executable, because it gave me error).  
I am following - again - the instruction on  
[https://julialang.github.io/PackageCompiler.jl/dev/apps/](https://julialang.github.io/PackageCompiler.jl/dev/apps/)

Well, today, i have no error, but 20 minutes have passed since I ran the command which should produce an executable and  
nothing happens and it remains like this:

```julia
C:\Users\dario\.julia\packages\PackageCompiler\D8oaG\examples>julia -q --project
julia> using PackageCompiler
[Info: Precompiling PackageCompiler [9b87118b-4619-50d2-8e1e-99f35a4d4d9d]

julia> create_app("MyApp","MyAppCompiled")
  Updating registry at `C:\Users\dario\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Cloning git-repo `https://github.com/JuliaBinaryWrappers/HelloWorldC_jll.jl`
  Updating git-repo `https://github.com/JuliaBinaryWrappers/HelloWorldC_jll.jl`
 Installed Example ─ v0.5.3
[ Info: PackageCompiler: creating base system image (incremental=false)...
[ Info: PackageCompiler: creating system image object file, this might take a while...

```

What can I try?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 9, 2020, 8:41am UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/2 "2020-03-09T08:41:49Z")

</div>

What type of system are you on? If you have very little RAM and the OS has to use the swap spaces I can imagine it could get very slow.

---

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 9, 2020, 8:50am UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/3 "2020-03-09T08:50:48Z")

</div>

I have this pc:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/2/d2207ba2e1f958a4790df08a89dc9ec931f07d26.png)

I have windows 10.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 9, 2020, 9:39am UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/4 "2020-03-09T09:39:54Z")

</div>

16 GB should be enough… Does it happen every time?

---

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 9, 2020, 11:21am UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/5 "2020-03-09T11:21:55Z")

</div>

Oh … today it works!

I takes 14 min (why so much time !? is it normal? and big sized … 291MByte of app … ok, all julia inside, i think … but this is not a problem), but it is ended and I see MyApp.exe, that works.

Well, this was the examples i get from internet … now i will try to understand how compile my app that use Genie as external package …

Thanks, i will post again if i will find problems.

Really i would like to obtain an executable to pass to other pc.

---

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 9, 2020, 11:44pm UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/6 "2020-03-09T23:44:53Z")

</div>

I am trying to compiler my app (a web server app based on Genie), trying to adjust starting from the MyApp example.  
I have this error, i undestand the i have not declared the use of Genie, but i don’t know how to do.  
Since I’m a beginner, could you tell me how exactly to incorporate Genie?

```julia
ERROR: LoadError: ArgumentError: Package MyAppQuerere does not have Genie in its dependencies:
- If you have MyAppQuerere checked out for development and have
  added Genie 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 MyAppQuerere

```

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 10, 2020, 8:06am UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/7 "2020-03-10T08:06:27Z")

</div>

Just

```julia
import Pkg
Pkg.add("Genie")

```

when you have your app project active.

---

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 10, 2020, 8:36am UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/8 "2020-03-10T08:36:17Z")

</div>

> [@kristoffer.carlsson](#):
>
> when you have your app project active.

I guess I didn’t get it right.

I thought I had to specify somewhere, among the files called Artifacts.toml, Manifest.toml (or other file), that the Genie package is needed.

I put a photo.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/5/85432f426f176a7283d5e3a5bc68c5c3719b2a7a.png)

I started from the example on the web, of MyApp.

I created a MyAppQuerere,  
and I went to make these moves. Most likely I left a lot more stuff, of the example, which I don’t need, but let’s say at least to begin to see if it is possible to compile …

So, I changed to precompile\_app.jl by writing MyAppQuerere, which is mine.  
Then I put the src folder, my two files, querere.jl where I have the functions, and web.jl which is what I launch to start the web app “doing julia.exe web.j” from the command line.

Then, I changed here, writing that I include my web.jl, which I thought should be done.

```julia
function julia_main()
    try
        include("web.jl")
    catch
        Base.invokelatest(Base.display_error, Base.catch_stack())
        return 1
    end
    return 0
end

```

Can you tell me what to do - considering i am a beginner?

Although Julia’s focus is not on creating standalone executables, it would be very important for me to be able to do so. I have to have an easy way to move my application made in Julia, from pc to pc …

Thanks for your patience.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 10, 2020, 10:27am UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/9 "2020-03-10T10:27:53Z")

</div>

Using something like `include("web.jl")` in the main function (which runs at runtime) is never going to work because when the App is shipped there will be no source files.

You removed a bit too much form the example App. You should keep the `Project.toml`, `Manifest.toml` and `src` folder. You can put in your `include("web.jl")` here: [PackageCompiler.jl/MyApp.jl at aa58b9977b96aad7df6b971a51370713e1887fb4 · JuliaLang/PackageCompiler.jl · GitHub](https://github.com/JuliaLang/PackageCompiler.jl/blob/aa58b9977b96aad7df6b971a51370713e1887fb4/examples/MyApp/src/MyApp.jl#L8).

And then inside `real_main`:

> <https://github.com/JuliaLang/PackageCompiler.jl/blob/aa58b9977b96aad7df6b971a51370713e1887fb4/examples/MyApp/src/MyApp.jl#L19>

you run the function you want that starts the application.

---

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 10, 2020, 11:29am UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/10 "2020-03-10T11:29:12Z")

</div>

> [@kristoffer.carlsson](#):
>
> Using something like `include("web.jl")` in the main function (which runs at runtime) is never going to work because when the App is shipped there will be no source files.

A simple question for now: if i will obtain ax executable that works … can I leave an external files myExternalFile.jl into the /bin folder, using "include(“myExternalFile.jl”) ? In other words, is it possible to distribute standalone application in Julia, butbut leaving small external .jl files in the bin folder, and all works the same?

---

<div class="post-metadata">

**Author:** ![Darione](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/darione/32/12160_2.png) [@Darione](https://discourse.julialang.org/u/Darione)\
**Post date:** [March 10, 2020, 11:36am UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/11 "2020-03-10T11:36:25Z")

</div>

The second think … thank you very much, but I have not really understood how I can fix to successfully compile with PackageCompiler … this more than anything else because I am a beginner … i know … yes i am going a bit to much fast to my goal, i need to read more basics on Julia, i know … ok … but whether or not to adopt Julia depends on whether I can make standalone webapp applications, and i have to understand how difficult it is.

I managed without putting too much effort into setting up a web app - and that works I would say very well by launching “julia.exe web.jl” - now I only miss the possibility of distributing standalone.

I also asked the Genie developer if he gives me any help, since Genie did, so maybe he senses what I’m trying to do …

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [March 10, 2020, 11:52am UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/12 "2020-03-10T11:52:02Z")

</div>

Right now, the only way to bundle extra files is using the Artifact system. In theory it is possible to add some arguments to `create_app` that would also bundle extra files. I don’t see any reason for bundling source files though, just `include` them in your app so they are compiled into the sysimage.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [March 31, 2020, 2:12pm UTC](https://discourse.julialang.org/t/i-cant-use-the-packagecompiler/35732/13 "2020-03-31T14:12:00Z")

</div>

> [@Darione](#):
>
> I takes 14 min (why so much time !? is it normal? and big sized … 291MByte of app … ok, all julia inside, i think … but this is not a problem)

I had a small program in one file and it took about 10 minutes to compile, and I was told the slowness was normal. It seems to me, that you actually do not need standalone apps. For me, I could shave of 2-3 minutes with the incremental option. There’s also filter option to get relatively smaller apps. Your apps will not get faster, only slightly faster startup, likely not as issue for a web server (should never go down…). [I would like to know how to make the apps smaller and compiles faster, what it takes to fix PackageCompiler that way.]

> [@Darione](#):
>
> I am trying to compiler my app (a web server app based on Genie)

Why I think you do not need standalone apps. Often they are to hide source code, and as you’re not sending code to users, not an issue (your JavaScript will still be visible).

There’s nothing really wrong with copying the source code separately to your target computer, and the Julia runtime. You just want to make sure your Julia packages are also installed there.

> [@Darione](#):
>
> Although Julia’s focus is not on creating standalone executables, it would be very important for me to be able to do so. I have to have an easy way to move my application made in Julia, from pc to pc …

If the installation/dependencies are a problem, you could also use a container. I.e. LXC (LXD?) on Linux. That would also get you something to move between (Linux) computers, and should just work, and wouldn’t need compiling. I’m not up to speed on if works on Windows, Docker there instead?
