Unable to use Zlib_jll in julia 1.6 (Package Zlib_jll does not have JLLWrappers in its dependencies)

I’m using Julia 1.6.3, and I get an error if I try to use Zlib_jll or any package that has it as a dependency (eg, CodecZlib or CSV).

Adding the package has a compile error:

(v1.6) pkg> activate Foo
  Activating new environment at `~/Foo/Project.toml`

(Foo) pkg> add Zlib_jll
    Updating registry at `~/.julia/registries/General`
   Resolving package versions...
    Updating `~/Foo/Project.toml`
  [83775a58] + Zlib_jll
    Updating `~/Foo/Manifest.toml`
  [8f399da3] + Libdl
  [83775a58] + Zlib_jll
Precompiling project...
  ✗ Zlib_jll
  0 dependencies successfully precompiled in 3 seconds
  1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package

Importing the package prints this error:

julia> import Zlib_jll
[ Info: Precompiling Zlib_jll [83775a58-1f1d-513f-b197-d71354ab007a]
ERROR: LoadError: ArgumentError: Package Zlib_jll does not have JLLWrappers in its dependencies:
- If you have Zlib_jll checked out for development and have
  added JLLWrappers 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 Zlib_jll
 [1] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:906
 [2] include
   @ ./Base.jl:386 [inlined]
 [3] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
   @ Base ./loading.jl:1235
 [4] top-level scope
   @ none:1
 [5] eval
   @ ./boot.jl:360 [inlined]
 [6] eval(x::Expr)
   @ Base.MainInclude ./client.jl:446
 [7] top-level scope
   @ none:1
in expression starting at /home/ubuntu/.julia/packages/Zlib_jll/BGVLi/src/Zlib_jll.jl:2
ERROR: Failed to precompile Zlib_jll [83775a58-1f1d-513f-b197-d71354ab007a] to /home/ubuntu/.julia/compiled/v1.6/Zlib_jll/jl_hY6jJ1.
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY, ignore_loaded_modules::Bool)
   @ Base ./loading.jl:1385
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base ./loading.jl:1329
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1043
 [5] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:936
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:923

I was under the impression that Zlib_jll was compiled into julia 1.6, so shouldn’t need to be precompiled. Any idea what’s happening?

Update Similar issue happens with MozillaCACerts_jll. I have to remove the existing folder for julia to work.

I think I may have some idea of what’s happening, but don’t understand it fully.
I recently upgraded from julia 1.5.4, and as a result I still had a .julia/packages/Zlib_jll/ folder in place. Once I removed this folder, the errors went away.

So, new question - should julia ignore the packages/ folder if a package is already compiled into the sysimage?

I think Julia 1.6 may use different versions of the packages than Julia 1.5 did.
Have you tried Pkg.resolve(), Pkg.instantiate() and possibly Pkg.update() (e.g. for your Foo packge)?

Yes, they all have the same problem. As long as there exists a Zlib_jll folder under packages, julia 1.6 will not work.