Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 921685 - gnome-extra/gnome-system-monitor-45.0.2: fails to build with LTO: ../gnome-system-monitor-45.0.2/src/application.h:85:8: error: type ‘struct MutableProcInfo’ violates the C++ One Definition Rule [-Werror=odr]
Summary: gnome-extra/gnome-system-monitor-45.0.2: fails to build with LTO: ../gnome-sy...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2024-01-10 03:53 UTC by Rafael Kitover
Modified: 2024-11-04 11:08 UTC (History)
3 users (show)

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


Attachments
build log (gnome-system-monitor-build.log,175.82 KB, text/x-log)
2024-01-10 03:54 UTC, Rafael Kitover
Details
emerge --info (emerge-info.txt,20.61 KB, text/plain)
2024-01-10 03:55 UTC, Rafael Kitover
Details
environment (environment,132.16 KB, text/plain)
2024-11-01 12:04 UTC, Damian Dudycz
Details
Build log (build.log,127.65 KB, text/plain)
2024-11-01 12:04 UTC, Damian Dudycz
Details
Emerge info (emerge-info,6.41 KB, text/plain)
2024-11-01 12:05 UTC, Damian Dudycz
Details
Emerge pvq (emerge-pvq,186 bytes, text/plain)
2024-11-01 12:06 UTC, Damian Dudycz
Details
patch for LTO compilation error (gnome-system-monitor-45_fix-lto-build.patch,294 bytes, patch)
2024-11-02 23:18 UTC, Damian Dudycz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Kitover 2024-01-10 03:53:44 UTC
Fails to build with recommended flags based on:

https://wiki.gentoo.org/wiki/LTO

Reproducible: Always
Comment 1 Rafael Kitover 2024-01-10 03:54:30 UTC
Created attachment 881797 [details]
build log
Comment 2 Rafael Kitover 2024-01-10 03:55:16 UTC
Created attachment 881798 [details]
emerge --info
Comment 3 Rafael Kitover 2024-01-10 03:56:09 UTC
> emerge -pqv =gnome-extra/gnome-system-monitor-45.0.2
[ebuild   R   ] gnome-extra/gnome-system-monitor-45.0.2  USE="X systemd"
Comment 4 Damian Dudycz 2024-11-01 12:03:30 UTC
Got the same when building for Raspberry Pi 5 using catalyst, on current upstream. Host is also ARM64 (M1).
COMMON_FLAGS="-O2 -pipe -mcpu=cortex-a76+crc+crypto -mtune=cortex-a76 -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"

I'll add some logs.
Comment 5 Damian Dudycz 2024-11-01 12:04:10 UTC
Created attachment 907504 [details]
environment

/var/tmp/portage/gnome-extra/gnome-system-monitor-45.0.2/temp/environment
Comment 6 Damian Dudycz 2024-11-01 12:04:44 UTC
Created attachment 907505 [details]
Build log

/var/tmp/portage/gnome-extra/gnome-system-monitor-45.0.2/temp/build.log
Comment 7 Damian Dudycz 2024-11-01 12:05:10 UTC
Created attachment 907506 [details]
Emerge info

emerge --info '=gnome-extra/gnome-system-monitor-45.0.2::gentoo'
Comment 8 Damian Dudycz 2024-11-01 12:06:08 UTC
Created attachment 907507 [details]
Emerge pvq

emerge -pqv '=gnome-extra/gnome-system-monitor-45.0.2::gentoo'
Comment 9 immolo 2024-11-01 12:37:32 UTC
(In reply to Damian Dudycz from comment #4)
> Got the same when building for Raspberry Pi 5 using catalyst, on current
> upstream. Host is also ARM64 (M1).
> COMMON_FLAGS="-O2 -pipe -mcpu=cortex-a76+crc+crypto -mtune=cortex-a76 -flto
> -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
> 
> I'll add some logs.

Do be mindful to not repeat information that doesn't change what we already know , however as this includes ansifiltered logs and the previous didn't then it's fine in this case.

Can you please check if this is reported upstream and report if not and link the two bugs together so we can more easily work together on this?
Comment 10 Eli Schwartz gentoo-dev 2024-11-01 13:39:50 UTC
../gnome-system-monitor-45.0.2/src/application.h:85:8: error: type ‘struct MutableProcInfo’ violates the C++ One Definition Rule [-Werror=odr]
   85 | struct MutableProcInfo
      |        ^
../gnome-system-monitor-45.0.2/src/application.h:85:8: note: a different type is defined in another translation unit
   85 | struct MutableProcInfo
      |        ^
../gnome-system-monitor-45.0.2/src/application.h:125:10: note: the first difference of corresponding definitions is field ‘memxserver’
  125 |   gulong memxserver;
      |          ^
../gnome-system-monitor-45.0.2/src/application.h:128:10: note: a field with different name is defined in another translation unit
  128 |   gulong start_time;
      |          ^
../gnome-system-monitor-45.0.2/src/application.h:147:7: error: type ‘struct ProcInfo’ violates the C++ One Definition Rule [-Werror=odr]
  147 | class ProcInfo
      |       ^
../gnome-system-monitor-45.0.2/src/application.h:147:7: note: a type with different bases is defined in another translation unit
  147 | class ProcInfo
      |       ^
lto1: some warnings being treated as errors
lto-wrapper: fatal error: aarch64-unknown-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/aarch64-unknown-linux-gnu/13/../../../../aarch64-unknown-linux-gnu/bin/ld: error: lto-wrapper failed
Comment 11 Eli Schwartz gentoo-dev 2024-11-01 13:42:36 UTC
The fields that differ have different names on different lines. This usually means that the struct contains fields which are guarded by an #ifdef that is defined in one translation unit but not defined in another translation unit.
Comment 12 Damian Dudycz 2024-11-02 06:54:27 UTC
Issue reported in gnome gitlab:
https://gitlab.gnome.org/GNOME/gnome-system-monitor/-/issues/328
Comment 13 Damian Dudycz 2024-11-02 23:17:41 UTC
Issue occurred because application.h was using #ifdef HAVE_WNCK, while HAVE_WNCK was defined in config.h (generated by meson). I added #include <config.h> and it compiles now. I'll send the patch to gnome gitlab, for now I tested by putting it in /etc/portage/patches/gnome-extra/gnome-system-monitor
Comment 14 Damian Dudycz 2024-11-02 23:18:51 UTC
Created attachment 907738 [details, diff]
patch for LTO compilation error

Adds missing #include <config.h> in application.h, to define HAVE_WNCK correctly
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-02 23:54:31 UTC
(In reply to Damian Dudycz from comment #14)
> Created attachment 907738 [details, diff] [details, diff]
> patch for LTO compilation error
> 
> Adds missing #include <config.h> in application.h, to define HAVE_WNCK
> correctly

Thanks! Could you send it upstream as a PR/MR?
Comment 16 Damian Dudycz 2024-11-03 00:22:14 UTC
(In reply to Sam James from comment #15)
> (In reply to Damian Dudycz from comment #14)
> > Created attachment 907738 [details, diff] [details, diff] [details, diff]
> > patch for LTO compilation error
> > 
> > Adds missing #include <config.h> in application.h, to define HAVE_WNCK
> > correctly
> 
> Thanks! Could you send it upstream as a PR/MR?

Sure, I created PR: https://gitlab.gnome.org/GNOME/gnome-system-monitor/-/merge_requests/165
Comment 17 immolo 2024-11-03 14:02:16 UTC
Great work, thanks!