Skip to content

Fix builing for ubuntu-latest - #37

Merged
sosthene-nitrokey merged 2 commits into
mainfrom
fix-ubuntu-latest
Nov 13, 2026
Merged

sosthene-nitrokey merged 2 commits into
mainfrom
fix-ubuntu-latest

Conversation

@sosthene-nitrokey

@sosthene-nitrokey sosthene-nitrokey commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

-ffrestanding forces libclang not to use the host's libraries. cc compiles with GCC which includes its own platform specific libraries so it works fine regardless of the environment regardless of the available libraries, but libclang used by bindgen gets confused on systems with multiple clang versions installed without this flag and loads the wrong version's headers instead of its own.

I'm honestly not fully certain of the implications for all downstreams, if this could cause issues, and if it should not be used for cc too.

@sosthene-nitrokey
sosthene-nitrokey force-pushed the fix-ubuntu-latest branch 6 times, most recently from 90fe9b9 to 901c80a Compare November 13, 2026 10:37
-ffrestanding forces libclang not to use the host's libraries.
`cc` compiles with GCC which includes its own platform specific libraries
so it works fine regardless of the environment regardless of the available
libraries, but libclang used by bindgen gets confused on systems with multiple
clang versions installed without this flag and loads the wrong version's
headers instead of its own.

@robin-nitrokey robin-nitrokey left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

-ffreestanding has the side effect of setting -fno-builtin which has effects on performance and code size, so I would only enable it if really necessary for the compilation.

Should we directly release the change? I think we need it to fix the CI in other projects.

@robin-nitrokey

Copy link
Copy Markdown
Member

If we are not sure about the implications, we could also move the option behind a feature flag and leave the choice to the user.

@sosthene-nitrokey

Copy link
Copy Markdown
Contributor Author

It's only enabled for the bindgen pass, not for the cc pass that builds littlefs itself. It should have no impact at all on the produced binary which is produced by gcc. bindgen does not produce code so I don't think it should affect any downstream. The only thing that could cause issues is if it some breaks builds in other conditions.

@sosthene-nitrokey

Copy link
Copy Markdown
Contributor Author

I'll make it into a release.

@robin-nitrokey

Copy link
Copy Markdown
Member

It's only enabled for the bindgen pass, not for the cc pass that builds littlefs itself.

Yes, that’s what I meant (because you raised the question of whether to use it for the compilation too in the PR text) – using it for bindgen should be fine, for the build we should be more careful.

@sosthene-nitrokey
sosthene-nitrokey merged commit 54cf280 into main Nov 13, 2026
7 checks passed
@sosthene-nitrokey
sosthene-nitrokey deleted the fix-ubuntu-latest branch November 13, 2026 14:36

This branch was successfully deployed

1 active deployment
crates.io — 54cf2805 Deployed Nov 13, 2026 by sosthene-nitrokey via publish #3
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.

3 participants