Windows pkg-config bug: fontconfig.pc should use ${prefix}
Describe your issue
On Windows, CMake with pkg-config can't link to fontconfig
Expected Behavior
CMake with pkg-config should work fine.
Observed Behavior
Error message in CMake configure
Setup
- Operating System: Windows 10
- Device: PC
- GStreamer Version: 1.18.5
Steps to reproduce the bug
- Install gstreamer 1.18.5 by files at https://gstreamer.freedesktop.org/download/
MSVC 64-bit (VS 2019, Release CRT)
1.18.5 runtime installer
1.18.5 development installer
The files are installed at: E:\gstreamer
so the .pc files are at: E:\gstreamer\1.0\msvc_x86_64\lib\pkgconfig
- Create a CMake project with these lines:
find_package(PkgConfig)
pkg_check_modules(GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-1.0)
pkg_check_modules(HARFBUFF REQUIRED IMPORTED_TARGET harfbuzz)
target_link_libraries(${PROJECT_NAME} PkgConfig::GSTREAMER)
target_link_libraries(${PROJECT_NAME} PkgConfig::HARFBUFF)
- In Windows, I use
pkg-config-lite
from https://sourceforge.net/projects/pkgconfiglite/ forpkg-config
- During
cmake
, there is an error. The cmake output is:
-- Found PkgConfig: C:/Program Files (x86)/pkg-config-lite-0.28-1/bin/pkg-config.exe (found version "0.28")
-- Checking for module 'gstreamer-1.0'
-- Found gstreamer-1.0, version 1.18.5
-- Checking for module 'harfbuzz'
-- Found harfbuzz, version 2.6.7
-- Configuring done
CMake Error in CMakeLists.txt:
Imported target "PkgConfig::HARFBUFF" includes non-existent path
"c:/projects/repos/cerbero.git/1.18/build/dist/msvc_x86_64/include/freetype2"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
* The path was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and references files it does not
provide.
How reproducible is the bug?
The reproducibility of the bug is Always
Solutions you have tried
I checked the .pc files, harfbuzz
requires fontconfig
, and in fontconfig.pc
Cflags: -I${includedir} -Ic:/projects/repos/cerbero.git/1.18/build/dist/msvc_x86_64/include/freetype2 -Ic:/projects/repos/cerbero.git/1.18/build/dist/msvc_x86_64/include/libpng16
should be changed to
Cflags: -I${includedir} -I${prefix}/include/freetype2 -I${prefix}/include/libpng16
then the bug if fixed.
Others
In my usecase, I only used harfbuzz then fontconfig, so the bug in fontconfig.pc is reported, there might be other similar bugs because I also see code like this:
Libs.private: -Lc:/projects/repos/cerbero.git/1.18/build/dist/msvc_x86_64/lib -lexpat -Lc:/projects/repos/cerbero.git/1.18/build/dist/msvc_x86_64/lib -lfreetype
I'm not sure why it did not cause error as the Cflags: -I
above.