Skip to content

feat(guest): replace musl with picolibc#831

Merged
jprendes merged 1 commit intohyperlight-dev:mainfrom
andreiltd:libc-takeover
Apr 21, 2026
Merged

feat(guest): replace musl with picolibc#831
jprendes merged 1 commit intohyperlight-dev:mainfrom
andreiltd:libc-takeover

Conversation

@andreiltd
Copy link
Copy Markdown
Member

@andreiltd andreiltd commented Aug 28, 2025

This patch removes custom musl implementation used by the guest and replace it with picolibc v1.8.11.

Note: The picolibc submodule uses the picolibc-bsd fork (https://github.com/hyperlight-dev/picolibc-bsd), which is a redistribution with all copyleft-licensed files removed from the tree and history. Only BSD/MIT/permissive-licensed source files are present.

@andreiltd andreiltd marked this pull request as draft August 28, 2025 11:48
@andreiltd andreiltd added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Aug 28, 2025
@andreiltd andreiltd force-pushed the libc-takeover branch 6 times, most recently from eaf1d54 to b18a374 Compare August 28, 2025 13:44
Copy link
Copy Markdown
Contributor

@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

I love this PR!

Comment thread src/hyperlight_guest_bin/src/host_bridge.rs Outdated
Comment thread src/hyperlight_guest_bin/src/host_bridge.rs Outdated
Comment thread src/hyperlight_guest_bin/Cargo.toml
Comment thread src/hyperlight_guest_bin/src/host_bridge.rs Outdated
Comment thread src/hyperlight_guest_bin/src/host_bridge.rs Outdated
@jsturtevant
Copy link
Copy Markdown
Contributor

will help with #282

Comment thread src/hyperlight_host/tests/sandbox_host_tests.rs Outdated
Copy link
Copy Markdown
Contributor

@dblnz dblnz left a comment

Choose a reason for hiding this comment

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

Great work, Tomasz!! This is one hell of a diff and I like it 😆

Comment thread src/hyperlight_guest_bin/c/clock.c Outdated
Comment thread src/hyperlight_guest_bin/src/lib.rs Outdated
Comment thread src/hyperlight_guest_bin/build.rs
Comment thread src/hyperlight_guest_bin/build.rs Outdated
Comment thread src/hyperlight_guest_bin/build_files.rs
Comment thread Justfile Outdated
Comment thread src/hyperlight_guest_bin/c/clock.c Outdated
Comment thread src/hyperlight_guest_bin/src/host_bridge.rs Outdated
Comment thread src/hyperlight_guest_bin/src/host_bridge.rs Outdated
Comment thread src/hyperlight_guest_bin/src/host_bridge.rs Outdated
@syntactically
Copy link
Copy Markdown
Member

Is the licensing approval finally done for this, making it ready for review/merge?

Comment thread src/tests/c_guests/c_simpleguest/main.c
Comment thread src/hyperlight_guest_bin/src/host_bridge.rs Outdated
Comment thread src/hyperlight_guest_bin/src/libc.rs
@andreiltd andreiltd force-pushed the libc-takeover branch 2 times, most recently from cacc739 to 2fbc721 Compare March 5, 2026 14:36
dblnz
dblnz previously approved these changes Mar 10, 2026
Copy link
Copy Markdown
Contributor

@dblnz dblnz left a comment

Choose a reason for hiding this comment

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

Great work, Tomasz!
I have nothing else to add.

Comment thread src/hyperlight_guest_bin/build.rs
Comment thread src/hyperlight_guest_bin/build_files.rs
Comment thread docs/picolibc.md
ludfjig
ludfjig previously approved these changes Mar 23, 2026
Copy link
Copy Markdown
Contributor

@ludfjig ludfjig left a comment

Choose a reason for hiding this comment

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

I think this is awesome!

Comment thread src/hyperlight_guest_bin/build.rs
Comment thread src/hyperlight_guest_bin/build.rs Outdated
Comment thread src/hyperlight_guest_bin/src/libc.rs Outdated
Comment thread src/hyperlight_guest_bin/build.rs
Comment thread Justfile
@andreiltd andreiltd force-pushed the libc-takeover branch 4 times, most recently from dd0725c to 689094b Compare April 20, 2026 13:41
Copy link
Copy Markdown
Contributor

@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

I would like the libc stuff to go in its own crate, like hyperlight-libc.
Just my opinion, and if you agree, it doesn't need to be in this PR either, I'd rather have this in than delaying due to splitting in another crate.

Comment thread src/hyperlight_guest_bin/src/libc.rs Outdated
Comment thread src/hyperlight_guest_bin/src/libc.rs Outdated
Comment thread docs/picolibc.md Outdated
Comment thread src/hyperlight_guest_bin/src/libc.rs
Comment thread src/hyperlight_guest_bin/build.rs
Comment thread src/hyperlight_guest_bin/build.rs
Replace musl C library with picolibc for guest binaries

The picolibc submodule uses the picolibc-bsd
fork (https://github.com/hyperlight-dev/picolibc-bsd), which is a
redistribution with all copyleft-licensed files removed from the tree
and history. Only BSD/MIT/permissive-licensed source files are present.

- Switch libc implementation from musl to picolibc (vendored submodule)
- Use picolibc-bsd fork with copyleft files excluded
- Update build.rs to compile picolibc from source via cc crate
- Add POSIX stubs for picolibc
- Update documentation and NOTICE.txt

Signed-off-by: Tomasz Andrzejak <andreiltd@gmail.com>
Copy link
Copy Markdown
Contributor

@jprendes jprendes left a comment

Choose a reason for hiding this comment

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

LGTM

@jprendes jprendes merged commit cac9f8a into hyperlight-dev:main Apr 21, 2026
40 checks passed
@raftario
Copy link
Copy Markdown

Thank you so much for all the work on this !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement For PRs adding features, improving functionality, docs, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants