"cache misses, incompatible header" when loading library

On Julia 11.3, I am getting errors with the above message when loading some libraries, eg

using Profile, PProf
[ Info: Precompiling PProf [e4faabce-9ead-11e9-39d9-4379958e3056] (cache misses: wrong dep version loaded (2), incompatible header (2))
ERROR: LoadError: InitError: could not load library "/home/tamas/.julia/artifacts/a58c60683d9991d236f2a2d707edcc09974ca62b/lib/libpango-1.0.so"
/home/tamas/.julia/artifacts/a58c60683d9991d236f2a2d707edcc09974ca62b/lib/libpango-1.0.so: undefined symbol: hb_ot_color_has_paint
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:120
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:119
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/GfYNv/src/products/library_generators.jl:63 [inlined]
  [4] __init__()
    @ Pango_jll ~/.julia/packages/Pango_jll/HJ4pp/src/wrappers/x86_64-linux-gnu.jl:16
  [5] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1378
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1366
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any}, ignore_native::Nothing; register::Bool)
    @ Base ./loading.jl:1254
  [8] _include_from_serialized (repeats 2 times)
    @ ./loading.jl:1210 [inlined]
  [9] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{String, Int64}, DEPOT_PATH::Vector{String})
    @ Base ./loading.jl:2057
 [10] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2527
 [11] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2388
 [12] #invoke_in_world#3
    @ ./essentials.jl:1089 [inlined]
 [13] invoke_in_world
    @ ./essentials.jl:1086 [inlined]
 [14] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2375
 [15] macro expansion
    @ ./loading.jl:2314 [inlined]
 [16] macro expansion
    @ ./lock.jl:273 [inlined]
 [17] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2271
 [18] #invoke_in_world#3
    @ ./essentials.jl:1089 [inlined]
 [19] invoke_in_world
    @ ./essentials.jl:1086 [inlined]
 [20] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2260
 [21] include(mod::Module, _path::String)
    @ Base ./Base.jl:557
 [22] top-level scope
    @ ~/.julia/packages/JLLWrappers/GfYNv/src/toplevel_generators.jl:199
 [23] include
    @ ./Base.jl:557 [inlined]
 [24] 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, UInt128}}, source::String)
    @ Base ./loading.jl:2881
 [25] top-level scope
    @ stdin:6

Is this a bug? Deleting ~/.julia/artifacts or ~/.julia/compiled does not fix it.

1 Like

But deleting everything in ~/.julia (except config) does fix it, so it must have been some kind of database/file corruption. But I am wondering what I could have deleted selectively to make this work.

The real error is

ERROR: LoadError: InitError: could not load library "/home/tamas/.julia/artifacts/a58c60683d9991d236f2a2d707edcc09974ca62b/lib/libpango-1.0.so"
/home/tamas/.julia/artifacts/a58c60683d9991d236f2a2d707edcc09974ca62b/lib/libpango-1.0.so: undefined symbol: hb_ot_color_has_paint

The warning you quoted in the title is irrelevant here, it was only informing you that an existing pkgimage couldn’t be loaded. It’s however now impossible to investigate why you got that error message after you nuked your entire depot, which I generally strongly discourage doing, it’s bad practice and can cause data loss for someone who doesn’t know what they’re doing.

2 Likes

I had to proceed with some work and did not want to backup 2G of data, and I know what I was doing (I don’t have any data there except for config, I don’t work in dev).

But I am curious what the good practice is, for the next time something like this happens.

EDIT Ouch, somehow I am getting the same error again. Ready to debug this if you give me some hints.

I’d start with

]status -m Pango_jll HarfBuzz_jll

Also, do you have LD_LIBRARY_PATH set?

Thanks, that solved the mystery. It works like this: my global environment has PProf.jl, with

  [2e76f6c2] HarfBuzz_jll v8.5.0+0
  [36c8627f] Pango_jll v1.55.5+0

(EDIT pasted the wrong versions first)

But then I activate a particular environment that includes Miter.jl, which depends on tectonic_jll, currently version 0.15.0, which is pinned to

⌅ [2e76f6c2] HarfBuzz_jll v2.8.1+1

On the one hand, I understand how stacked environments can lead to this kind of bug. But getting a more direct warning about it would be nice, as the root cause is not apparent at first sight.

I believe Julia v1.12 shows you in ]status the version actually loaded of a package in addition to the one nominally in the environment, if the two differ.

1 Like

Thanks, I don’t see it in the NEWS file but that should be useful.

But to step back a bit: I was assuming that I can keep debug tools like PProf.jl in the global Julia project, and load them from a specific project I activated. Clearly this assumption is incorrect because it could lead to errors like this.

What is the right approach then? Add them to the project I am debugging, and remove when I am done?