Docker Go-Fitz/Libmupdf.So dependency issues
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2k
- Forks
- 291
- Avg merge
- 30m
- Merged PRs (30d)
- 3
Description
I'm unfortunately highly inexperienced with anything related to programming-- even describing me as a hobbyist would be generous-- and thought having a local instance of LocalAGI would be an interesting one-off to learn more about what my PC can do with LLMs with (relatively) minimal security risks. I was able to compile LocalAGI in Docker with some assistance, however kept running into some last-step issues running "docker compose up" to finalize and run the container centering around libmupdf.
Owing to my general inexperience (again, I apologize), here's what Docker spat back out at me with some coaxing:
"SYSTEM SPECIFICATIONS
OS: Windows 10 with Docker Desktop (WSL 2 - Ubuntu backend)
Go Version Required: 1.26.0
Docker Version: Latest (from docker compose output)
Node/Bun: Bun 1.3.14
Build Tool: Docker Compose v5.1.3
ISSUE SUMMARY
The LocalAGI Docker container fails to start with the following error:
panic: cannot load library: libmupdf.so: cannot open shared object file: No such file or directory
goroutine 1 [running]:
github.com/gen2brain/go-fitz.loadLibrary()
/go/pkg/mod/github.com/gen2brain/go-fitz@v1.24.15/purego_linux.go:18 +0x7a
github.com/gen2brain/go-fitz.init.0()
/go/pkg/mod/github.com/gen2brain/go-fitz@v1.24.15/fitz_nocgo.go:573 +0x17
Exit Code: 2
ROOT CAUSE
The go-fitz library (v1.24.15) in purego mode attempts to load libmupdf.so dynamically at runtime.
The library is not available in standard Linux Logical package repositories, making it impossible
to install via apt-get in Docker containers.
DEPENDENCY CHAIN
LocalAGI depends on:
- github.com/gen2brain/go-fitz v1.24.15 (for PDF processing)
- Requires: libmupdf.so (MuPDF library - shared object file)
- Uses: purego mode (pure Go without CGO)
- Loads library dynamically at initialization (fitz_nocgo.go:573)
DOCKER BUILD APPROACHES ATTEMPTED
-
Alpine Linux
- Status: FAILED
- Reason: mupdf-libs package not available or doesn't provide libmupdf.so
-
Ubuntu 24.04
- Status: FAILED
- Reason: libmupdf/libmupdf2 packages not found in repositories
-
Debian Bookworm
- Status: FAILED
- Reason: libmupdf packages not found in repositories
-
Ubuntu 22.04
- Status: FAILED
- Reason: libmupdf2 package not found in repositories
-
Building MuPDF from Source (Ubuntu 22.04 base)
- Status: FAILED
- Reason: Git clone of ArtifexSoftware/mupdf succeeded but make build failed
- Error: "make build=release shared=yes" did not complete successfully (exit code: 2)
-
CGO_ENABLED=1 with Static Linking
- Status: FAILED
- Reason: Go build failed during compilation
-
CGO_ENABLED=0 (Pure Go)
- Status: SUCCEEDED (Binary built: 57MB)
- Issue: Binary runs but fails at initialization when go-fitz tries to load libmupdf.so
FINAL WORKING DOCKERFILE
The Go binary successfully compiles when using:
- Base: golang:1.26-bookworm
- CGO_ENABLED=0
- Binary output: /tmp/localagi (57MB)
- Runtime base: debian:bookworm-slim or ubuntu:22.04
However, runtime fails because libmupdf.so cannot be found or installed."
I'm unsure where to go from here. Would it be possible to submit a prebuilt image to Docker hub or something?
Thank you
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the Docker build/runtime setup and the go-fitz entry points named in the report: purego_linux.go and fitz_nocgo.go. Reproduce docker compose up with the reported Debian-based images, then trace how libmupdf.so is expected to be provided; done means the container starts without the loadLibrary panic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100