Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error when targeting Android #433

Closed
black-binary opened this issue Mar 12, 2021 · 0 comments · Fixed by #435
Closed

Compile error when targeting Android #433

black-binary opened this issue Mar 12, 2021 · 0 comments · Fixed by #435
Labels

Comments

@black-binary
Copy link

When compiling with the target aarch64-android-linux, the bfp module will be enabled.

#[cfg(all(feature = "phy-raw_socket", not(target_os = "linux"), unix))]
pub mod bpf;

And result in a compile error, because the constants below are missing.

/// set interface
#[cfg(any(target_os = "macos", target_os = "openbsd"))]
const BIOCSETIF: libc::c_ulong = 0x8020426c;
/// get buffer length
#[cfg(any(target_os = "macos", target_os = "openbsd"))]
const BIOCGBLEN: libc::c_ulong = 0x40044266;
/// set immediate/nonblocking read
#[cfg(any(target_os = "macos", target_os = "openbsd"))]
const BIOCIMMEDIATE: libc::c_ulong = 0x80044270;
/// set bpf_hdr struct size
#[cfg(target_os = "macos")]
const SIZEOF_BPF_HDR: usize = 18;
/// set bpf_hdr struct size
#[cfg(target_os = "openbsd")]
const SIZEOF_BPF_HDR: usize = 24;

I don't need the phy module in my project, in fact. So my workaround is to remove these constants and the code. And I'm not sure how to fix this. As far as I know, Android is based on Linux, so the code of the raw socket in Linux should work in Android.

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

Successfully merging a pull request may close this issue.

2 participants