Skip to content

fix(scons): strip RHEL annobin/hardened specs from all compile flags#16

Merged
movingpictures83 merged 1 commit into
FIUBioRG:masterfrom
quinnjr:bugfix/annobin-spec-strip
Jun 12, 2026
Merged

fix(scons): strip RHEL annobin/hardened specs from all compile flags#16
movingpictures83 merged 1 commit into
FIUBioRG:masterfrom
quinnjr:bugfix/annobin-spec-strip

Conversation

@quinnjr

@quinnjr quinnjr commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Problem

On RHEL/Fedora with a gcc-toolset / devtoolset enabled, scons fails to compile with:

plugin built for compiler version (8.5.0)
but run with compiler version (9.5.0)
cc1plus: error: fail to initialize plugin gcc-annobin.so

The -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 spec — injected into the build via perl's ExtUtils::Embed ccopts — tells gcc to load gcc-annobin.so. That plugin is version-locked to the compiler it was built for (the base system gcc 8.5.0), so compiling with a newer toolset gcc (9.5.0) aborts before any source is processed. --without-java has no effect because the spec comes from the Perl config, not Java.

Fix

_remove_annobin_flag previously removed only an exact-match token from CCFLAGS. This:

  • filters both the redhat-annobin-cc1 and redhat-hardened-cc1 specs, and
  • scans every compile-flag list (CCFLAGS, CXXFLAGS, SHCCFLAGS, SHCXXFLAGS, CPPFLAGS), since the spec can land in any of them depending on which config injected it.

This mirrors the existing _strip_lto_flags helper's multi-list approach.

Users who actually want RHEL hardening metadata in their binaries should instead match the compiler to the installed annobin plugin (e.g. dnf install gcc-toolset-9-annobin-plugin-gcc); this change only affects builds where the spec would otherwise break compilation.

🤖 Generated with Claude Code

The annobin spec (`-specs=...redhat-annobin-cc1`) injected by perl ccopts
makes gcc load gcc-annobin.so, a plugin version-locked to the compiler it
was built for. Under a gcc-toolset/devtoolset mismatch (e.g. plugin built
for gcc 8.5.0 but compiling with gcc 9.5.0) cc1plus aborts with "fail to
initialize plugin gcc-annobin.so".

The previous `_remove_annobin_flag` only removed an exact-match token from
CCFLAGS. Filter both the annobin and hardened specs from every compile-flag
list (CCFLAGS, CXXFLAGS, SHCCFLAGS, SHCXXFLAGS, CPPFLAGS), since the spec
can land in any of them depending on which config injected it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@movingpictures83 movingpictures83 merged commit 11cfc2c into FIUBioRG:master Jun 12, 2026
3 of 5 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.

2 participants