[FFmpeg-user] Configure error with fontconfig

Jim Worrall coniophora at gmail.com
Tue Apr 30 19:41:05 EEST 2024



> On Apr 29, 2024, at 23:00, Ferdi Scholten <ferdi at sttc-nlp.nl> wrote:
> 
> This may not be due to ffmpeg itself, but I would appreciate some help.
>> Configure says that pkg-config can’t find fontconfig.pc, but it seems to be
>> in the PKG_CONFIG_PATH.
>> 
>> # ./configure --cc=/usr/bin/gcc \
>> --prefix=$TARGET \
>> --pkg-config-flags="--static" \
>> --extra-cflags="-I/usr/local/include" \
>> --extra-ldflags="-L/usr/local/lib" \
>> --extra-libs="-lpthread -ldl -lstdc++" \
>> --enable-static --disable-shared \
>> --enable-nonfree --enable-gpl --enable-version3 \
>> --enable-libfribidi --enable-libfreetype --enable-libfontconfig \
>> --enable-libfdk-aac --enable-libx264 --enable-libx265 --disable-lzma
>> ERROR: fontconfig not found using pkg-config
>> 
>> ffbuild/config.log:
>> . . .
>> require_pkg_config libfontconfig fontconfig fontconfig/fontconfig.h FcInit
>> check_pkg_config libfontconfig fontconfig fontconfig/fontconfig.h FcInit
>> test_pkg_config libfontconfig fontconfig fontconfig/fontconfig.h FcInit
>> pkg-config --exists --print-errors fontconfig
>> Package fontconfig was not found in the pkg-config search path.
>> Perhaps you should add the directory containing `fontconfig.pc'
>> to the PKG_CONFIG_PATH environment variable
>> Package 'fontconfig', required by 'virtual:world', not found
>> ERROR: fontconfig not found using pkg-config
>> 
>> Here is fontconfig.pc:
>> # ll /usr/local/ffmpeg/packages/pkg-config/check/gtk/
>> total 224K
>> drwxr-xr-x 2 root root  28 Apr 28 11:14 ./
>> drwxr-xr-x 7 root root  72 Apr 28 11:14 ../
>> -rw-r--r-- 1 root root 232 Apr 28 11:14 atk.pc
>> -rw-r--r-- 1 root root 287 Apr 28 11:14 cairo-gobject.pc
>> -rw-r--r-- 1 root root 388 Apr 28 11:14 cairo.pc
>> -rw-r--r-- 1 root root 269 Apr 28 11:14 fontconfig.pc
>> 
>> The last path in PKG_CONFIG_PATH contains fontconfig.pc:
>> 
>> # echo $PKG_CONFIG_PATH
>> /lib:/usr/lib:usr/local:/usr/local/lib:/usr/local/lib/pkgconfig:
>> /usr/libdata/pkgconfig:/usr/local/libdata/:/usr/local/libdata/pkgconfig:
>> /usr/local/ffmpeg/target/lib:/usr/local/ffmpeg/target/lib/pkgconfig:
>> /usr/local/ffmpeg/target/share/pkgconfig:
>> /usr/local/ffmpeg/build/pkg-config/check/gtk/
>> _______________________________________________
> 
> Most likely the fontconfig package on your system is a shared library, it is not distributed as a static library. It therefor cannot be used in a static build with --disable-shared.
> 
> 
> Try building ffmpeg with shared libraries if you need fontconfig.

Thank you.  Before changing all the ffmpeg dependencies to shared libraries, 
I tried making a static fontconfig.  I removed the packaged fontconfig parts 
and built my own static fontconfig, but got the same “fontconfig not found" error.  
There is no .so file on the system with *fontconfig* in its name.

The relevant files may be:
/usr/local/ffmpeg/target/include/fontconfig/fontconfig.h
/usr/local/ffmpeg/target/lib/libfontconfig.la
/usr/local/ffmpeg/target/lib/pkgconfig/fontconfig.pc
/usr/local/ffmpeg/target/lib/libfontconfig.a

fontconfig.pc contains:
# cat /usr/local/ffmpeg/target/lib/pkgconfig/fontconfig.pc
prefix=/usr/local/ffmpeg/target
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
sysconfdir=${prefix}/etc
localstatedir=${prefix}/var
PACKAGE=fontconfig
confdir=${sysconfdir}/fonts
cachedir=${localstatedir}/cache/${PACKAGE}

Name: Fontconfig
Description: Font configuration and customization library
Version: 2.15.0
Requires:  freetype2 >= 21.0.15
Requires.private:  libxml-2.0 >= 2.6
Libs: -L${libdir} -lfontconfig
Libs.private:  
Cflags: -I${includedir}  

fontconfig.pc seems to be pointing to the right places (except sysconfdir=${prefix}/etc doesn’t exist; I don’t know what it would be looking for there).  I’m perplexed.


More information about the ffmpeg-user mailing list