Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 901799 - [guru] net-misc/moonlight-4.3.1 fails to compile (lto): /usr/include/SDL2/SDL_syswm.h:248:9: error: type ‘struct <anon>’ violates the C++ One Definition Rule [-Werror=odr]
Summary: [guru] net-misc/moonlight-4.3.1 fails to compile (lto): /usr/include/SDL2/SDL...
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Andrew Athalye
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-17 13:09 UTC by Kostadin Shishmanov
Modified: 2023-03-20 19:32 UTC (History)
1 user (show)

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


Attachments
emerge --info and build log (build.log,186.44 KB, text/plain)
2023-03-17 13:09 UTC, Kostadin Shishmanov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kostadin Shishmanov 2023-03-17 13:09:49 UTC
Created attachment 858073 [details]
emerge --info and build log

net-misc/moonlight-4.3.1 fails to compile with CFLAGS=-flto -Werror=odr and LDFLAGS=-Werror=odr

/usr/include/SDL2/SDL_syswm.h:248:9: error: type ‘struct <anon>’ violates the C++ One Definition Rule [-Werror=odr]
  248 |         {
      |         ^
/usr/include/SDL2/SDL_syswm.h:294:9: note: a different type is defined in another translation unit
  294 |         {
      |         ^
/usr/include/SDL2/SDL_syswm.h:249:22: note: the first difference of corresponding definitions is field ‘display’
  249 |             Display *display;           /**< The X11 display */
      |                      ^
/usr/include/SDL2/SDL_syswm.h:295:32: note: a field of same name but different type is defined in another translation unit
  295 |             struct wl_display *display;             /**< Wayland display */
      |                                ^
/usr/include/SDL2/SDL_syswm.h:248:9: note: type name ‘_XDisplay’ should match type name ‘wl_display’
  248 |         {
      |         ^
/usr/include/wayland-client-core.h:110:8: note: the incompatible type is defined here
  110 | struct wl_display;
      |        ^
/usr/include/SDL2/SDL_syswm.h:294:9: error: type ‘struct <anon>’ violates the C++ One Definition Rule [-Werror=odr]
  294 |         {
      |         ^
/usr/include/SDL2/SDL_syswm.h:339:9: note: a different type is defined in another translation unit
  339 |         {
      |         ^
/usr/include/SDL2/SDL_syswm.h:295:32: note: the first difference of corresponding definitions is field ‘display’
  295 |             struct wl_display *display;             /**< Wayland display */
      |                                ^
/usr/include/SDL2/SDL_syswm.h:340:17: note: a field with different name is defined in another translation unit
  340 |             int dev_index;               /**< Device index (ex: the X in /dev/dri/cardX) */
      |                 ^
/usr/include/SDL2/SDL_syswm.h:231:5: error: type ‘union <anon>’ violates the C++ One Definition Rule [-Werror=odr]
  231 |     {
      |     ^
/usr/include/SDL2/SDL_syswm.h:231:5: note: a different type is defined in another translation unit
  231 |     {
      |     ^
/usr/include/SDL2/SDL_syswm.h:251:11: note: the first difference of corresponding definitions is field ‘x11’
  251 |         } x11;
      |           ^
/usr/include/SDL2/SDL_syswm.h:303:11: note: a field with different name is defined in another translation unit
  303 |         } wl;
      |           ^
/usr/include/SDL2/SDL_syswm.h:226:8: error: type ‘struct SDL_SysWMinfo’ violates the C++ One Definition Rule [-Werror=odr]
  226 | struct SDL_SysWMinfo
      |        ^
/usr/include/SDL2/SDL_syswm.h:226:8: note: a different type is defined in another translation unit
  226 | struct SDL_SysWMinfo
      |        ^
/usr/include/SDL2/SDL_syswm.h:349:7: note: the first difference of corresponding definitions is field ‘info’
  349 |     } info;
      |       ^
/usr/include/SDL2/SDL_syswm.h:349:7: note: a field of same name but different type is defined in another translation unit
  349 |     } info;
      |       ^
/usr/include/SDL2/SDL_syswm.h:231:5: note: type ‘union <anon>’ itself violates the C++ One Definition Rule
  231 |     {
      |     ^
/usr/include/qt5/QtCore/qnamespace.h:1275:10: error: type ‘Qt::DateFormat’ violates the C++ One Definition Rule [-Werror=odr]
 1275 |     enum DateFormat {
      |          ^
/usr/include/qt5/QtCore/qnamespace.h:1275:10: note: an enum with different value name is defined in another translation unit
 1275 |     enum DateFormat {
      |          ^
/usr/include/qt5/QtCore/qnamespace.h:1287:9: note: name ‘RFC2822Date’ differs from name ‘SystemLocaleDate’ defined in another translation unit
 1287 |         RFC2822Date = 8, // RFC 2822 (+ 850 and 1036 during parsing)
      |         ^
/usr/include/qt5/QtCore/qnamespace.h:1279:9: note: mismatching definition
 1279 |         SystemLocaleDate Q_DECL_ENUMERATOR_DEPRECATED_X("Use QLocale"),
      |         ^
lto1: some warnings being treated as errors
lto-wrapper: fatal error: x86_64-pc-linux-gnu-g++ returned 1 exit status
Comment 1 Andrew Athalye 2023-03-20 17:30:47 UTC
This looks like an issue in SDL that isn't directly related to Moonlight, unless there is something I'm missing. The code is also C, not C++, so odr really shouldn't be applied to it imo.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-20 19:23:46 UTC
If it's built with a c++ compiler, c++ rules apply.
Comment 3 Andrew Athalye 2023-03-20 19:32:34 UTC
(In reply to Sam James from comment #2)
> If it's built with a c++ compiler, c++ rules apply.

Ah, I see. Is there any solution besides stripping -Werror=odr from the build flags? I don't think modifying SDL and Qt would be a good fix, but if we want to honour the user's build flags idk what is best.