-
Notifications
You must be signed in to change notification settings - Fork 134
API change - update examples #52
Comments
I looked at redsift/ingraind dns/main.rs (and it's Cargo.toml) for inspiration. I'm using: [build-dependencies] [features] [[bin]] I also switched to using the preludes. Code looks like this: #![no_std] program!(0xFFFFFFFE, "GPL"); #[xdp] But I still get the same errors. error[E0152]: found duplicate lang item error[E0308]: mismatched types error[E0308]: mismatched types |
Strange. I created the project again in a new dir and the program! macro worked fine. Maybe some rare condition where I switched Cargo.toml to use the git repo and some older cached compiled code was still getting used. I did use a temporary 'u32' as the eBPF function's Result Error type. Some guidance in the docs would be helpful/appreciated for this Error type. It's not entirely obvious to me how this error would be used by the kernel. |
@MarkSwanson if you look at the other issue I've left open, you'll see that @rsdy mentioned the API is in flux right now. I just came back today to ask if it's a bit more stable. I think until documentation is a little better and/or the API is a bit more stable it might be good to let rsdy handle it? I don't know. I want to contribute to the project, but don't want to get in the way if it's a matter of refactoring and I don't understand the library as well as him. Heck, I'd be happy to help keep documentation up to date so the API can be clearly understood. I'd love to get an update and/or hear what @rsdy has to chime in with. |
I'm just playing. I don't mind if @rsdy fluxes :-) the API hourly :-) |
Yeah, don't know if I can tell you too much about the Errors right now as I haven't messed with the library in a couple weeks, but I'll probably start poking around again this week because you're making me all excited about this library again ;) |
I'm going to close this because it compiles fine on a couple of machines. The error must have been a rare issue on my side. |
@MarkSwanson @rtkaratekid check out the release notes at https://github.com/redsift/redbpf/releases/tag/v0.9.13 We are going to slow down with the API changes now, and focus on documentation and iron out any remaining issues with the tooling before releasing 1.0. According to my local runs, examples in the docs should also now be up to date. |
Compiling the sample code found here:
https://ingraind.org/api/cargo_bpf/ (block_http/main.rs)
I get the following errors:
error[E0152]: found duplicate lang item
panic_impl
--> src/test_trace.rs:8:1
|
8 | program!(0xFFFFFFFE, "GPL");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ in this macro invocation
|
= note: the lang item is first defined in crate
std
(whichtest_bpf
depends on)error[E0308]: mismatched types
--> src/test_trace.rs:10:1
|
10 | #[xdp]
| ^^^^^^
| |
| expected enum
redbpf_probes::xdp::XdpAction
, found enumstd::result::Result
| this expression has type
redbpf_probes::xdp::XdpAction
|
= note: expected enum
redbpf_probes::xdp::XdpAction
found enum
std::result::Result<_, _>
error[E0308]: mismatched types
--> src/test_trace.rs:12:12
|
12 | if let Some(transport) = ctx.transport() {
| ^^^^^^^^^^^^^^^ --------------- this expression has type
std::result::Result<redbpf_probes::net::Transport, redbpf_probes::net::NetworkError>
| |
| expected enum
std::result::Result
, found enumstd::option::Option
|
= note: expected enum
std::result::Result<redbpf_probes::net::Transport, redbpf_probes::net::NetworkError>
found enum
std::option::Option<_>
The text was updated successfully, but these errors were encountered: