How a missing build flag made btop crash on Fedora with AMD GPUs
In July 2026, opening btop on Fedora 44 produced a crash before the first screen appeared: btop: src/rocm_smi.cc:136: uint64_t get_multiplier_from_str(char): Assertion `false' failed. Aborted (core dumped). The error originated in the ROCm SMI library (rocm-smi), not in btop itself, and the same btop version ran fine on Ubuntu and Arch with identical hardware. The crash stemmed from a mismatch between how the kernel presents GPU frequency data and how the library parses it, combined with a build‑configuration gap unique to Fedora.
The problem has roots in February 2024, when Jerry James hit the identical crash on Fedora 39. He filed a Bugzilla report pointing to the rocm-smi function freq_string_to_int, which could not parse a line from sysfs. The kernel was deliberately outputting a line without an index – a format added in a 2020 commit – but the rocm-smi parser had no handler for it. The Bugzilla discussion stalled, and in November 2024 the report was closed as NOTABUG, leaving the parser defect dormant until it resurfaced on newer Fedora releases.
When the bug resurfaced on Fedora 43 and then Fedora 44, the crash re‑appeared because the library’s assert(false) remained active. In production builds, the NDEBUG macro is supposed to disable asserts, but Fedora’s %cmake macro defines CMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" without setting CMAKE_BUILD_TYPE. Without a build type, CMake does not apply the Release flags, so the assert stays compiled and active, triggering abort() when the parser encounters the unexpected sysfs line.
The data path from kernel to btop involves four links. First, the kernel prints an unusual format under /sys/class/drm/card0/device/pp_dpm_mclk when the current frequency does not match any defined level, common on AMD APUs. Second, the parser splits the number from the unit, leaving an empty unit string and causing get_multiplier_from_str to receive a null character, falling into its assert(false) default case. Third, the assert would normally be compiled out with NDEBUG. Fourth, Fedora’s package never defined NDEBUG, so the assert fired, abort() was called, and btop died without returning an error code.
The fix was a single line added to the %build section of the rocm-smi spec file: export CXXFLAGS="%{build_cxxflags} -DNDEBUG". This injects the flag without changing CMAKE_BUILD_TYPE, avoiding the side effect that the upstream CMakeLists.txt strips debug symbols only in Release mode, which would break Fedora’s debug source package generation. The change compiled cleanly, preserved debuginfo, and resolved the abort.
The pull request was opened on 2026‑07‑28, rebased twice, and sat unreviewed for weeks. After a measurement posted to the devel@ list showing zero compile lines with -DNDEBUG on Rawhide, and a direct email to maintainer Tom Rix on 2026‑09‑23, the PR was merged the same day. Updates propagated through Bodhi: Fedora 45 became stable on October 6, Fedora 44 on October 7. Testing confirmed btop now runs with GPU monitoring on a Ryzen 5 5600G, though the upstream parser defect in issue #231 remains open and the sysfs format issue may still cause the GPU clock to briefly disappear from the display.