Bug 446492

Summary: std::bad_alloc while building kf5-kxmlgui form Homebrew KDE
Product: [Frameworks and Libraries] frameworks-kxmlgui Reporter: EC <edcoronado.17>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED FIXED    
Severity: critical CC: erwan.delepinau, me, nate, rileyil77, yurii.kolesnykov
Priority: NOR    
Version: 5.89.0   
Target Milestone: ---   
Platform: Homebrew (macOS)   
OS: macOS   
URL: https://invent.kde.org/packaging/homebrew-kde/-/issues/37
Latest Commit: Version Fixed In: 9ed65a6a845091af6d7e07441b05be81b3ebf5f1
Sentry Crash Report:
Attachments: Cmake logs

Description EC 2021-12-04 22:44:02 UTC
Created attachment 144223 [details]
Cmake logs

SUMMARY
I'm trying to install Heaptrack through Brew in my MacOS so I can use heaptrack_gui and when I follow the steps in the guide (https://github.com/KDE/heaptrack#compile-heaptrack_gui-on-macos-using-homebrew) it gets to a part where it attempts to install `kde-mac/kde/kf5-kxmlgui` and cmake/ninja are throwing the following error:

[5/124] cd /tmp/kf5-kxmlgui-20211204-20574-10sperz/kxmlgui-5.88.0/build/src && /usr/local/Cellar/cmake/3.22.0/bin/cmake -E cmake_autogen /tmp/kf5-kxmlgui-20211204-20574-10sperz/kxmlgui-5.88.0/build/src/CMakeFiles/KF5XmlGui_autogen.dir/AutogenInfo.json Release && /usr/local/Cellar/cmake/3.22.0/bin/cmake -E touch /tmp/kf5-kxmlgui-20211204-20574-10sperz/kxmlgui-5.88.0/build/src/KF5XmlGui_autogen/timestamp && /usr/local/Cellar/cmake/3.22.0/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /tmp/kf5-kxmlgui-20211204-20574-10sperz/kxmlgui-5.88.0 /tmp/kf5-kxmlgui-20211204-20574-10sperz/kxmlgui-5.88.0/src /tmp/kf5-kxmlgui-20211204-20574-10sperz/kxmlgui-5.88.0/build /tmp/kf5-kxmlgui-20211204-20574-10sperz/kxmlgui-5.88.0/build/src /tmp/kf5-kxmlgui-20211204-20574-10sperz/kxmlgui-5.88.0/build/src/KF5XmlGui_autogen/deps /tmp/kf5-kxmlgui-20211204-20574-10sperz/kxmlgui-5.88.0/build/CMakeFiles/d/e81f38110362f4109aa6c3eed557416e085fcfd6a2aef71e3cb2d7bdbaccf44a.d
ninja: build stopped: subcommand failed.


STEPS TO REPRODUCE
1. On MacOS, ensure you have Homebrew installed
2. Run: `brew tap kde-mac/kde https://invent.kde.org/packaging/homebrew-kde.git`
3. Run: `"$(brew --repo kde-mac/kde)/tools/do-caveats.sh"`
4. Ensure that here are no errors
5. Run `brew install kf5-kxmlgui`
6. Observe the error described above

OBSERVED RESULT
Ninja/cmake are failing to build kf5-kxmlgui

EXPECTED RESULT
Brew should install kf5-kxmlgui correctly

SOFTWARE/OS VERSIONS
macOS: Big Sur 11.6.1 (20G224)

ADDITIONAL INFORMATION
Attached logs.
Comment 1 Nate Graham 2021-12-07 03:20:51 UTC
KDE does not maintain the brew packaging for our software; you'll want to contact the brew folks about it. Thanks!
Comment 2 Dawid Wróbel 2021-12-07 03:44:25 UTC
Nate, KDE *does* maintain brew packages. Some are upstream, but most are still provided by our own "tap" (think: repository). In this particular case, kf5-kxmlgui is provided by us.
Comment 3 Nate Graham 2021-12-07 04:13:40 UTC
We do!? Wow, you learn something every day. Where do the files live?
Comment 4 Dawid Wróbel 2021-12-07 04:33:44 UTC
https://invent.kde.org/packaging/homebrew-kde
Comment 5 Nate Graham 2021-12-07 15:59:36 UTC
Looks like GitLab issue is being used for that, instead of Bugzilla. Can you re-file this at https://invent.kde.org/packaging/homebrew-kde/-/issues? Thanks!
Comment 6 EC 2021-12-07 23:57:40 UTC
Thanks! Opened: https://invent.kde.org/packaging/homebrew-kde/-/issues/38
Comment 7 Yurii Kolesnykov 2021-12-08 00:44:11 UTC
Actually, the same problem was already reported recently. My guess was that according to std::bad_alloc reference user has low space in /tmp, which is used to build Homebrew packages. But, the second report in a row for the same package is a sign that something broke upstream. We haven't any changes in this formula except usual version bumps from March.
Comment 8 Yurii Kolesnykov 2021-12-31 18:20:16 UTC
*** Bug 447738 has been marked as a duplicate of this bug. ***
Comment 9 Yurii Kolesnykov 2021-12-31 18:27:23 UTC
I reopened this ticket since it keeps being submitted. I have no idea why some users observe this issue, I can't reproduce it on either Intel or Apple Silicon Mac.

Error message is:

libc++abi: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc
/bin/sh: line 1: 55767 Abort trap: 6           /usr/local/bin/doxygen /tmp/kf5-kxmlgui-20211104-55601-1psrc3e/kxmlgui-5.87.0/build/src/KF5XmlGui_ECMQchDoxygen.config

According to std::bad_alloc reference[1] there is some fail while allocating storage.

[1]https://en.cppreference.com/w/cpp/memory/new/bad_alloc
Comment 10 Erwan de Lépinau 2022-01-03 09:55:25 UTC
(In reply to Yurii Kolesnykov from comment #7)
> Actually, the same problem was already reported recently. My guess was that
> according to std::bad_alloc reference user has low space in /tmp, which is
> used to build Homebrew packages. But, the second report in a row for the
> same package is a sign that something broke upstream. We haven't any changes
> in this formula except usual version bumps from March.

(I am the person that opened https://bugs.kde.org/show_bug.cgi?id=447738)
I just ran `brew cleanup` before retrying to run `brew install kf5-kio` and this time the kf5-kxmlgui dependency successfully built. So it may indeed be a problem with the Homebrew cache that doesn't have enough available space.
Comment 11 Yurii Kolesnykov 2022-01-10 04:24:39 UTC
*** Bug 447372 has been marked as a duplicate of this bug. ***
Comment 12 Yurii Kolesnykov 2022-01-10 04:42:56 UTC
Fixed by disabling BUILD_QCH in kf5-kxmlgui and those removing its doxygen build depenency, which seems to be the source of error. In this commit: https://invent.kde.org/packaging/homebrew-kde/-/commit/9ed65a6a845091af6d7e07441b05be81b3ebf5f1