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

Bug 549768 (PR66838)

Summary: [5.1/5.2] sys-devel/gcc-5 miscompiles ms_abi functions (breaks app-emulation/wine)
Product: Gentoo Linux Reporter: Alexandre Rostovtsev (RETIRED) <tetromino>
Component: [OLD] GCC PortingAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED FIXED    
Severity: normal CC: eugene.shalygin, gent_bz, genzilla, gerbilsoft, groggy, hendrik, jj, jrmalaq, M4rkusXXL, octoploid, ormaaj, sven.eden, ua_gentoo_bugzilla, wine
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://gcc.gnu.org/PR66838
See Also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66838
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 915000    
Attachments: winecfg_gcc5.2_page_fault.txt
emerge --info wine
app-emulation/wine-1.7.50-r1 - ewarn instead of eerror and exit

Description Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-05-17 23:01:04 UTC
wine-1.7.42 builds with gcc-5.1.0 without any issues, but fails at runtime:

err:process:start_wineboot failed to start wineboot, err 1359
err:winecfg:WinMain failed to restart 64-bit L"C:\\windows\\system32\\winecfg.exe", err 1359
Application tried to create a window, but no driver could be loaded.
The explorer process failed to start.

Apparently, this is a known problem.

> <slackner> tetromino: NP-Hardass: wine compiled with 5.1 is terribly broken
> <slackner> no need to test that, there are plenty of known issues
Comment 1 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-05-18 13:30:34 UTC
Upstream mailing list: http://thread.gmane.org/gmane.comp.emulators.wine.devel/100967
Comment 2 Daniel Douglas 2015-05-30 01:51:52 UTC
clang too? A separate error message would be slightly better if gcc is a hard requirement, IMHO. (I'm aware clang isn't officially supported in most of the tree.)
Comment 3 jospezial 2015-05-31 13:55:07 UTC
This is an optimization bug in GCC and is fixed upstream in

https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=221325

As a workaround I did:

CFLAGS="-march=native -O0 -pipe" USE="custom-cflags" emerge -va wine

With "-O0" optimization should be disabled.
Does not work without USE="custom-cflags"

Now winecfg works.
Comment 4 octoploid 2015-07-10 05:54:05 UTC
See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66782
It is not fixed on the gcc-5 branch yet.
Comment 5 octoploid 2015-07-10 13:54:20 UTC
Will be fixed in gcc-5.2 (to be released in the comming days).
Comment 6 jospezial 2015-07-18 01:38:11 UTC
Created attachment 407042 [details]
winecfg_gcc5.2_page_fault.txt

With gcc-5.2 from the tree I get a different error with wine-9999.
I compiled this without the workaround.
Comment 7 octoploid 2015-07-18 09:54:09 UTC
(In reply to jospezial from comment #6)
> Created attachment 407042 [details]
> winecfg_gcc5.2_page_fault.txt
> 
> With gcc-5.2 from the tree I get a different error with wine-9999.
> I compiled this without the workaround.

Yes, there is another issue:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66838
Unfortunately it only got fixed after the gcc-5.2 release.
Comment 8 Adam Feldman gentoo-dev 2015-07-18 17:55:09 UTC
I was holding off on getting toolchain involved until upstream's patches actually fix the issues.  I've been interacting with wine devs, and thusfar, the patches upstream don't resolve the issues.
Comment 9 SpanKY gentoo-dev 2015-07-19 02:01:30 UTC
(In reply to NP-Hardass from comment #8)

ok, i was going by comment #7.  feel free to redirect once all the issues shake out and there are patches for us to add to gcc.
Comment 10 Mike Lothian 2015-08-09 05:47:24 UTC
I can confirm with this patch https://gcc.gnu.org/viewcvs/gcc/branches/gcc-5-branch/gcc/postreload.c?view=patch&r1=225935&r2=225934&pathrev=225935 applied to gcc-5.2.0 wine compiles and runs successfully
Comment 11 Konstantin (elxa) 2015-08-14 13:06:47 UTC
Could gentoo include this gcc patch by default? Works for me, too. Thx.
Comment 12 jospezial 2015-08-14 14:31:07 UTC
Does somebody know about other packages hit by the second gcc bug?
Comment 13 om3i 2015-08-20 21:13:14 UTC
Somehow 32bit wine-1.7.45 and wine-9999 doesn't segfault for me, whole system is built with gcc-5.2. Probably you should narrow down check in the ebuild.
Comment 14 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-08-21 04:34:15 UTC
(In reply to xpue from comment #13)
> Somehow 32bit wine-1.7.45 and wine-9999 doesn't segfault for me, whole
> system is built with gcc-5.2. Probably you should narrow down check in the
> ebuild.

Interesting. Please attach your "emerge --info wine". Did you apply any patches to gcc?
Comment 15 om3i 2015-08-21 07:31:04 UTC
Created attachment 409720 [details]
emerge --info wine

I only removed gcc5 check and added nine d3d9 patch.
Comment 16 David Korth 2015-08-23 15:13:00 UTC
I just started hitting this issue after upgrading some Wine dependency using gcc-5.2. This is with wine-1.7.41 compiled using gcc-4.9.2.

I'll take a look through the list of dependencies and see if I can determine which one broke it.
Comment 17 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-08-25 15:13:53 UTC
(In reply to xpue from comment #15)
> Created attachment 409720 [details]
> emerge --info wine
> 
> I only removed gcc5 check and added nine d3d9 patch.

It seems that the runtime failure is happening with 64-bit wine. Probably we can remove the restriction when USE="abi_x86_32 -abi_x86_64".
Comment 18 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-08-26 04:48:31 UTC
The gcc-5 check is now applied only for 64-bit wine; 32-bit-only 1.7.50 seems to work fine with gcc-5.2.0.

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26512e9ccdcce4f77440d4118061da9fff236caf
Comment 19 Sven Eden 2015-09-03 04:33:11 UTC
(In reply to Alexandre Rostovtsev from comment #18)
> The gcc-5 check is now applied only for 64-bit wine; 32-bit-only 1.7.50
> seems to work fine with gcc-5.2.0.
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=26512e9ccdcce4f77440d4118061da9fff236caf

I can confirm, that applying the patch mentioned in comment 10 to gcc-5.2.0 fixes the issue for 64bit wine on my machine.

winecfg works, and I just played a nice round of Mass Effect 1 on my laptop.

I have pushed an ebuild, app-emulation/wine-1.7.50-r1 to my overlay 'seden' (available via layman) which does no longer exit, but warns the user (with a 10 seconds delay) that said patch must be applied to gcc-5.2.0 before building wine.
Comment 20 Sven Eden 2015-09-03 04:35:05 UTC
Created attachment 410900 [details]
app-emulation/wine-1.7.50-r1 - ewarn instead of eerror and exit

The mentioned ebuild, for reference.
Comment 21 jospezial 2015-09-10 13:36:20 UTC
What about to add a recent gcc-5 snapshot to the tree and depend on that?
That would fix some other issues we do not know about. 

ftp://gcc.gnu.org/pub/gcc/snapshots/LATEST-5/

The snapshots are announced at the gcc mailing list.
for example:
https://gcc.gnu.org/ml/gcc/2015-09/msg00129.html
Comment 22 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-10-01 15:10:42 UTC
Let's ask toolchain to get this gcc patch into the tree.
Comment 23 SpanKY gentoo-dev 2015-10-01 16:09:52 UTC
adding this fix to gcc-5.2 shouldn't be an issue.  we don't add snapshots to the main tree anymore.
Comment 24 Ryan Hill (RETIRED) gentoo-dev 2015-10-02 00:30:48 UTC
Since this is a gcc bug and not a wine bug I'm removing it from the tracker.
Comment 25 SpanKY gentoo-dev 2015-10-02 21:25:19 UTC
should be fixed in current 5.2.0 version:
http://sources.gentoo.org/gentoo/src/patchsets/gcc/5.2.0/gentoo/69_all_gcc-5-ms_abi-pr66838.patch?rev=1.1.

i can't push an updated ebuild as the git repo seems broken atm
Comment 27 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-10-02 22:47:19 UTC
(In reply to SpanKY from comment #26)
> http://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=2777661a2aa69b39f69d21e397e2341c25c46066

Thanks. But since there was no revision bump, how should the wine ebuild check for whether the currently installed =gcc-5.2.0 has the patch or not?
Comment 28 SpanKY gentoo-dev 2015-10-03 00:30:30 UTC
(In reply to Alexandre Rostovtsev from comment #27)

there will be a bump when it's unmasked
Comment 29 Alexandre Rostovtsev (RETIRED) gentoo-dev 2015-10-03 05:43:55 UTC
(In reply to SpanKY from comment #28)
> (In reply to Alexandre Rostovtsev from comment #27)
> 
> there will be a bump when it's unmasked

For now, I've changed the gcc check in wine to simply run the PR66838 test case when gcc major version is 5 and minor is <= 2.

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28604e0c07a3062664926465c294038a9dcdb82f