What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If wkhtmltopdf prints error while loading shared libraries: libjpeg.so.8: cannot open shared object file: No such file or directory and exits with status 127, the executable is present but Linux cannot find the JPEG library ABI it was built to use. Install the provider package for your exact distribution and architecture, then confirm the loader resolves it with ldd. If that ABI is unavailable, use a distribution-matched wkhtmltopdf build or run it in a container that includes the correct libraries.

What the error means

The dynamic linker, not wkhtmltopdf’s command-line parser, is failing. Your particular executable requests the SONAME libjpeg.so.8; the linker searched its configured library paths and did not find a compatible file. Exit status 127 commonly accompanies this failure because the operating system could not start the program.

The word “static” causes confusion. wkhtmltopdf’s official FAQ explains that only Qt is linked statically; system components such as JPEG, OpenSSL, libc, fontconfig and freetype remain host dependencies. A static Qt build therefore can still require libjpeg.so.8 and several other shared libraries.

Diagnose the exact binary before changing packages

Different users often have multiple wkhtmltopdf installations (for example, a distribution package and a manually unpacked release). Diagnose the executable that your shell actually runs.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Locate it and resolve symlinks.
    command -v wkhtmltopdf
    readlink -f "$(command -v wkhtmltopdf)"

    Use the resolved path in the remaining commands. If command -v returns nothing, this is a PATH/install problem rather than a missing JPEG library.

  2. Check architecture.
    file /path/to/wkhtmltopdf
    uname -m

    The executable and host must be compatible (for example, x86-64 with an x86-64 library). An ARM host cannot load an x86-64 library merely because the filename matches.

  3. Inspect every dependency.
    ldd /path/to/wkhtmltopdf | grep -E 'jpeg|not found'

    A line such as libjpeg.so.8 => not found confirms the immediate cause. Review the complete ldd output as well: once JPEG is fixed, a missing font, X11, OpenSSL or freetype library may be reported next.

  4. Identify the operating-system release and repositories. On Debian or Ubuntu, collect cat /etc/os-release and dpkg --print-architecture. Verify that your configured repositories actually contain a package providing the libjpeg.so.8 ABI before installing anything. Linux binaries are distribution-specific because library, libc, OpenSSL, font and runtime versions differ.

Repair on Debian and Ubuntu

On a supported release that provides the ABI, install the distribution’s runtime package. The documented dependency set for the maintained wkhtmltopdf-static 0.12.6.1 build includes libjpeg-turbo8 and the following font, X11 and rendering packages:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt-get update
sudo apt-get install -y libjpeg-turbo8 libfontconfig1 libfreetype6 libx11-6 libxext6 libxrender1 xfonts-75dpi xfonts-base
sudo ldconfig
ldd /path/to/wkhtmltopdf | grep -E 'jpeg|not found'
/path/to/wkhtmltopdf -V

Replace /path/to/wkhtmltopdf with the path found during diagnosis. The exact provider name can vary by release and architecture; ask APT which package owns the ABI rather than assuming the name:

apt-cache search '^libjpeg'
apt-file search 'libjpeg.so.8'   # install apt-file first if this command is unavailable

If the package is already installed under a multiarch directory, reinstalling it may change nothing. The deciding test is still ldd: it must show a real path instead of not found. If APT reports broken dependencies, repair the package state before testing wkhtmltopdf:

sudo apt-get -f install
sudo dpkg --configure -a

Missing font packages can produce a separate installation or rendering failure. Keep xfonts-75dpi, xfonts-base, fontconfig and freetype installed when using the documented dependency set.

When no package provides libjpeg.so.8

Use a build matched to the host

Do not force a generic Linux download onto an unrelated distribution. Obtain a wkhtmltopdf build intended for your distribution family, release and CPU architecture, or install the distribution’s own package. A binary linked against another release’s JPEG, OpenSSL, libc or font stack may fail even when its filename looks correct.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run wkhtmltopdf in a container

A container gives the converter a known userspace containing the required libraries and fonts. This is the documented fallback when native libraries are unavailable or damaged. Choose an image compatible with your architecture, mount input and output directories, and pin the image tag so upgrades are deliberate. Docker must be permitted by your environment; it is not a fix for a host where containers are prohibited.

Bundle a verified library directory

If you must ship libraries beside the application, use files built for the same architecture and distribution family. Point the loader at that directory only for the conversion process:

LD_LIBRARY_PATH=/opt/wkhtmltopdf/lib 
  ldd /opt/wkhtmltopdf/bin/wkhtmltopdf | grep -E 'jpeg|not found'
LD_LIBRARY_PATH=/opt/wkhtmltopdf/lib 
  /opt/wkhtmltopdf/bin/wkhtmltopdf -V

The first command must resolve libjpeg.so.8 to /opt/wkhtmltopdf/lib (or another intentional path). Do not copy a random libjpeg.so from an Internet mirror and do not create a blind symlink from another SONAME. JPEG ABIs are not interchangeable just because a symlink makes the filename match; an incompatible library can crash or corrupt output.

Choose the least risky deployment option

Option Host compatibility Library and font control Operations and upgrades When it fits
Install distribution packages Requires a release and architecture that provide the ABI Managed by the OS; versions follow repositories Simplest, but repository changes can affect upgrades Long-lived servers where native installation is allowed
Distribution-matched binary Must match the host’s libc, OpenSSL, JPEG and runtime expectations More predictable than a generic binary, but still uses host libraries Moderate; pin and verify the exact artifact Hosts that cannot use the default package but have compatible userspace
Containerized execution Host needs a working container runtime and compatible CPU Highest control and reproducibility inside the image Image maintenance and startup integration add complexity CI, fleets, or hosts with incompatible native libraries
Manual library directory Exact architecture and distribution-family match is required Full control, with responsibility for security updates Highest risk of drift and loader mistakes Specialized deployments with a controlled artifact pipeline

Verify conversion after the loader is fixed

First confirm startup:

/path/to/wkhtmltopdf -V

Then perform a small conversion using a local HTML file, which separates loader problems from network, TLS and page JavaScript issues:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
printf '<!doctype html><h1>wkhtmltopdf test</h1>' > /tmp/test.html
/path/to/wkhtmltopdf file:///tmp/test.html /tmp/test.pdf
file /tmp/test.pdf

If this succeeds but a remote URL fails, the JPEG issue is resolved. Investigate DNS, TLS certificates, proxy settings, JavaScript timing, external assets or the page’s own access controls instead of changing JPEG libraries.

Troubleshooting branches

ldd still says “not found” after installation

  • You may be running a different binary than the one you inspected. Repeat command -v and use the resolved path.
  • The package may be for another architecture. Compare file, uname -m and the package architecture.
  • The library may be in a nonstandard directory. Run sudo ldconfig, then repeat ldd; do not assume that setting a global path is safe.
  • Your release may not provide SONAME 8. Switch to a matching wkhtmltopdf build or a container.

APT cannot locate libjpeg-turbo8

That package name is not universal. Check the release’s repositories and architecture for the package that provides libjpeg.so.8. If none exists, do not substitute an unrelated JPEG ABI; use a distribution-specific build or container.

The command starts but exits with another missing library

Run ldd without the grep filter and resolve every not found entry. Static Qt does not remove dependencies on OpenSSL, libc, fontconfig, freetype or X11 components.

Fonts are blank or the PDF layout changes

Install the required font packages and confirm fontconfig and freetype are present. Library resolution alone does not guarantee that the fonts used by the source page exist in the runtime environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A symlink made the error disappear, but conversion crashes

Remove the symlink and restore the correct ABI. A different SONAME can expose incompatible symbols or data structures. Reinstall the provider package or rebuild the environment around a compatible image.

Status 127 remains in a service or CI job

Inspect the service’s PATH, working directory, architecture and environment separately from your interactive shell. Run the resolved absolute path and capture ldd output in the same job or container that performs conversion.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your actual goal is to obtain a clean image or PDF of a web page rather than maintain wkhtmltopdf, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets. Only clean shots are billed; bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and each response identifies the result with X-Page-Verdict and X-Billed headers.

One GET request is enough:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for options such as PNG, JPEG or WebP output, PDF capture, full-page lazy-image loading, CSS selectors, device and retina settings, custom JavaScript, cookies, headers, blocking rules, signed links, asynchronous jobs and bulk capture. Python and Node.js clients work without browser setup:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

An MCP server lets Claude, Cursor and other MCP clients call take_screenshot, get_page_info and capture_pdf. The Free plan includes 1,000 shots each month with no card; paid plans start at $5 for 3,000 shots. Sign up for the free ScreenshotNeo plan.

FAQ

Is libjpeg.so.8 the same as libjpeg.so.62?

No. They identify different ABI interfaces. Installing or symlinking one in place of the other is not a supported repair.

Does running sudo ldconfig download the missing library?

No. It refreshes the loader’s cache from libraries already installed in configured directories. Install the correct provider package first.

Why does the same wkhtmltopdf file work on one server but not another?

The hosts expose different architectures, distributions or system-library versions. A “static” Qt component does not make the complete executable portable across those environments.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can I install a library from another Linux distribution?

Only when the entire userspace and ABI compatibility are established. In normal deployments, use the host distribution’s provider package, a matched wkhtmltopdf build or a container instead.

Should I use a static binary to avoid all runtime dependencies?

No. The wkhtmltopdf static build statically links Qt but still requires host JPEG, OpenSSL, libc, fontconfig and freetype components.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.