Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 853250 - dev-util/mingw64-runtime-10.0.0-r1: Possible miscompilation (and failure on non-x86)
Summary: dev-util/mingw64-runtime-10.0.0-r1: Possible miscompilation (and failure on n...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Ionen Wolkens
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 915000
  Show dependency tree
 
Reported: 2022-06-21 02:38 UTC by Luke-Jr
Modified: 2023-10-01 06:04 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (build.log.xz,401.59 KB, application/x-xz)
2022-06-21 02:38 UTC, Luke-Jr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke-Jr 2022-06-21 02:38:02 UTC
Created attachment 786536 [details]
build log

From https://bugs.gentoo.org/644556#c17, moving to a new issue here:

(In reply to Larry the Git Cow from comment #16)
> The bug has been closed via the following commit(s):
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=4b7c1923fca6533a51be68bfbacc793469a521d4


I don't think this works right. Trying to build on ppc64le, I'm getting:

In file included from ./include/windef.h:290,
                 from src/hash.c:24:
./include/winnt.h:1655:2: error: #error You need to define a CONTEXT for your CPU

But it doesn't make sense to be using winnt.h for a Linux system, nor to use host system parameters for the target. It seems likely this will mis-compile if building on a x86_64 host for a x86_32 target...
Comment 1 Ionen Wolkens gentoo-dev 2022-06-21 03:07:29 UTC
genidl/gendef tools built fine, but that commit also added widl which seems to be  what's failing on ppc64le (winnt.h is a private header that's not installed, so it makes more sense now).

As far I can see I /think/ this only support these:
CONTEXT_I386_FULL
CONTEXT_AMD64_FULL
CONTEXT_ARM_FULL
CONTEXT_ARM64_FULL
(no PPC)

Think best bet may be to skip it for everything else.

Could you try to replace this:

    local tool=
    for tool in gendef genidl widl; do

by

    local tool=widl
    if use !amd64 && use !x86 && use !arm && use !arm64; then
        einfo "Skipping widl due to unsupported platform" #853250
        tool=
    fi

    for tool in gendef genidl ${tool}; do
Comment 2 Luke-Jr 2022-06-21 06:43:43 UTC
(In reply to Ionen Wolkens from comment #1)
> genidl/gendef tools built fine, but that commit also added widl which seems
> to be  what's failing on ppc64le (winnt.h is a private header that's not
> installed, so it makes more sense now).
> 
> As far I can see I /think/ this only support these:
> CONTEXT_I386_FULL
> CONTEXT_AMD64_FULL
> CONTEXT_ARM_FULL
> CONTEXT_ARM64_FULL
> (no PPC)

But it's supposed to be *targeting* amd64, so it shouldn't be acting on the host platform here. Doing so even for x86/ARM would be incorrect...
Comment 3 Ionen Wolkens gentoo-dev 2022-06-21 07:11:33 UTC
Like mentioned before, this does work for 64bit host with 32bit target (meaning it's seeing the right target just fine).

To rule out ebuild issues (which is not impossible), you could probably try to build widl without the ebuild, e.g.

  cd mingw-w64-v10.0.0/mingw-w64-tools/widl
  ./configure --host=powerpc64le-unknown-linux-gnu --target=x86_64-w64-mingw32
  make

Unsure what this context stuff is so can't really answer if it needs this on the host or target. If the above is broken too you may need to take it upstream and/or give me another fix if you think skipping widl is not right.
Comment 4 Ionen Wolkens gentoo-dev 2022-06-21 07:19:49 UTC
From a quick look, winnt.h is just checking __arm__ __x86_64__ and similar (set by gcc), and the host compiler would set this.

    x86_64-pc-linux-gnu-gcc -E -dM - <<<"" | grep x86_64
    #define __x86_64 1
    (replaced by i386 with -m32)

So sounds like it really doesn't support ppc* CHOST to me.
Comment 5 Ionen Wolkens gentoo-dev 2022-06-21 08:43:24 UTC
Also, to re-iterate, widl was newly added as a mean to skip requiring wine's widl at build time to build e.g. vkd3d-proton.

USE=tools used to skip this either way.
Comment 6 Larry the Git Cow gentoo-dev 2022-06-29 17:22:47 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=33d7b158dc01843bd129d0f89cb301d9bf355d0a

commit 33d7b158dc01843bd129d0f89cb301d9bf355d0a
Author:     Ionen Wolkens <ionen@gentoo.org>
AuthorDate: 2022-06-21 03:31:49 +0000
Commit:     Ionen Wolkens <ionen@gentoo.org>
CommitDate: 2022-06-29 17:22:36 +0000

    dev-util/mingw64-runtime: disable widl on unsupported platforms
    
    Not tested, but should work in theory.
    
    Also drop redundant --prefix while here, but keep array so it's
    easy to add option if needed in the future.
    
    Closes: https://bugs.gentoo.org/853250
    Signed-off-by: Ionen Wolkens <ionen@gentoo.org>

 dev-util/mingw64-runtime/mingw64-runtime-10.0.0-r1.ebuild | 13 ++++++++-----
 dev-util/mingw64-runtime/mingw64-runtime-8.0.0-r3.ebuild  | 13 ++++++++-----
 dev-util/mingw64-runtime/mingw64-runtime-9.0.0-r2.ebuild  | 13 ++++++++-----
 3 files changed, 24 insertions(+), 15 deletions(-)