Skip to content

fix: resolve CMake compiler test failure in freestanding CI builds#727

Merged
mpusz merged 1 commit intompusz:masterfrom
rothmichaels:fix/ci-freestanding-linker-issue
Sep 29, 2025
Merged

fix: resolve CMake compiler test failure in freestanding CI builds#727
mpusz merged 1 commit intompusz:masterfrom
rothmichaels:fix/ci-freestanding-linker-issue

Conversation

@rothmichaels
Copy link
Copy Markdown
Contributor

The freestanding CI builds were failing during CMake's initial compiler test because the -ffreestanding flag was causing linker issues. The linker expected a main() function but freestanding environments may not have one.

This fix sets CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY when freestanding mode is enabled, which instructs CMake to skip the linking step during compiler tests and only compile to static libraries.

This resolves the undefined reference to main error in CI while maintaining proper freestanding compilation semantics.

🤖 Generated with Claude Code

The freestanding CI builds were failing during CMake's initial compiler test
because the -ffreestanding flag was causing linker issues. The linker expected
a main() function but freestanding environments may not have one.

This fix sets CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY when freestanding
mode is enabled, which instructs CMake to skip the linking step during
compiler tests and only compile to static libraries.

This resolves the undefined reference to main error in CI while maintaining
proper freestanding compilation semantics.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Owner

@mpusz mpusz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! There is a bug in CMake and I hope that they will fix it. But in the meantime, changing the target type will resolve our CI issues. I wasn't aware of this issue.

@mpusz mpusz merged commit 91f8517 into mpusz:master Sep 29, 2025
90 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