Skip to content

Building from source does not support freetype and raqm #7040

@ccoulombe

Description

@ccoulombe
  • OS: Centos
  • Python: 3.10
  • Pillow: 9.4.0
  • freetype : 6.16.1

Building Pillow 9.4.0 from source does not seem to properly provide RAQM support.
Building with the bundled raqm (v0.9.0) or a system raqm (v0.9.0) fails to provide freetype or raqm support.

Using bundled raqm

Build commands

cd Pillow-9.4.0
export CPATH=$EBROOTGENTOO/include:$CPATH
export LIBRARY_PATH=$EBROOTGENTOO/lib64:$LIBRARY_PATH
sed -i -e 's;/sbin/ldconfig;ldconfig;g' setup.py
python setup.py build_ext --debug --vendor-raqm bdist_wheel |& tee bundled.out

The build setup summary is ok:

--------------------------------------------------------------------
PIL SETUP SUMMARY
--------------------------------------------------------------------
version      Pillow 9.4.0
platform     linux 3.10.2 (main, Feb  4 2022, 19:10:35)
             [GCC 9.3.0]
--------------------------------------------------------------------
--- JPEG support available
--- OPENJPEG (JPEG2000) support available (2.3)
--- ZLIB (PNG/ZIP) support available
*** LIBIMAGEQUANT support not available
--- LIBTIFF support available
--- FREETYPE2 support available
--- RAQM (Text shaping) support available (bundled)
--- LITTLECMS2 support available
--- WEBP support available
--- WEBPMUX support available
--- XCB (X protocol) support available
--------------------------------------------------------------------

But once installed in a virtual environment, freetype and raqm are mentioned as not installed but the libraries are correctly linked:

$ python -m PIL | rg installed
*** FREETYPE2 support not installed
*** RAQM (Bidirectional Text) support not installed
*** LIBIMAGEQUANT (Quantization method) support not installed

$ ldd $VIRTUAL_ENV/lib/python3.10/site-packages/PIL/_imagingft.cpython-310-x86_64-linux-gnu.so:
	linux-vdso.so.1 (0x00007ffceb9fd000)
	libfreetype.so.6 => /cvmfs/soft.computecanada.ca/gentoo/2020/usr/lib64/libfreetype.so.6 (0x00002b4085e78000)
	libharfbuzz.so.0 => /cvmfs/soft.computecanada.ca/gentoo/2020/usr/lib64/libharfbuzz.so.0 (0x00002b4085f38000)
	libfribidi.so.0 => /cvmfs/soft.computecanada.ca/gentoo/2020/usr/lib64/libfribidi.so.0 (0x00002b4086041000)

And running a short example results in the following error:

ImportError: The _imagingft C module is not installed

but the library exists.

Using system raqm

Building a system RAQM results in the same as above.

Build commands:

cd Pillow-9.4.0
export CPATH=$HOME/libraqm/INST/usr/local/include:$EBROOTGENTOO/include:$CPATH
export LIBRARY_PATH=$HOME/libraqm/INST/usr/local/lib64:$EBROOTGENTOO/lib64:$LIBRARY_PATH
sed -i -e 's;/sbin/ldconfig;ldconfig;g' setup.py
python setup.py build_ext --debug --enable-raqm bdist_wheel |& tee system.out

Setup from the build output:

PIL SETUP SUMMARY
--------------------------------------------------------------------
version      Pillow 9.4.0
platform     linux 3.10.2 (main, Feb  4 2022, 19:10:35)
             [GCC 9.3.0]
--------------------------------------------------------------------
--- JPEG support available
--- OPENJPEG (JPEG2000) support available
--- ZLIB (PNG/ZIP) support available
*** LIBIMAGEQUANT support not available
--- LIBTIFF support available
--- FREETYPE2 support available
--- RAQM (Text shaping) support available
--- LITTLECMS2 support available
--- WEBP support available
--- WEBPMUX support available
--- XCB (X protocol) support available

But once installed in a virtual environment, freetype and raqm are mentioned as not installed but the libraries are correctly linked:

(495) Pillow-9.4.0 (main *) $ python -m PIL | rg installed
*** FREETYPE2 support not installed
*** RAQM (Bidirectional Text) support not installed
*** LIBIMAGEQUANT (Quantization method) support not installed

(495) Pillow-9.4.0 (main *) $ ldd $VIRTUAL_ENV/lib/python3.10/site-packages/PIL/_imagingft.cpython-310-x86_64-linux-gnu.so:
	linux-vdso.so.1 (0x00007ffe3f9b6000)
	libfreetype.so.6 => /home/coulombc/libraqm/INST/usr/local/lib64/libfreetype.so.6 (0x00002aaeeba95000)
	libraqm.so.0 => /home/coulombc/libraqm/INST/usr/local/lib64/libraqm.so.0 (0x00002aaeebb88000)
	libc.so.6 => /cvmfs/soft.computecanada.ca/gentoo/2020/lib64/libc.so.6 (0x00002aaeebbc6000)
	libharfbuzz.so.0 => /home/coulombc/libraqm/INST/usr/local/lib64/libharfbuzz.so.0 (0x00002aaeebd80000)
	libfribidi.so.0 => /cvmfs/soft.computecanada.ca/gentoo/2020/usr/lib64/libfribidi.so.0 (0x00002aaeec045000)

This looks like a bug to me but could a wrong detection from Pillow. Anyone successfully built Pillow with RAQM? What am I missing here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions