Created attachment 134076 [details] build log Trying to cross build git master branch with autotools for mingw fails with the following message: [ 12s] checking for EXPAT... configure: error: Package requirements (expat) were not met: [ 12s] [ 12s] No package 'expat' found [ 12s] [ 12s] Consider adjusting the PKG_CONFIG_PATH environment variable if you [ 12s] installed software in a non-standard prefix. Building dbus-1.10 with the same environment does not have this issue. [ 12s] Alternatively, you may set the environment variables EXPAT_CFLAGS [ 12s] and EXPAT_LIBS to avoid the need to call pkg-config. [ 12s] See the pkg-config man page for more details. Because mingw32-expat package does not support pkg-config I set export EXPAT_CFLAGS= export EXPAT_LIBS='-L/usr/i686-w64-mingw32/sys-root/mingw/lib -lexpat' and tried to rebuild with ../dbus-1/configure --cache-file=mingw32-config.cache --host=i686-w64-mingw32 --build=x86_64-suse-linux-gnu --target=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32/sys-root/mingw --exec-prefix=/usr/i686-w64-mingw32/sys-root/mingw --bindir=/usr/i686-w64-mingw32/sys-root/mingw/bin --sbindir=/usr/i686-w64-mingw32/sys-root/mingw/sbin --sysconfdir=/usr/i686-w64-mingw32/sys-root/mingw/etc --datadir=/usr/i686-w64-mingw32/sys-root/mingw/share --includedir=/usr/i686-w64-mingw32/sys-root/mingw/include --libdir=/usr/i686-w64-mingw32/sys-root/mingw/lib --libexecdir=/usr/i686-w64-mingw32/sys-root/mingw/libexec --localstatedir=/usr/i686-w64-mingw32/sys-root/mingw/var --sharedstatedir=/usr/i686-w64-mingw32/sys-root/mingw/com --mandir=/usr/i686-w64-mingw32/sys-root/mingw/share/man --infodir=/usr/i686-w64-mingw32/sys-root/mingw/share/info --enable-maintainer-mode --disable-static --enable-verbose-mode --enable-embedded-tests --enable-checks --enable-asserts --disable-xml-docs --disable-doxygen-docs '--with-dbus-session-bus-listen-address=autolaunch:scope=*install-path' '--with-dbus-session-bus-connect-address=autolaunch:scope=*install-path;autolaunch:' which fails too. Appended build log is from https://build.opensuse.org/package/show/home:rhabacker:branches:windows:mingw:win32:personal/mingw32-dbus-1 repository openSUSE_Leap_42.2
Created attachment 134077 [details] [review] patch
(In reply to Ralf Habacker from comment #0) > [ 12s] Alternatively, you may set the environment variables EXPAT_CFLAGS > [ 12s] and EXPAT_LIBS to avoid the need to call pkg-config. > [ 12s] See the pkg-config man page for more details. This is arguably a bug in the pkg-config macros, although it's easy to work around. The pkg-config macro does this: if test -n "$EXPAT_CFLAGS"; then pkg_cv_EXPAT_CFLAGS="$EXPAT_CFLAGS" elif test -n "$PKG_CONFIG"; then ... if test -n "$EXPAT_LIBS"; then pkg_cv_EXPAT_LIBS="$EXPAT_LIBS" elif test -n "$PKG_CONFIG"; then ... where arguably it should be using 'if test -n "${EXPAT_CFLAGS+set}"' so that it is distinguishing between set vs. unset, rather than between (set && non-empty) vs. (unset || empty). In your case this logic fails because EXPAT_CFLAGS is set, but happens to be set to an empty value. Please try setting EXPAT_CFLAGS to a value that is non-empty but will otherwise have no effect: export EXPAT_CFLAGS=' ' export EXPAT_LIBS='-L/usr/i686-w64-mingw32/sys-root/mingw/lib -lexpat' or give it a non-trivial CFLAG: export EXPAT_CFLAGS='-I/usr/i686-w64-mingw32/sys-root/mingw/include' export EXPAT_LIBS='-L/usr/i686-w64-mingw32/sys-root/mingw/lib -lexpat'
Comment on attachment 134077 [details] [review] patch Review of attachment 134077 [details] [review]: ----------------------------------------------------------------- I would prefer not to be working around pkg-config in our build system like this. We should aim for our use of build toolchain stuff like pkg-config to be as "boring and ordinary" as possible. We should either fix the pkg-config issue in pkg-config itself, or raise the workaround up a level into your spec file or equivalent so it's done in a way that would work equally for any pkg-config-using module. (Or both.) If we do work around it like this, it should be using AS_IF instead of plain shell if, and the commit message should explain what we're working around. But, again, I'd prefer not to.
(In reply to Ralf Habacker from comment #0) > Because mingw32-expat package does not support pkg-config That's a shame. If it doesn't install a pkg-config .pc file to /usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig or similar, please report that to the publisher of your mingw32-expat package as a bug. Expat added pkg-config metadata in version 2.1.0 (2012!) so it's not like this is something new... From your log it looks like you're already doing the right things to make pkg-config search /usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig and /usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig.
(In reply to Simon McVittie from comment #2) > This is arguably a bug in the pkg-config macros Bug #102622
(In reply to Simon McVittie from comment #4) > Expat added pkg-config metadata in version 2.1.0 (2012!) so it's > not like this is something new... Recent mingw32-expat packages is version 2.0.1 (https://build.opensuse.org/package/show/windows:mingw:win32/mingw32-expat), which explains missing pkg-config support.
(In reply to Ralf Habacker from comment #6) > Recent mingw32-expat packages is version 2.0.1 > (https://build.opensuse.org/package/show/windows:mingw:win32/mingw32-expat), > which explains missing pkg-config support. That version is over 10 years old. Please talk to its maintainer about updating it. It doesn't seem to include any security patches, which means it suffers from CVE-2009-3720, CVE-2009-3560, CVE-2012-0876, CVE-2012-1147, CVE-2012-1148, CVE-2015-1283, CVE-2016-0718, CVE-2016-4472, CVE-2016-5300, CVE-2012-6702, CVE-2017-9233, CVE-2016-9063, CVE-2017-11742 and 10 years' worth of non-CVE bugs. (These are probably not relevant to dbus' use of expat, because we only use expat to parse trusted configuration files - but other users of expat are likely to be vulnerable.)
(In reply to Simon McVittie from comment #7) > (In reply to Ralf Habacker from comment #6) > > Recent mingw32-expat packages is version 2.0.1 > > (https://build.opensuse.org/package/show/windows:mingw:win32/mingw32-expat), > > which explains missing pkg-config support. > > That version is over 10 years old. Please talk to its maintainer about > updating it. Thanks for this pointer, the above mentioned package has been updated to 2.2.4.
I think this is NOTOURBUG, then. possible solutions: use a more modern expat; or solve Bug #102622 in pkg-config and use the documented EXPAT_CFLAGS= EXPAT_LIBS=-lexpat; or work around Bug #102622 with EXPAT_CFLAGS=" " EXPAT_LIBS=lexpat.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.