I have been trying to emerge x86_64-w64-mingw32 via crossdev for a while now, as suggested by the app-emulation/wine-vanilla[mingw] ebuild. The build failed with gcc 10.2, but surprisingly it did not affect the emerge of wine-vanilla. Today I gave it another shot with gcc 11.1 and after removing -fstack-clash-protection from make.conf (causes ICE) I got stuck here and decided to file a bug: In file included from /usr/lib/gcc/x86_64-w64-mingw32/11.1.0/include/x86gprintrin.h:27, from /usr/lib/gcc/x86_64-w64-mingw32/11.1.0/include/x86intrin.h:27, from /var/tmp/portage/cross-x86_64-w64-mingw32/mingw64-runtime-8.0.0/temp/tmproot/include/intrin.h:73, from intrincs/rdtsc.c:7: /usr/lib/gcc/x86_64-w64-mingw32/11.1.0/include/ia32intrin.h:110: note: macro "__rdtsc" defined here 110 | #define __rdtsc() __builtin_ia32_rdtsc () | intrincs/rdtsc.c:16:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 16 | { | ^ Reproducible: Always Steps to Reproduce: Run: crossdev --target x86_64-w64-mingw32
Created attachment 703473 [details] crossdev log file
Created attachment 703476 [details] crossdev log file (runtime)
Created attachment 703479 [details] crossdev log file (runtime config)
__rdtsc is a new gcc11 mingw64-runtime issue https://sourceforge.net/p/mingw-w64/mailman/message/37259429/ Unsure if above patch is complete/proper for gcc11, haven't took the time to look into this.
The patch worked. Thank you!
'#if !__has_builtin(__rdtsc)' is a nasty check. I think the original intent is to check if compiler (MSVC) provides __rdtsc builtin. Instead it gets fooled by a (incompatible) compat define: /usr/lib/gcc/x86_64-w64-mingw32/11.1.0/include/ia32intrin.h:110: note: macro "__rdtsc" defined here 110 | #define __rdtsc() __builtin_ia32_rdtsc () That effectively checks for __builtin_ia32_rdtsc. Given it's a namespace clash simplest would be to not rely on gcc's __rdtsc.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40d0fd393ac48096a4e826f3eb941a21142a1f41 commit 40d0fd393ac48096a4e826f3eb941a21142a1f41 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2021-04-28 21:58:19 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2021-04-28 21:58:54 +0000 dev-util/mingw64-runtime: fix build against gcc-11 (__rdtsc clash) gcc-11 defines __rdtsc as a macro: // include/ia32intrin.h:110 #define __rdtsc() __builtin_ia32_rdtsc () and causes build failure: intrincs/rdtsc.c:15:30: error: macro "__rdtsc" passed 1 arguments, but takes just 0 15 | unsigned __int64 __rdtsc(void) | ^ Let's avoid __rdtsc definition on systems with #define __rdtsc present. There is still a chance that it might be a '#define __rdtsc __rdtsc'. We'll revisit it then. Reported-by: Mihai Donțu Closes: https://bugs.gentoo.org/786549 Package-Manager: Portage-3.0.18, Repoman-3.0.3 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> .../files/mingw64-runtime-8.0.0-__rdtsc.patch | 25 +++++ .../mingw64-runtime-8.0.0-r1.ebuild | 119 +++++++++++++++++++++ 2 files changed, 144 insertions(+)