Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with gcc9 #317

Open
KlausMeier opened this issue May 14, 2019 · 30 comments
Open

Problems with gcc9 #317

KlausMeier opened this issue May 14, 2019 · 30 comments

Comments

@KlausMeier
Copy link

With gcc8 everything works fine for me. But after switching to gcc9 I had no problem to build the packages, but some packages crashed, when I start them. There was mpv, kodi and the plasma system settings. But I think, they crashed because of some libraries. I rebuild mpv with normal cflags, no difference. At the moment I try with -O2.

@InBetweenNames
Copy link
Owner

I actually just did a full system rebuild so I will try these packages ASAP.

@KlausMeier
Copy link
Author

The problem is not the build, that works very well, you had to test every application. They crashed. And then I don't know, where is the reason. Because I rebuild mpv with standard flags but it crashed again with a memory access error.

@pchome
Copy link
Contributor

pchome commented May 14, 2019

@KlausMeier
media-video/mpv is OK for me.

I usually don't do (read "never") full system rebuild after GCC upgrade, but only packages containing static libraries (similar to lto-rebuild). So mpv was last built a month ago using gcc8, rebuilt using gcc9 still OK.

media-video/mpv-0.29.1-r1::gentoo was built with the following:
USE="X alsa cli egl iconv jack jpeg lcms libass lua luajit openal opengl pulseaudio uchardet vdpau xv zlib (-aqua) -archive -bluray -cdda (-coreaudio) -cplugins -cuda -doc -drm -dvb -dvd -gbm -javascript -libcaca -libmpv -oss (-raspberry-pi) -rubberband -samba -sdl (-selinux) -test -tools -v4l -vaapi -vulkan -wayland -zsh-completion" ABI_X86="(64)" PYTHON_TARGETS="python2_7 python3_7 -python3_5 -python3_6"
CFLAGS="-march=native -O3 -pipe -fgraphite-identity -ftree-loop-distribution -floop-nest-optimize -fipa-pta -flto=3 -fuse-linker-plugin -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
CXXFLAGS="-march=native -O3 -pipe -fgraphite-identity -ftree-loop-distribution -floop-nest-optimize -fipa-pta -flto=3 -fuse-linker-plugin -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"

@KlausMeier
Copy link
Author

Yes, I told you, this is not a problem of mpv. I rebuild mpv with standard flags and it crashed again. But I told you three times, that it is not a problem of mpv but a problem of a library. And i don't know which library. mpv crashed, because I rebuild a library, that you don't rebuild.

@InBetweenNames
Copy link
Owner

I am getting a crash on systemsettings5 after the rebuild. I'll investigate that.

@javashin
Copy link

This Is Why I dont Built with ipa and no-plt and no others strange flags gcc 9.1 worked fine here but i rolled back to my backup with no ipa and no no-plt and fastmath i masked gcc 9.1 and everything works fine this way also i changed from ld.gold to bfd and compiled firefox with clang+pgo+lto+-O3 everything working fine

CC="gcc"
CXX="g++"
AR="gcc-ar"
NM="gcc-nm"
RANLIB="gcc-ranlib"
STRIP="gcc-strip"
LD="ld.bfd"
CFLAGS="-O3 -march=native -mfpmath=both -funroll-loops -falign-functions=32 -fgraphite-identity -floop-nest-optimize -fno-semantic-interposition -flto=3 -fuse-linker-plugin -fuse-ld=bfd -pipe"
CXXFLAGS="-O3 -march=native -mfpmath=both -funroll-loops -falign-functions=32 -fgraphite-identity -floop-nest-optimize -fno-semantic-interposition -flto=3 -fuse-linker-plugin -fuse-ld=bfd -pipe"
CPPFLAGS="-O3 -march=native -mfpmath=both -funroll-loops -falign-functions=32 -fgraphite-identity -floop-nest-optimize -fno-semantic-interposition -flto=3 -fuse-linker-plugin -fuse-ld=bfd -pipe"
FFLAGS="-O3 -march=native -mfpmath=both -funroll-loops -falign-functions=32 -fgraphite-identity -floop-nest-optimize -fno-semantic-interposition -flto=3 -fuse-linker-plugin -fuse-ld=bfd -pipe"
FCFLAGS="-O3 -march=native -mfpmath=both -funroll-loops -falign-functions=32 -fgraphite-identity -floop-nest-optimize -fno-semantic-interposition -flto=3 -fuse-linker-plugin -fuse-ld=bfd -pipe"
F77FLAGS="-O3 -march=native -mfpmath=both -funroll-loops -falign-functions=32 -fgraphite-identity -floop-nest-optimize -fno-semantic-interposition -flto=3 -fuse-linker-plugin -fuse-ld=bfd -pipe"
LDFLAGS="-Wl,-O2 -Wl,--as-needed -Wl,--hash-style=gnu"

@InBetweenNames
Copy link
Owner

I don't see what any of that has to do with this.

@InBetweenNames
Copy link
Owner

Getting a:

Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)

Qt and systemsettings are compiled with GCC 9.1, -O2 -march=native -pipe only just to be sure. It may be a Qt bug.

@InBetweenNames
Copy link
Owner

My other KDE apps seem fine too

@InBetweenNames
Copy link
Owner

Updated Qt to 5.13.9999, problem does not seem present anymore!

@Supded
Copy link

Supded commented May 15, 2019

FFLAGS="-O3 -march=native -mfpmath=both -funroll-loops -falign-functions=32 -fgraphite-identity -floop-nest-optimize -fno-semantic-interposition -flto=3 -fuse-linker-plugin -fuse-ld=bfd -pipe"
Is that legit?

@InBetweenNames
Copy link
Owner

It's not a supported configuration, but it shouldn't break anything at least.

@InBetweenNames
Copy link
Owner

Update: Downgraded again to Qt 5.12.3, did a full rebuild of KDE. systemsettings5 problem is still resolved.

@InBetweenNames
Copy link
Owner

Kodi seems to work fine too.

@InBetweenNames
Copy link
Owner

@KlausMeier under what circumstances does mpv crash?

@lferra
Copy link

lferra commented May 18, 2019

I am getting a crash on systemsettings5 after the rebuild. I'll investigate that.

After the switch had also a crash with systemsettings5, and as suggested I tried to rebuild qt packages, with no success. Attempting to build the packages in order to obtain meaningful debug info, I realized that in my case the culprit was kde-frameworks/kactivities-stats package build with -O3: overriding the flags with -O2 get rid of the problem.

@KlausMeier
Copy link
Author

At the moment I rebuild my system step for step with CFLAGS="-march=native -O2 ${FLTO} -fuse-linker-plugin -ftree-vectorize -pipe" and mpv and kodi now works without any problem. But the plasma settings is still crashing.

@InBetweenNames
Copy link
Owner

You may have to rebuild KDE too. The crashes stopped after I fully rebuilt Qt and KDE.

@KlausMeier
Copy link
Author

I rebuild frameworks, no I can use the settings.

@InBetweenNames
Copy link
Owner

Try rebuilding anything in kde-apps as well. It seems the problem went away when I upgraded to the Qt 5.13 beta, and it still remained fixed when I downgraded to 5.12.3. Both required a full rebuild of KDE.

@ms178
Copy link

ms178 commented May 24, 2019

First, I am not on Gentoo but on Tumbleweed, but I've encountered similar symptoms as mentioned by the op while compiling the 32 bit build of Intel's Threading Building Blocks with GCC 9.1 and 10. The compilation itself is fine but as soon as I start the app where I use the binaries, it crashes back to desktop halfway through a loading screen. This is with the release build, the debug build runs fine. I had no such issues, even with the most aggressive compiler flags with GCC 8.3.1. More details here: uxlfoundation/oneTBB#145

If someone could replicate the issue or tell me what the problem is, that would already help.

@funghetto
Copy link
Contributor

There seem to be issues with wine and gcc 9 too:
https://bugs.winehq.org/show_bug.cgi?id=47167

@pchome
Copy link
Contributor

pchome commented May 25, 2019

Everybody aware, but for collection: bcache corruption bug
https://bugzilla.kernel.org/show_bug.cgi?id=203573
https://bugzilla.redhat.com/show_bug.cgi?id=1708315

@InBetweenNames
Copy link
Owner

Hopefully those problems can be fixed in a point release of GCC.

@Peter-Levine
Copy link

I am getting a crash on systemsettings5 after the rebuild. I'll investigate that.

After the switch had also a crash with systemsettings5, and as suggested I tried to rebuild qt packages, with no success. Attempting to build the packages in order to obtain meaningful debug info, I realized that in my case the culprit was kde-frameworks/kactivities-stats package build with -O3: overriding the flags with -O2 get rid of the problem.

Yep. Building kde-frameworks/kactivities-stats with -O2 worked for me.

@pchome
Copy link
Contributor

pchome commented Jun 12, 2019

More GCC 9 problems ...
#346

https://bugzilla.suse.com/show_bug.cgi?id=1137071#c11

There's self-contained test-case
char memory[128];

int main(int argc, char **argv)
{
  const char *str;
  switch (argc)
  {
    case 1:
      str = (const char []){'C','h','a','i','n','i','n','g','M','o','d','e','E','C','B',0}; break;
    default:
      str = (const char []){'C','h','a','i','n','i','n','g','M','o','d','e','G','C','M',0}; break;
  }

  __builtin_memcpy(memory, str, __builtin_strlen (str) + 1);
  if (memory[14] != 'B')
    __builtin_abort ();
  
  return 0;
}

https://www.gnu.org/software/gcc/gcc-9/porting_to.html#complit

Should we use -Werror=c90-c99-compat for GCC 9 to prevent such issues?

wine2.c: In function 'main':
wine2.c:9:28: error: ISO C90 forbids compound literals [-Werror=c90-c99-compat]
    9 |       str = (const char []){'C','h','a','i','n','i','n','g','M','o','d','e','E','C','B',0}; break;
      |                            ^
wine2.c:11:28: error: ISO C90 forbids compound literals [-Werror=c90-c99-compat]
   11 |       str = (const char []){'C','h','a','i','n','i','n','g','M','o','d','e','G','C','M',0}; break;
      |                            ^
cc1: some warnings being treated as errors

Otherwise it's pain in the ass.

EDIT: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89990

@pchome
Copy link
Contributor

pchome commented Jun 12, 2019

-fstack-reuse=none or -fsanitize-address-use-after-scope

@InBetweenNames
Copy link
Owner

It's tough, because -Werror=c90-c99-compat will also error out on code that could be perfectly fine. The issue looks like people were relying on a bug in GCC: https://www.gnu.org/software/gcc/gcc-9/porting_to.html#complit

When the GCC devs fixed the bug, the code written that depended on it working broke.

@pchome
Copy link
Contributor

pchome commented Jun 27, 2019

I currently testing -fstack-reuse=none in CFLAGS only. Cause using this I can compile and successfully run the above test.

"Possible performance hit" vs "possible data lose".

@kanyck
Copy link

kanyck commented Dec 1, 2019

I keep having
internal compiler error: in record_target_from_binfo, at ipa-devirt.c:2667
when trying to build LibreOffice with GCC9.
UPD: opened a new issue: #448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants