[FFmpeg-user] Configure error with fontconfig

Ferdi Scholten ferdi at sttc-nlp.nl
Wed May 1 09:11:18 EEST 2024


>> On Apr 30, 2024, at 13:53, Jim Worrall<coniophora at gmail.com>  wrote:
>>
>>
>>
>>> On Apr 30, 2024, at 11:29, Jim Worrall<coniophora at gmail.com>  wrote:
>>>
>>>
>>>
>>>> On Apr 30, 2024, at 09:41, Jim Worrall<coniophora at gmail.com>  wrote:
>>>>
>>>>
>>>>
>>>>> 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<http://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.
>>> Small error; ${prefix}/etc DOES exist.  It contains a fonts directory.
>>>
>> Many times the problem seems to actually be not finding lzma.
>> But I have --disable-lzma in my configure command.
>> Here’s the end of config.log this time:
>> . . .
>> brotlicommon -lxml2 -licui18n -licuuc -licudata -lz -llzma -lm
>> /usr/bin/ld: cannot find -llzma: No such file or directory
>> collect2: error: ld returned 1 exit status
>> ERROR: fontconfig not found using pkg-config
>>
> Problem solved, although a bit confusing.  It seems there
> may have been two problems.  After I provided a static fontconfig,
> it still complained that it couldn’t find fontconfig.  But really it was
> lzma.  When I built a static lzma (actually xz, which also produces lzma),
> the build worked fine.
>
> So it seems the —disable-lzma option doesn’t work; it still
> tries to incorporate lzma. But I don’t really understand it.
>
>
> ________________________________________
My guess is that fontconfig probably returns an error, because one of 
its dependencies (libfreetype) depends on several types of file 
compression. (there are many types of compressed fonts), WOFF being a 
common example.


More information about the ffmpeg-user mailing list