Skip to content

Fix LibAFL no_std errors when compiling for baremetal/embedded targets without libc/unix#3812

Open
YungRaj wants to merge 1 commit intoAFLplusplus:mainfrom
YungRaj:main
Open

Fix LibAFL no_std errors when compiling for baremetal/embedded targets without libc/unix#3812
YungRaj wants to merge 1 commit intoAFLplusplus:mainfrom
YungRaj:main

Conversation

@YungRaj
Copy link
Copy Markdown

@YungRaj YungRaj commented Apr 21, 2026

Fix this error when compiling with no_std for e.g. baremetal and embedded targets

error[E0433]: cannot find module or crate `libc` in this scope
   --> /Users/ilhanraja/.cargo/git/checkouts/libafl-df9415290f13ce43/ee91ab6/crates/libafl_bolts/src/os.rs:109:14
    |
109 |             *libc::__error()
    |              ^^^^ use of unresolved module or unlinked crate `libc`
    |
    = help: if you wanted to use a crate named `libc`, use `cargo add libc` to add it to your `Cargo.toml`

For more information about this error, try `rustc --explain E0433`.
error: could not compile `libafl_bolts` (lib) due to 1 previous error

@domenukk
Copy link
Copy Markdown
Member

This is already:

#[cfg(all(
    not(feature = "std"),
    any(
        target_os = "linux",
        target_os = "android",
        target_os = "macos",
        target_os = "freebsd",
        target_os = "dragonfly",
        target_os = "openbsd",
        target_os = "netbsd"
    )
))]

are you using macos for kernel?

@YungRaj
Copy link
Copy Markdown
Author

YungRaj commented Apr 22, 2026

This is already:

#[cfg(all(
    not(feature = "std"),
    any(
        target_os = "linux",
        target_os = "android",
        target_os = "macos",
        target_os = "freebsd",
        target_os = "dragonfly",
        target_os = "openbsd",
        target_os = "netbsd"
    )
))]

are you using macos for kernel?

Yes I am using macOS for kernel so that the target triple when compiling is correct.

@YungRaj
Copy link
Copy Markdown
Author

YungRaj commented Apr 29, 2026

Looks like the recent changes worked.

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