Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 788430

Summary: sys-devel/clang: paths not set correctly for mingw
Product: Gentoo Linux Reporter: Mark Harmstone <mark>
Component: Current packagesAssignee: LLVM support project <llvm>
Status: RESOLVED FIXED    
Severity: normal CC: herrtimson, jstein, mgorny, sam
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/llvm/llvm-project/issues/56701
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: patch to fix issue
patch updated for clang 14.0.5

Description Mark Harmstone 2021-05-05 21:28:36 UTC
At present, clang can't be used as a replacement for x86_64-w64-mingw32-gcc, as it doesn't understand Gentoo's directory layout. There's workarounds for this upstream in clang/lib/Driver/ToolChains/Gnu.cpp, but no equivalent code in MinGW.cpp.

Reproducible: Always

Steps to Reproduce:
1. install crossdev for x86_64-w64-mingw32
2. try to compile simple program with clang -target x86_64-w64-mingw32

Actual Results:  
clang won't find any header files. If it can be coaxed to do so, it still passes through the wrong paths to the linker.

Expected Results:  
`clang -target x86_64-w64-mingw32` works equivalently to `x86_64-w64-mingw32-gcc`
Comment 1 Mark Harmstone 2021-05-05 21:30:29 UTC
Created attachment 706245 [details, diff]
patch to fix issue
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-05-07 23:36:08 UTC
Please submit this patch to reviews.llvm.org and get upstream to approve it.  Once it's in main, I can backport it to Gentoo.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-05-07 23:36:43 UTC
(please add me to subscribers to your diff, I'm 'mgorny' there)
Comment 4 tt_1 2022-06-22 16:51:12 UTC
hi, was this patch ever pushed to upstream?
Comment 5 Mark Harmstone 2022-06-22 18:20:42 UTC
Submitted but not accepted: https://reviews.llvm.org/D111081
Comment 6 Mark Harmstone 2022-06-22 18:21:13 UTC
Created attachment 786824 [details, diff]
patch updated for clang 14.0.5
Comment 7 tt_1 2022-06-22 18:41:41 UTC
I think upstream asked you to rebase the tests after some other changes were made, so it might be accepted once you rebase? 

I was kind of interested into compiling dxvk libs with x86_64-w64-mingw32-clang, do you think the changes suggested could allow for that?
Comment 8 tt_1 2022-07-07 06:00:59 UTC
patch was accepted upstream, once you push it its available in =clang-15.0.0.9999 :-)
Comment 9 tt_1 2022-07-25 07:04:24 UTC
patch landed in dev branch, thank you for your efforts 

bug may be closed, unless the llvm wants to cherry pick it for 14.x?
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-07-25 07:13:39 UTC
(In reply to tt_1 from comment #9)
> patch landed in dev branch, thank you for your efforts 
> 
> bug may be closed, unless the llvm wants to cherry pick it for 14.x?

Requested at https://github.com/llvm/llvm-project/issues/56701.
Comment 11 tt_1 2022-07-25 07:19:06 UTC
ah yeah, asking upstream to backport is first priority - thank you

I was under the impression, that there will be no new patch release of 14.x branch but we'll see what happens I guess.
Comment 12 tt_1 2022-07-25 20:02:33 UTC
So upstream declined a backport, can the llvm team please consider to pick it into the patchset? It's needed to compile app-emulation/dxvk with mingw32-clang
Comment 13 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2022-07-26 05:34:46 UTC
(In reply to tt_1 from comment #12)
> So upstream declined a backport, can the llvm team please consider to pick
> it into the patchset? It's needed to compile app-emulation/dxvk with
> mingw32-clang

Sorry, could you clarify whether this affects only specific environments or will it affect general Gentoo builds for dxvk?  I'm trying to establish whether we need to revbump clang for it or if we can sneak it in silently.
Comment 14 Larry the Git Cow gentoo-dev 2022-07-29 10:09:47 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26971cfa9e665e7e3e03cbce9f9a346874d96a8c

commit 26971cfa9e665e7e3e03cbce9f9a346874d96a8c
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2022-07-29 07:17:54 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2022-07-29 10:09:36 +0000

    sys-devel/clang: Backport MinGW patch to 14.0.6-r1
    
    Closes: https://bugs.gentoo.org/788430
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 sys-devel/clang/Manifest               |   1 +
 sys-devel/clang/clang-14.0.6-r1.ebuild | 440 +++++++++++++++++++++++++++++++++
 2 files changed, 441 insertions(+)