# Application compilation does not account for required code

**URL:** <https://discourse.julialang.org/t/application-compilation-does-not-account-for-required-code/82515>\
**Category:** General Usage\
**Tags:** package-compiler, app\
**Created:** [June 9, 2022, 4:50pm UTC](https://discourse.julialang.org/t/application-compilation-does-not-account-for-required-code/82515 "2022-06-09T16:50:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BambOoxX](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bambooxx/32/22179_2.png) [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Post date:** [June 9, 2022, 4:50pm UTC](https://discourse.julialang.org/t/application-compilation-does-not-account-for-required-code/82515/1 "2022-06-09T16:50:47Z")

</div>

I’m currently trying to compile an app using `PackageCompiler`. The associated project `App` depends on two packages `Foo` and `Bar`.  
`Foo` contains a bit of glue code to link with `Bar`-provided functionnalities.  
These portion of code is of no interest without `Bar` so I figured it was relevant to use `Requires` to avoid loading that if not used.

Now this works just fine when using an interactive REPL / VsCode. However, it seems to be problematic when compiling an app with `PackageCompiler`, even though my compilation line

```julia
create_app(<package_dir>,<exebinpath>; precompile_execution_file=<pspath>,incremental = true, cpu_target="generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)", include_lazy_artifacts=true, include_transitive_dependencies = true)

```

specifices a `precompile_execution_file` that contains `using Foo, Bar` which should load both packages as well as the glue code.  
If I understood correctly, the mechanism used by `Requires` happens at run-time and not at compile-time, but I thought that it was precisely the role of the `precompile_execution_file` to specify things that would happend during the actual run-time use of the app.

Can someone clarify this behavior ?

---

<div class="post-metadata">

**Author:** ![BambOoxX](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bambooxx/32/22179_2.png) [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Post date:** [June 9, 2022, 4:59pm UTC](https://discourse.julialang.org/t/application-compilation-does-not-account-for-required-code/82515/2 "2022-06-09T16:59:39Z")

</div>

@kristoffer.carlsson it seems related to that previous issue [Relocatability warnings on dependent packages · Issue #357 · JuliaLang/PackageCompiler.jl · GitHub](https://github.com/JuliaLang/PackageCompiler.jl/issues/357). But in that case, there is no mention to `precompile_execution_file`.
