Bug 514187

Summary: compiled mingw files include the sys-root path
Product: [Fedora] Fedora Reporter: Paolo Bonzini <pbonzini>
Component: redhat-rpm-configAssignee: Jon Masters <jonathan>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: berrange, erik-fedora, fedora-mingw, fedora, jonathan, lfarkas, marcandre.lureau, pmatilai, rjones
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 513826 Environment:
Last Closed: 2009-09-09 14:13:16 UTC Type: ---
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: 513826    
Bug Blocks:    

Description Paolo Bonzini 2009-07-28 08:39:28 UTC
+++ This bug was initially created as a clone of Bug #513826 +++

Description of problem:
The paths in the .pc files for mingw32 include the /usr/i686-pc-mingw32/sys-root component.  This would prevent using them within the MSYS shell, for example.

It would be more correct to install them without the path and, in a i686-pc-mingw32-pkg-config (see bug 513825), provide the PKG_CONFIG_SYSROOT_DIR variable.  The script would work like this then:

#! /bin/sh

PKG_CONFIG_SYSROOT_DIR=`i686-pc-mingw32-gcc --print-sysroot`
prefix=$PKG_CONFIG_SYSROOT_DIR/mingw
PKG_CONFIG_LIBDIR=$prefix/lib/pkgconfig:$prefix/share/pkgconfig
export PKG_CONFIG_LIBDIR # PKG_CONFIG_SYSROOT_DIR
exec pkg-config "$@"

--- Additional comment from pbonzini on 2009-07-26 15:15:36 EDT ---

To clarify: the paths work, but still they are not correct.  Right now if I want to install MSYS under Wine I have two choices:

1) I proceed as in bug 513819 so that the Fedora mingw root is visible under MSYS.  Then however I cannot use pkg-config under MSYS.

2) I copy everything from /usr/i686-pc-mingw32/sys-root/mingw under Wine's c:/mingw, and then I lose all the updates that come through Fedora's package manager.  I also have to update the .pc files manually.

It's a lose-lose situation, and PKG_CONFIG_SYSROOT_DIR was meant exactly to support this.

--- Additional comment from erik-fedora on 2009-07-26 18:20:13 EDT ---

Why would you want to install MSYS under Wine? MSYS just provides some tools which we already have native on Linux. The bash/sh from MSYS is also way slower than native bash/sh

--- Additional comment from pbonzini on 2009-07-27 03:05:30 EDT ---

For testing.  I want to make sure that there are no hidden bits in the configure/make files that *only* work when crosscompiling (the typical example is forgetting to quote a variable that could contain Windows \ paths).

Besides, the idea of a sysroot is to match *exactly* what would be on the non-native system.  I could take the Fedora sysroot and copy it to a real Windows machine, and it should just work.  Now instead if I do this and install the Windows version of pkg-config, it will not work because the .pc files contains pointers to the Fedora images.

This is not easy to fix (it is a "flag day" bug, you have to fix all packages at once), so it may not have a high priority.  But it is serious.

--- Additional comment from rjones on 2009-07-27 04:53:55 EDT ---

(In reply to comment #3)
> For testing.  I want to make sure that there are no hidden bits in the
> configure/make files that *only* work when crosscompiling (the typical example
> is forgetting to quote a variable that could contain Windows \ paths).
> 
> Besides, the idea of a sysroot is to match *exactly* what would be on the
> non-native system.  I could take the Fedora sysroot and copy it to a real
> Windows machine, and it should just work.  Now instead if I do this and install
> the Windows version of pkg-config, it will not work because the .pc files
> contains pointers to the Fedora images.

This isn't how we install on Windows at all.  We use NSIS to
build installers.

And the aim of this project is to free developers from having to
use Windows at all, not to allow people to copy binaries onto a
Windows machine and continue development there.

The *.pc files contain the correct paths for cross-compiling
to a Windows host from a Fedora build system, which is precisely
the aim of this project.

--- Additional comment from pbonzini on 2009-07-28 04:36:53 EDT ---

Created an attachment (id=355373)
redhat-rpm-config part of the patch

The remaining part is to change the packages to do a change similar to what the patch does to %{_mingw32_makeinstall}.

Comment 1 Paolo Bonzini 2009-07-28 08:48:24 UTC
It turns out that a lot of binaries in mingw32 include the sys-root path.  This is bad, as it is comparable to including the rpm-build-root in a binary RPM:

./mingw/bin/gettextize:prefix="/usr/i686-pc-mingw32/sys-root/mingw"
./mingw/bin/gettextize:gettext_dir="/usr/i686-pc-mingw32/sys-root/mingw/share/gettext"
./mingw/bin/gettextize:  exec_prefix="/usr/i686-pc-mingw32/sys-root/mingw"
./mingw/bin/gettextize:  bindir="/usr/i686-pc-mingw32/sys-root/mingw/bin"
Binary file ./mingw/bin/libtermcap-0.dll matches
Binary file ./mingw/bin/msgexec.exe matches
Binary file ./mingw/bin/libgmodule-2.0-0.dll matches
Binary file ./mingw/bin/tndbm.exe matches
Binary file ./mingw/bin/libgettextsrc-0-17.dll matches
Binary file ./mingw/bin/conv2gdbm.exe matches

This however is a huge can of worms since it includes dependency_libs in libtool libraries:

./mingw/lib/libpng.la:dependency_libs=' /usr/i686-pc-mingw32/sys-root/mingw/lib/libz.la'

and as far as I know libtool does not support sysrooting.

Comment 2 Richard W.M. Jones 2009-07-28 08:49:02 UTC
Jon: Please don't apply this patch - read the comments in
bug 513826 first, and the discussion on the fedora-mingw
mailing list.

Comment 3 Paolo Bonzini 2009-07-28 08:59:36 UTC
Of course this patch is not meant to be applied.  "The remaining part is to change the packages to do a change similar to what the
patch does to %{_mingw32_makeinstall}" and "This however is a huge can of worms" should be clear enough.

Comment 4 Richard W.M. Jones 2009-09-09 14:13:16 UTC
Please discuss packaging problems on the list.
Closing as NOTABUG.