Bug 1974883

Summary: new pkg-config impl breaks usage by re-writing paths to add a bogus directory prefix
Product: [Fedora] Fedora Reporter: Daniel BerrangĂ© <berrange>
Component: mingw-filesystemAssignee: Kalev Lember <klember>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: drizt72, erik-fedora, klember, manisandro, marcandre.lureau, ngompa13, rjones
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1975416 (view as bug list) Environment:
Last Closed: 2021-06-23 15:52:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1975416    

Description Daniel Berrangé 2021-06-22 17:27:58 UTC
Description of problem:

The new mingw32-filesystem-119-1.fc35.noarch build has caused a regression in pkg-config, resulting in mangled paths being reported which cause builds to fail


I have done a cross compiled mingw32 build of libvirt, installing it into a scratch directory

$ export SCRATCH_DIR="/tmp/scratch"
$ export VROOT="$SCRATCH_DIR/vroot"
$ export LIBDIR="$VROOT/lib"
$ meson build -Ddriver_libvirtd=disabled "--prefix=$VROOT" "--libdir=$LIBDIR" 
$ ninja -C build install

I can see the .pc file correctly poiints the the install location:

$ cat /tmp/scratch/vroot/lib/pkgconfig/libvirt.pc 
prefix=/tmp/scratch/vroot
exec_prefix=/tmp/scratch/vroot
libdir=/tmp/scratch/vroot/lib
includedir=/tmp/scratch/vroot/include
datarootdir=/tmp/scratch/vroot/share

libvirt_api=/tmp/scratch/vroot/share/libvirt/api/libvirt-api.xml

# For compat with older versions - also present
# in libvirt-qemu.pc / libvirt-lxc.pc
libvirt_qemu_api=/tmp/scratch/vroot/share/libvirt/api/libvirt-qemu-api.xml
libvirt_lxc_api=/tmp/scratch/vroot/share/libvirt/api/libvirt-lxc-api.xml

Name: libvirt
Version: 7.5.0
Description: libvirt library
Requires:
Libs: -L${libdir} -lvirt
Cflags: -I${includedir}


The vroot also contains my mingw dlls:

$ ls /tmp/scratch/vroot/lib
libvirt-admin.dll.a  libvirt.dll.a  libvirt-lxc.dll.a  libvirt-qemu.dll.a  pkgconfig


The PKG_CONFIG_PATH is set to include this custom install location

export PKG_CONFIG_PATH="$LIBDIR/pkgconfig"

and now I query libvirt:

# i686-w64-mingw32-pkg-config --libs --cflags libvirt
-I/usr/i686-w64-mingw32/sys-root/mingw/tmp/scratch/vroot/include -L/usr/i686-w64-mingw32/sys-root/mingw/tmp/scratch/vroot/lib -lvirt 


We can see that i686-w64-mingw32-pkg-config has decided to arbitrarily add extra directory components onto the paths specified in the .pc file


Reverting back down to mingw32-filesystem-118-1.fc35.noarch fixes the problem so   i686-w64-mingw32-pkg-config actually honours the paths in the .pc file I provide


# i686-w64-mingw32-pkg-config --libs --cflags libvirt
-I/tmp/scratch/vroot/include -L/tmp/scratch/vroot/lib -lvirt 


Version-Release number of selected component (if applicable):
mingw32-filesystem-119-1.fc35.noarch

How reproducible:
Always

Steps to Reproduce:
1. Do a mingw32 build installing with an arbitrary custom prefix eg. $HOME/mingw32-vroot or whatever - any directory not under the mingw system location of /usr/i686-w64-mingw32/sys-root 
2.
3.

Actual results:
i686-w64-mingw32-pkg-config prefixes all paths from the .pc file, with the system path /usr/i686-w64-mingw32/sys-root 

Expected results:
i686-w64-mingw32-pkg-config should provide the paths *exactly* as listed in the .pc files with no modification.

Additional info:

Comment 1 Sandro Mani 2021-06-22 17:40:45 UTC
@ngompa13 Can you have a look at this one?

Comment 2 Richard W.M. Jones 2021-06-22 17:51:04 UTC
FYI change was this one: https://src.fedoraproject.org/rpms/mingw-filesystem/pull-request/7

Comment 3 Sandro Mani 2021-06-22 22:28:58 UTC
This is https://github.com/pkgconf/pkgconf/issues/213

Comment 4 Daniel Berrangé 2021-06-23 08:35:18 UTC
Urgh. So current pkgconf release is known to be seriously broken, and there's no sign of any patches for that bug for 4  months.  IMHO we need to either revert this change in mingw-filesystem, or figure out a workaround to fix it until pkgconf upstream deals with it properly.

Note this is blocking libvirt CI for mingw currently, since we rely on being able to install stuff into non-system root prefixes.

Comment 5 Sandro Mani 2021-06-23 12:11:55 UTC
Gave it a shot in [1], and proposed upstream [2], let's see what the feedback is.

[1] https://src.fedoraproject.org/rpms/pkgconf/pull-request/3
[2] https://github.com/pkgconf/pkgconf/pull/226

Comment 6 Sandro Mani 2021-06-23 15:52:18 UTC
Fixed in pkgconf-1.7.4-2.fc35.