# Packages with \`\_\_init()\_\_\` screws up PackageCompiler.jl?

**URL:** <https://discourse.julialang.org/t/packages-with-init-screws-up-packagecompiler-jl/112243>\
**Category:** General Usage\
**Tags:** package-compiler\
**Created:** [March 28, 2024, 5:40pm UTC](https://discourse.julialang.org/t/packages-with-init-screws-up-packagecompiler-jl/112243 "2024-03-28T17:40:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![biona001](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/biona001/32/16497_2.png) [@biona001](https://discourse.julialang.org/u/biona001)\
**Post date:** [March 28, 2024, 5:40pm UTC](https://discourse.julialang.org/t/packages-with-init-screws-up-packagecompiler-jl/112243/1 "2024-03-28T17:40:15Z")

</div>

Cross-posted on [PackageCompiler.jl](https://github.com/JuliaLang/PackageCompiler.jl/issues/933).

I’m building binaries with `PackageCompiler.create_app()`, but I get an alarming warning message whenever a dependency has an `__init()__` function that includes a `@require` block, exemplified by the following packages:

- [JLD2.jl](https://github.com/JuliaIO/JLD2.jl/blob/master/src/JLD2.jl#L640)
- [HDF5.jl](https://github.com/JuliaIO/HDF5.jl/blob/master/src/HDF5.jl#L121)

If I include these dependencies in my package, I get some alarming warning messages (although the app runs fine)

```julia
┌ Warning: Error requiring `UnPack` from `JLD2`
│ exception =
│ IOError: stat("/home/users/kilian/.julia/packages/JLD2/ryhNR/ext/UnPackExt.jl"): permission denied (EACCES)
│ Stacktrace:
│ [1] uv_error
│ @ Base ./libuv.jl:100 [inlined]
│ [2] stat(path::String)
│ @ Base.Filesystem ./stat.jl:152
│ [3] isfile(path::String)
│ @ Base.Filesystem ./stat.jl:461
│ [4] macro expansion
│ @ /home/users/kilian/.julia/packages/Requires/Z8rfN/src/Requires.jl:37 [inlined]
│ [5] top-level scope
│ @ /home/users/kilian/.julia/packages/JLD2/ryhNR/src/JLD2.jl:607
│ [6] eval
│ @ Core ./boot.jl:385 [inlined]
│ [7] eval
│ @ JLD2 /home/users/kilian/.julia/packages/JLD2/ryhNR/src/JLD2.jl:1 [inlined]
│ [8] (::JLD2.var"#131#134")()
│ @ JLD2 /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:101
│ [9] macro expansion
│ @ Requires ./timing.jl:395 [inlined]
│ [10] err(f::Any, listener::Module, modname::String, file::String, line::Any)
│ @ Requires /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:47
│ [11] (::JLD2.var"#130#133")()
│ @ JLD2 /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:100
│ [12] withpath(f::Any, path::String)
│ @ Requires /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:37
│ [13] (::JLD2.var"#129#132")()
│ @ JLD2 /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:99
│ [14] listenpkg(f::Any, pkg::Base.PkgId)
│ @ Requires /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:20
│ [15] macro expansion
│ @ JLD2 /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:98 [inlined]
│ [16] __init__ ()
│ @ JLD2 /home/users/kilian/.julia/packages/JLD2/ryhNR/src/JLD2.jl:606
└ @ Requires /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:51
┌ Warning: Error requiring `FileIO` from `HDF5`
│ exception =
│ IOError: stat("/home/users/kilian/.julia/packages/HDF5/HtnQZ/src/fileio.jl"): permission denied (EACCES)
│ Stacktrace:
│ [1] uv_error
│ @ Base ./libuv.jl:100 [inlined]
│ [2] stat(path::String)
│ @ Base.Filesystem ./stat.jl:152
│ [3] isfile(path::String)
│ @ Base.Filesystem ./stat.jl:461
│ [4] top-level scope
│ @ /home/users/kilian/.julia/packages/Requires/Z8rfN/src/Requires.jl:37
│ [5] eval
│ @ Core ./boot.jl:385 [inlined]
│ [6] eval
│ @ HDF5 /home/users/kilian/.julia/packages/HDF5/HtnQZ/src/HDF5.jl:1 [inlined]
│ [7] (::HDF5.var"#115#121")()
│ @ HDF5 /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:101
│ [8] macro expansion
│ @ Requires ./timing.jl:395 [inlined]
│ [9] err(f::Any, listener::Module, modname::String, file::String, line::Any)
│ @ Requires /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:47
│ [10] (::HDF5.var"#114#120")()
│ @ HDF5 /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:100
│ [11] withpath(f::Any, path::String)
│ @ Requires /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:37
│ [12] (::HDF5.var"#113#119")()
│ @ HDF5 /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:99
│ [13] listenpkg(f::Any, pkg::Base.PkgId)
│ @ Requires /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:20
│ [14] macro expansion
│ @ HDF5 /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:98 [inlined]
│ [15] __init__ ()
│ @ HDF5 /home/users/kilian/.julia/packages/HDF5/HtnQZ/src/HDF5.jl:119
└ @ Requires /home/users/kilian/.julia/packages/Requires/Z8rfN/src/require.jl:51

```

Is there anyway to suppress this warning message?

---

<div class="post-metadata">

**Author:** ![biona001](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/biona001/32/16497_2.png) [@biona001](https://discourse.julialang.org/u/biona001)\
**Post date:** [March 29, 2024, 7:27am UTC](https://discourse.julialang.org/t/packages-with-init-screws-up-packagecompiler-jl/112243/2 "2024-03-29T07:27:28Z")

</div>

I came across [this post](https://discourse.julialang.org/t/zygote-jl-and-packagecompiler-jl/35839) which seem to suggest any package that uses `Requires.@require` cannot be compiled into an app (as of 2020). Then I saw [this issue](https://github.com/JuliaIO/HDF5.jl/pull/891) in 2022 which seems to have fixed this problem, but apparently not for my case.

Ultimately I created my own forks of these packages and commented out all the `Requires.@require` statements (adding/removing dependencies as needed) for my specific application to work.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [March 29, 2024, 9:50am UTC](https://discourse.julialang.org/t/packages-with-init-screws-up-packagecompiler-jl/112243/3 "2024-03-29T09:50:46Z")

</div>

Did you create bug reports for the packages you had to fork?
