Skip to content
Latchkey

Julia "could not load library" in CI

A package tried to dlopen a native shared library at load time and the dynamic linker could not find or open it. The binary artifact is missing, the runner lacks a system library it links against, or the path is wrong.

What this error means

Loading a package fails with "ERROR: could not load library ..." or "ERROR: LoadError: could not load library ... cannot open shared object file: No such file or directory".

Julia
ERROR: LoadError: could not load library "/root/.julia/artifacts/abc/lib/libfoo.so"
libstdc++.so.6: cannot open shared object file: No such file or directory

Common causes

A missing system library on a slim image

The package binary links against a system library (libstdc++, libgomp) that a minimal runner image does not install.

A broken or partial artifact download

A JLL artifact failed to download fully, so the shared object it provides is missing or corrupt.

How to fix it

Install the missing system library

Add the OS package that provides the shared object the loader could not find, then re-run.

Terminal
sudo apt-get update
sudo apt-get install -y libstdc++6 libgomp1

Rebuild and reinstantiate the project

  1. Clear and re-instantiate so artifacts are re-fetched.
  2. Run Pkg.build to relink binary dependencies.
  3. Re-run the load.
Terminal
julia --project=. -e 'using Pkg; Pkg.instantiate(); Pkg.build()'

How to prevent it

  • Install required system libraries before loading native packages.
  • Cache the Julia artifact store so binaries are not re-fetched.
  • Use a runner image that includes common C/C++ runtimes.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →