Skip to content

Incomplete discovery of libraries #8130

@laggron42

Description

@laggron42

Hello!

I attempted to build Pillow with libraqm support, and had a lot of difficulties to get it to work. Specifically, the raqm and webp libraries would never be found without some edition.

With the following context returned by pkg-config:

$ pkg-config --list-all
libturbojpeg    libturbojpeg - A SIMD-accelerated JPEG codec that provides the TurboJPEG API
libwebp         libwebp - Library for the WebP graphics format
liblzma         liblzma - General purpose data compression library
libbrotlienc    libbrotlienc - Brotli encoder library
libopenjp2      openjp2 - JPEG2000 library (Part 1 and 2)
libwebpmux      libwebpmux - Library for manipulating the WebP graphics format container
libdeflate      libdeflate - Fast implementation of DEFLATE, zlib, and gzip
libpng16        libpng - Loads and saves PNG files
libsharpyuv     libsharpyuv - Library for sharp RGB to YUV conversion
freetype2       FreeType 2 - A free, high-quality, and portable font engine.
libbrotlidec    libbrotlidec - Brotli decoder library
zlib            zlib - zlib compression library
libpng          libpng - Loads and saves PNG files
lcms2           lcms2 - LCMS Color Management Library
libwebpdemux    libwebpdemux - Library for parsing the WebP graphics format container
libtiff-4       libtiff - Tag Image File Format (TIFF) library.
bzip2           bzip2 - Lossless, block-sorting data compression
libbrotlicommon libbrotlicommon - Brotli common dictionary library
raqm            raqm - A library for complex text layout
libjpeg         libjpeg - A SIMD-accelerated JPEG codec that provides the libjpeg API
libwebpdecoder  libwebpdecoder - Library for the WebP graphics format (decode only)

I'm supposed to have all the required dependencies, but both errors would occur when installing:

Log 1: https://gist.github.com/laggron42/5be2a2c66c25a913f711ac3893d7181a#file-log1-txt

Log 2 (after patching for libraqm): https://gist.github.com/laggron42/5be2a2c66c25a913f711ac3893d7181a#file-log2-txt

The solution I found was to patch setup.py like this:

--- a/setup.py
+++ b/setup.py
@@ -39,6 +39,8 @@ JPEG_ROOT = None
 LCMS_ROOT = None
 TIFF_ROOT = None
 ZLIB_ROOT = None
+RAQM_ROOT = None
+WEBP_ROOT = None
 FUZZING_BUILD = "LIB_FUZZING_ENGINE" in os.environ

 class DependencyException(Exception):
@@ -460,6 +462,8 @@ class pil_build_ext(build_ext):
             "HARFBUZZ_ROOT": "harfbuzz",
             "FRIBIDI_ROOT": "fribidi",
             "LCMS_ROOT": "lcms2",
+            "RAQM_ROOT": "raqm",
+            "WEBP_ROOT": "libwebp",
             "IMAGEQUANT_ROOT": "libimagequant",
         }.items():
             root = globals()[root_name]

Am I missing something here? It doesn't look right that I need to edit the source files for proper library discover, maybe my dependencies weren't installed the correct way.

For context, I'm using macOS 14.5 and nixpkgs as package manager. The dependencies were installed in a nix shell with the following command: nix-shell -p libraqm libjpeg libtiff openjpeg libwebp zlib freetype lcms pkg-config

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions