Skip to content

Fix build with modern host toolchains (GCC 15, CMake 4.x)#1978

Merged
widgetii merged 1 commit intoOpenIPC:masterfrom
widgetii:fix/modern-toolchain-compat
Apr 3, 2026
Merged

Fix build with modern host toolchains (GCC 15, CMake 4.x)#1978
widgetii merged 1 commit intoOpenIPC:masterfrom
widgetii:fix/modern-toolchain-compat

Conversation

@widgetii
Copy link
Copy Markdown
Member

@widgetii widgetii commented Apr 3, 2026

Summary

  • Export CMAKE_POLICY_VERSION_MINIMUM=3.5 in Makefile to fix host package build failures with CMake 4.x (e.g. host-lzo-2.10 uses cmake_minimum_required(VERSION 3.0) which CMake 4.x rejects)
  • Add global patch for host-m4-1.4.19 to fix gnulib _GL_ATTRIBUTE_NODISCARD compile error with GCC 15 (defaults to C23, where [[__nodiscard__]] attribute syntax doesn't work in all positions)

Context

Modern distributions (e.g. Arch Linux) ship GCC 15 and CMake 4.x, which break the Buildroot 2024.02.10 host tool build. These two minimal fixes restore compatibility while remaining invisible to existing Ubuntu CI:

  • CMAKE_POLICY_VERSION_MINIMUM env var was introduced in CMake 4.0 — older versions ignore it
  • The m4 gnulib patch is a no-op on older GCC where the C23 code path was never taken

Test plan

  • Clean build of hi3516ev300_lite succeeds on Arch Linux (GCC 15.2.1, CMake 4.3.1)
  • CI passes on Ubuntu (backward compatibility)

🤖 Generated with Claude Code

Set CMAKE_POLICY_VERSION_MINIMUM=3.5 globally to fix CMake 4.x rejecting
packages with cmake_minimum_required < 3.5 (e.g. host-lzo-2.10). Older
CMake versions ignore this environment variable.

Add m4 global patch to disable gnulib's C23 [[__nodiscard__]] attribute
path that breaks with GCC 15's default -std=gnu23. Falls back to the
equivalent __attribute__((warn_unused_result)).

Both fixes are backward compatible with the Ubuntu CI environment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@widgetii widgetii force-pushed the fix/modern-toolchain-compat branch from 3a7f48c to 08559d7 Compare April 3, 2026 18:33
@widgetii widgetii merged commit 656094d into OpenIPC:master Apr 3, 2026
87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant