Bug 499674

Summary: Compiling breeze-icons-6.9 exhausts memory on 32-bit hosts
Product: [Plasma] Breeze Reporter: Dave Flogeras <dflogeras2>
Component: IconsAssignee: visual-design
Status: RESOLVED FIXED    
Severity: major CC: christoph, dflogeras2, duha.bugs, kainz.a, m, nate, rikmills, sam
Priority: HI    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=956679
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Dave Flogeras 2025-02-08 10:41:58 UTC
The machine generated qrc_breeze-icons.cpp is now 110M containing mainly two giant character arrays.  Both GCC and Clang seems to need more memory than can be addressed on a 32-bit host to compile this.  Adding swap does not help, since a single process on 32-bit cannot address more than 3GB on Linux.

Is this possible to break up?  I understand no one probably wants to cater to aging 32bit support, but it seems a shame that an icons resource would be the tipping point.  I still use several 32bit x86 and arm hosts, running LXQT (which now requires breeze).
Comment 1 Christoph Cullmann 2025-02-10 11:39:04 UTC
We did use in the past the big resource way to add that, but that did lead to issues with LTO and Co.
Comment 2 Dave Flogeras 2025-02-20 10:00:35 UTC
Do you think it is worth raising with GCC folks?  In my view, at the end of the day, it's compiling ~100M of bytes not C code.  This may be overly naive, but I'm not sure why it would consume so much RAM when there's nothing to optimize here.  I did try make -j1, with -O0 to no avail here (my Gentoo system default is -O2).
Comment 3 Sam James 2025-05-27 07:10:22 UTC
I did try playing with this with a user and messing with GC and a few other things and it didn't make a difference. I think the proper way of doing it would be to use #embed, I guess.

We had another report of this today in Gentoo.
Comment 4 Sam James 2025-05-27 07:12:25 UTC
(In reply to Christoph Cullmann from comment #1)
> We did use in the past the big resource way to add that, but that did lead
> to issues with LTO and Co.

It should work if we disable LTO (just pass -fno-lto) to the one TU containing the resources.
Comment 5 Sam James 2025-06-12 13:12:00 UTC
*** Bug 505503 has been marked as a duplicate of this bug. ***
Comment 6 Rik Mills 2025-06-12 13:19:54 UTC
This did not occur in Ubuntu 32 bit builds until frameworks 6.15.0, and was triggered by the addition of the commit: https://invent.kde.org/frameworks/breeze-icons/-/commit/135e59fb4395c1779a52ab113cc70f7baa53fd5d

I will be forced to revert that commit in packaging, which is very sub optimal.
Comment 7 Nate Graham 2025-06-13 21:44:47 UTC
Christoph, would you mind looking into this?
Comment 8 Christoph Cullmann 2025-06-14 10:56:28 UTC
What happens if one turns off optimizations for that package?

One can try to revert https://invent.kde.org/frameworks/breeze-icons/-/merge_requests/379 for 32 bit ops, too, but that was done as distributions complained it is broken but nobody fixes it upstream in Qt.
Comment 9 Christoph Cullmann 2025-06-14 10:58:47 UTC
We can revert below request to fix it if distros stop to LTO that framework.

I could try to add a unit test to check if icons are there in the lib.

But that needs distro feedback, the current state is the result of that.
Comment 10 Christoph Cullmann 2025-06-14 11:00:19 UTC
BTW., which Qt version is used for the compile?
Comment 11 Rik Mills 2025-06-14 11:42:37 UTC
(In reply to Christoph Cullmann from comment #10)
> BTW., which Qt version is used for the compile?

Currently 6.8.3 in Ubuntu 25.10 dev release. We will hopefully get moving to 6.9.x once Plasma 6.4 is properly landed.
Comment 12 Rik Mills 2025-06-14 12:02:02 UTC
Reverting MR 397 and disabling LTO results in a successful build.
Comment 13 Rik Mills 2025-06-14 12:03:04 UTC
MR 379 I mean
Comment 14 Christoph Cullmann 2025-06-14 12:04:04 UTC
If I add a merge request for that with a test that the lib contains the right stuff, would you test that for me?
Comment 15 Rik Mills 2025-06-14 12:08:18 UTC
(In reply to Christoph Cullmann from comment #14)
> If I add a merge request for that with a test that the lib contains the
> right stuff, would you test that for me?

Absolutely :)
Comment 16 Christoph Cullmann 2025-06-14 12:48:18 UTC
Ok
Comment 17 Bug Janitor Service 2025-06-14 14:35:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/breeze-icons/-/merge_requests/481
Comment 18 Christoph Cullmann 2025-06-14 14:36:52 UTC
See the request, uses again the big/binary resource variant and adds a test that checks if files got lost, like we had in bug 487452.
Comment 19 Rik Mills 2025-06-14 16:11:00 UTC
Tested MR 481 with and without LTO disabled.

With LTO disabled, builds and tests succeeded on all 6 architectures.
With LTO enabled builds succeeded but the test failed, as expected. Exception was ironically armhf, where the test passed. Go figure!

(note: I had to adjust packaging to add a virtual dispaply in the buildd test env with xvfb to get the new test to run, but that is not a big issue)
Comment 20 Christoph Cullmann 2025-06-14 16:22:19 UTC
(note: I had to adjust packaging to add a virtual dispaply in the buildd test env with xvfb to get the new test to run, but that is not a big issue)

That I can fix, too.
Comment 21 Christoph Cullmann 2025-06-14 16:24:21 UTC
Can you retry?

I think QTEST_GUILESS_MAIN should be good enough for that test.
Comment 22 Christoph Cullmann 2025-06-14 16:26:59 UTC
If that works, somebody must approve it and one needs to inform the packagers about the LTO issue.
Comment 23 Christoph Cullmann 2025-06-14 16:27:17 UTC
*** Bug 487452 has been marked as a duplicate of this bug. ***
Comment 24 Rik Mills 2025-06-14 16:42:21 UTC
(In reply to Christoph Cullmann from comment #21)
> Can you retry?
> 
> I think QTEST_GUILESS_MAIN should be good enough for that test.

Seems so. Run and passed as before. Thank you!
Comment 25 Christoph Cullmann 2025-06-14 16:45:41 UTC
Thanks for testing.
Comment 26 Christoph Cullmann 2025-06-17 16:03:00 UTC
Can somebody approve the merge or shall we keep it as is?
Comment 27 Rik Mills 2025-06-17 16:30:26 UTC
(In reply to Christoph Cullmann from comment #26)
> Can somebody approve the merge or shall we keep it as is?

Approved it, as it is not good that current shipped code is not buildable on some architectures. Additionally I conformed in a debian 32 bit env that this will hit Debian on i386 and armhf when they get to 6.15.0 after they unfreeze from trixie release freeze.
Comment 28 Christoph Cullmann 2025-06-17 16:42:10 UTC
(In reply to Rik Mills from comment #27)
> (In reply to Christoph Cullmann from comment #26)
> > Can somebody approve the merge or shall we keep it as is?
> 
> Approved it, as it is not good that current shipped code is not buildable on
> some architectures. Additionally I conformed in a debian 32 bit env that
> this will hit Debian on i386 and armhf when they get to 6.15.0 after they
> unfreeze from trixie release freeze.

Is there some distributor list to ping about the change?
Comment 29 Christoph Cullmann 2025-06-17 16:43:00 UTC
Git commit 75fd5c16d1cf0bb6756d4dedd073fed2ef6ee325 by Christoph Cullmann.
Committed on 17/06/2025 at 16:42.
Pushed by cullmann into branch 'master'.

use big resource variant, else we OOM on 32 bit machines

this has issues with LTO, we have a unit test that tells if stuff got lost in the DLL

fix the resource loading for static library building, uncovered by the new unit test
Related: bug 487452

M  +1    -0    .gitignore
M  +5    -1    autotests/CMakeLists.txt
A  +68   -0    autotests/resourcetest.cpp     [License: LGPL(v2.0+)]
M  +3    -2    src/lib/CMakeLists.txt
M  +9    -0    src/lib/breezeicons.cpp

https://invent.kde.org/frameworks/breeze-icons/-/commit/75fd5c16d1cf0bb6756d4dedd073fed2ef6ee325
Comment 30 Rik Mills 2025-06-17 17:05:49 UTC
> Is there some distributor list to ping about the change?

https://mail.kde.org/mailman/listinfo/distributions
Comment 31 Christoph Cullmann 2025-06-17 17:08:19 UTC
Ok, send to that list this mail:

Hi,

Breeze Icons resource building got changed back to big resource
and a unit test was added to check if stuff is missing.

You might need to turn off LTO.

See

https://invent.kde.org/frameworks/breeze-icons/-/merge_requests/481

and linked bugs for details.

Greetings
Christoph
Comment 32 Christoph Cullmann 2025-06-17 17:09:19 UTC
Will be in moderation queue first, but guess will then convey enough info.

In any case it is good we have a test, the static build was always broken.
Comment 33 Sam James 2025-06-19 21:29:57 UTC
Git commit ddac172cba33db77143b9df4e5ad32be4e19cff6 by Sam James.
Committed on 19/06/2025 at 21:22.
Pushed by cullmann into branch 'master'.

Disable LTO for qt_add_big_resources

In fa44b11bc2b36d5c3cfc5c3403ea75b2fff57253, we went from qt_add_big_resources
to qt_add_resources because the former breaks with LTO, then we recently
went back to qt_add_big_resources in 75fd5c16d1cf0bb6756d4dedd073fed2ef6ee325
to fix the build on 32-bit machines.

That leaves LTO broken: try to use CMake to disable LTO for kbreezeicons
rather than asking distributors to disable LTO manually.

I tried to use CMake's support for LTO/IPO to disable it per-target
but it doesn't actually pass -fno-lto or anything if you're not using
CMake's support to enable LTO in the first place.

Bug: https://bugs.gentoo.org/956679
Bug: https://bugreports.qt.io/browse/QTBUG-41301
Related: bug 487452

M  +11   -0    CMakeLists.txt

https://invent.kde.org/frameworks/breeze-icons/-/commit/ddac172cba33db77143b9df4e5ad32be4e19cff6