ffmpeg-build-script icon indicating copy to clipboard operation
ffmpeg-build-script copied to clipboard

ERROR: freetype2 not found using pkg-config

Open jasonsansone opened this issue 1 year ago • 7 comments
trafficstars

I have attempted to compile a fully static build on Ubuntu 22.04 and 23.10 without success.

ERROR: freetype2 not found using pkg-config

However, freetype2 is installed and also compiled successfully prior to ffmpeg compilation beginning.

jasonsansone avatar May 14 '24 12:05 jasonsansone

Same here, only happens with --full-static.

podman run -it quay.io/archlinux/archlinux:base-devel
pacman -Syu --noconfirm git
git clone https://github.com/markus-perl/ffmpeg-build-script
cd ffmpeg-build-script
git checkout v1.51
./build-ffmpeg --enable-gpl-and-non-free --latest --full-static --build

Build log: https://fb.hash.works/m6Fu2X0v/

hashworks avatar May 15 '24 16:05 hashworks

Additional notes: Here is the filetree after the above build. https://fb.hash.works/opUPK7

In workspace/include one can find freetype2 header files:

│       │   ├── freetype2
│       │   │   ├── freetype
│       │   │   │   ├── config
│       │   │   │   │   ├── ftconfig.h
│       │   │   │   │   ├── ftheader.h
│       │   │   │   │   ├── ftmodule.h
│       │   │   │   │   ├── ftoption.h
│       │   │   │   │   ├── ftstdlib.h
│       │   │   │   │   ├── integer-types.h
│       │   │   │   │   ├── mac-support.h
│       │   │   │   │   └── public-macros.h
│       │   │   │   ├── freetype.h
│       │   │   │   ├── ftadvanc.h
│       │   │   │   ├── ftbbox.h
│       │   │   │   ├── ftbdf.h
│       │   │   │   ├── ftbitmap.h
│       │   │   │   ├── ftbzip2.h
│       │   │   │   ├── ftcache.h
│       │   │   │   ├── ftchapters.h
│       │   │   │   ├── ftcid.h
│       │   │   │   ├── ftcolor.h
│       │   │   │   ├── ftdriver.h
│       │   │   │   ├── fterrdef.h
│       │   │   │   ├── fterrors.h
│       │   │   │   ├── ftfntfmt.h
│       │   │   │   ├── ftgasp.h
│       │   │   │   ├── ftglyph.h
│       │   │   │   ├── ftgxval.h
│       │   │   │   ├── ftgzip.h
│       │   │   │   ├── ftimage.h
│       │   │   │   ├── ftincrem.h
│       │   │   │   ├── ftlcdfil.h
│       │   │   │   ├── ftlist.h
│       │   │   │   ├── ftlogging.h
│       │   │   │   ├── ftlzw.h
│       │   │   │   ├── ftmac.h
│       │   │   │   ├── ftmm.h
│       │   │   │   ├── ftmodapi.h
│       │   │   │   ├── ftmoderr.h
│       │   │   │   ├── ftotval.h
│       │   │   │   ├── ftoutln.h
│       │   │   │   ├── ftparams.h
│       │   │   │   ├── ftpfr.h
│       │   │   │   ├── ftrender.h
│       │   │   │   ├── ftsizes.h
│       │   │   │   ├── ftsnames.h
│       │   │   │   ├── ftstroke.h
│       │   │   │   ├── ftsynth.h
│       │   │   │   ├── ftsystem.h
│       │   │   │   ├── fttrigon.h
│       │   │   │   ├── fttypes.h
│       │   │   │   ├── ftwinfnt.h
│       │   │   │   ├── t1tables.h
│       │   │   │   ├── ttnameid.h
│       │   │   │   ├── tttables.h
│       │   │   │   └── tttags.h
│       │   │   └── ft2build.h

Additionally there are workspace/lib/libfreetype.a, workspace/lib/libfreetype.la, workspace/lib/pkgconfig/freetype2.pc and workspace/share/aclocal/freetype2.m4.

I guess it's missing libfreetype2.so?

hashworks avatar May 16 '24 14:05 hashworks

I was able to build --full-static using an Ubuntu 24.04 docker image and a fresh build environment. Not sure what causes the issue on Arch.

podman run -it docker.io/ubuntu:24.04
apt-get update
apt-get -y --no-install-recommends install git build-essential curl ca-certificates python3 python-is-python3 ninja-build meson
update-ca-certificates
git clone https://github.com/markus-perl/ffmpeg-build-script
cd ffmpeg-build-script
git checkout v1.51
./build-ffmpeg --enable-gpl-and-non-free --latest --small --full-static --build

hashworks avatar May 21 '24 13:05 hashworks

Same to me, I build on WSL - Windows 11

gcc ...  -lfreetype -lbz2 -lpng16 -lm -lz -lm -lz -lharfbuzz -lm -lglib-2.0 -lm -lpcre -lgraphite2 -lbrotlidec -lbrotlicommon -ldl -lpthread -lm -lz
/usr/bin/ld: cannot find -lgraphite2: No such file or directory
collect2: error: ld returned 1 exit status
ERROR: freetype2 not found using pkg-config

khoazero123 avatar Jun 19 '24 14:06 khoazero123

Same here, OpenSUSE 15.6

ERROR: freetype2 not found using pkg-config

BrokeFixBroke avatar Sep 13 '24 15:09 BrokeFixBroke

Tried running it without --pkg-config-flags="--static" \ no change. Really want t use ffmpeg but holding up a project.

BrokeFixBroke avatar Sep 14 '24 03:09 BrokeFixBroke

I recently ran into this on a Linux Mint 21.3 install. This ended up being caused but by ffmpeg failing to find a static version of one of its dependencies (libgraphite2), which resulted in what ffmpeg's configure interpreted as a pkg-config error.

I currently don't have the time to issue a fix PR, however (if you have the same graphite related problem, which you can confirm by looking at the ffmpeg configure log in packages/FFmpeg-release-*/ffbuild/config.log), this can be manually fixed by:

  • Cloning the graphite repo
  • Generate/configure it to build static libs and set its install prefix to your ffmpeg-build-script workspace directory (setting the BUILD_SHARED_LIBS=OFF and CMAKE_INSTALL_PREFIX_PATH=/path/to/your/workspacedir CMakeCache variables)
  • Building / installing (make && make install in most cases)

Brainzman avatar Nov 21 '24 09:11 Brainzman

came across this issue after banging my head against the wall for two days, as far as I can tell the original issue is due to freetype2 headers being in a subdir (to separate them from... 25 year old freetype 1.x headers?), which I think is separate from the libgraphite2 issue

would love to have this patched

EDIT: oops some stray edits in the comment, my apologies 😓

parkan avatar Aug 29 '25 14:08 parkan

I got this error trying to compile a CUDA static build - the logs say its a failed dependency on harfbuzz. Tried installing that manually as per the suggestion with graphite, but it didnt work. looking further into the circular dependency with harfbuzz and freetype2, I dont think this is something I will be able to solve :D

kanemari avatar Sep 01 '25 14:09 kanemari