Important: Please read the Qt Code of Conduct -

Pkg config problem when cross compiling Qt 5.8 Linux->Windows (mingw)

  • I am cross compiling qt5.8.0 from Linux to Windows 64bit, everything seemingly builds fine however the generated PKG-Config files (e.g Qt5Core.pc, etc) contain a invalid path to library files:
    For example:

    Libs.private: -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmpr -lwinmm -lz  /libqtpcre.a

    Notice the leading slash '/' for /libqtpcre.a, not only that some files will also have libraries defined as "-llibqtpcre.a" with the suffix ".a"
    Anyone has any idea what causes this?
    My configuration line for qt looks like this:

    -opensource -force-pkg-config -confirm-license -c++std c++11 -xplatform win32-g++ -device-option CROSS_COMPILE=$xprefix -no-use-gold-linker -release -static -prefix $mprefix -no-icu -opengl desktop -no-glib -accessibility -nomake examples -nomake tests -system-zlib -system-libjpeg -no-pch -no-direct2d -v

    special env vars for pkg config:

    	export PKG_CONFIG="$htarget-pkg-config"
    	export PKG_CONFIG_SYSROOT_DIR="$cdir/xcompiler/"
    	export PKG_CONFIG_LIBDIR="$mprefix/lib/pkg-config"

    EDIT: The local pkg config files, for example ./qt-everywhere-opensource-src-5.8.0/qtactiveqt/lib/pkgconfig/Qt5AxBase.pc for example contains full paths like:
    -L/*/qt-everywhere-opensource-src-5.8.0/qtbase/lib /*/qt-everywhere-opensource-src-5.8.0/qtbase/lib/libQt5Widgetsd.a
    the Installed ones do contain just the basename with a slash prefixed,not sure where the slash is being added from during the install.

Log in to reply