You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'm trying to develop a virtio vsock driver for FreeBSD and was looking for ways to test it when coming across this project.
unfortunately, i have no idea how to compile it.
Here's a fresh nightly installed via https://rustup.rs:
cargo build --lib
meena@defbix ~/s/vsock-rs ❯❯❯ cargo build --lib
Updating crates.io index
Downloaded bitflags v1.3.2
Downloaded cfg-if v1.0.0
Downloaded memoffset v0.6.5
Downloaded autocfg v1.1.0
Downloaded nix v0.24.3
Downloaded libc v0.2.147
Downloaded 6 crates (1005.5 KB) in 1.24s
Compiling autocfg v1.1.0
Compiling libc v0.2.147
Compiling bitflags v1.3.2
Compiling cfg-if v1.0.0
error[E0463]: can't find crate for `core`
|
= note: the `x86_64-unknown-linux-musl` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-unknown-linux-musl`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
error[E0463]: can't find crate for `compiler_builtins`
error[E0463]: can't find crate for `core`
--> /home/meena/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bitflags-1.3.2/src/lib.rs:282:1
|
282 | pub extern crate core as _core;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
|
= note: the `x86_64-unknown-linux-musl` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-unknown-linux-musl`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `bitflags` (lib) due to 3 previous errors
meena@defbix ~/s/vsock-rs ❯❯❯
that seems odd, but after adding -Zbuild-std as suggested, the library compiles.
on to the echo server:
meena@defbix ~/s/vsock-rs ❯❯❯ cargo build --manifest-path=echo_server/Cargo.toml
Compiling libc v0.2.147
Compiling bitflags v1.3.2
Compiling memoffset v0.6.5
Compiling cfg-if v1.0.0
Compiling unicode-width v0.1.10
Compiling strsim v0.8.0
Compiling ansi_term v0.12.1
Compiling vec_map v0.8.2
error[E0463]: can't find crate for `core`
|
= note: the `x86_64-unknown-linux-musl` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-unknown-linux-musl`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
error[E0463]: can't find crate for `compiler_builtins`
error: requires `sized` lang_item
For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
|
= note: the `x86_64-unknown-linux-musl` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-unknown-linux-musl`
= help: consider building the standard library from source with `cargo build -Zbuild-std`
error: cannot find macro `vec` in this scope
--> /home/meena/.cargo/registry/src/index.crates.io-6f17d22bba15001f/strsim-0.8.0/src/lib.rs:266:25
|
266 | let mut distances = vec![vec![0; b_len + 2]; a_len + 2];
| ^^^
same thing.
Weird. We just built core and std, didn't we?
well, this is all very nonsensical. Let's set the target explicitly:
meena@defbix ~/s/vsock-rs ❯❯❯ cargo build --target x86_64-unknown-freebsd --lib -Zbuild-std master
Updating crates.io index
Downloaded autocfg v1.1.0
Downloaded memoffset v0.6.5
Downloaded cfg-if v1.0.0
Downloaded bitflags v1.3.2
Downloaded nix v0.24.3
Downloaded libc v0.2.147
Downloaded 6 crates (1005.5 KB) in 1.09s
Updating crates.io index
Downloaded adler v1.0.2
Downloaded miniz_oxide v0.7.1
Downloaded unicode-width v0.1.10
Downloaded getopts v0.2.21
Downloaded rustc-demangle v0.1.23
Downloaded allocator-api2 v0.2.15
Downloaded addr2line v0.20.0
Downloaded cc v1.0.79
Downloaded memchr v2.5.0
Downloaded hashbrown v0.14.0
Downloaded compiler_builtins v0.1.98
Downloaded gimli v0.27.3
Downloaded object v0.31.1
Downloaded 13 crates (1.2 MB) in 1.20s
Compiling compiler_builtins v0.1.98
Compiling core v0.0.0 (/home/meena/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/core)
Compiling libc v0.2.147
Compiling cc v1.0.79
Compiling memchr v2.5.0
Compiling std v0.0.0 (/home/meena/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/std)
Compiling autocfg v1.1.0
Compiling memoffset v0.6.5
Compiling unwind v0.0.0 (/home/meena/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/unwind)
Compiling rustc-std-workspace-core v1.99.0 (/home/meena/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/rustc-std-workspace-core)
Compiling alloc v0.0.0 (/home/meena/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/alloc)
Compiling cfg-if v1.0.0
Compiling adler v1.0.2
Compiling rustc-demangle v0.1.23
Compiling rustc-std-workspace-alloc v1.99.0 (/home/meena/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/rustc-std-workspace-alloc)
Compiling panic_abort v0.0.0 (/home/meena/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/panic_abort)
Compiling panic_unwind v0.0.0 (/home/meena/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/panic_unwind)
Compiling gimli v0.27.3
Compiling hashbrown v0.14.0
Compiling miniz_oxide v0.7.1
Compiling std_detect v0.1.5 (/home/meena/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/stdarch/crates/std_detect)
Compiling object v0.31.1
Compiling addr2line v0.20.0
Compiling proc_macro v0.0.0 (/home/meena/.rustup/toolchains/nightly-x86_64-unknown-freebsd/lib/rustlib/src/rust/library/proc_macro)
Compiling bitflags v1.3.2
Compiling nix v0.24.3
Compiling vsock v0.3.0 (/home/meena/src/vsock-rs)
error[E0432]: unresolved imports `libc::sockaddr_vm`, `libc::AF_VSOCK`
--> src/lib.rs:21:44
|
21 | accept4, ioctl, sa_family_t, sockaddr, sockaddr_vm, socklen_t, suseconds_t, timeval, AF_VSOCK,
| ^^^^^^^^^^^ ^^^^^^^^ no `AF_VSOCK` in the root
| |
| no `sockaddr_vm` in the root
| help: a similar name exists in the module: `sockaddr_un`
error[E0432]: unresolved imports `libc::VMADDR_CID_ANY`, `libc::VMADDR_CID_HOST`, `libc::VMADDR_CID_HYPERVISOR`, `libc::VMADDR_CID_LOCAL`
--> src/lib.rs:40:16
|
40 | pub use libc::{VMADDR_CID_ANY, VMADDR_CID_HOST, VMADDR_CID_HYPERVISOR, VMADDR_CID_LOCAL};
| ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ no `VMADDR_CID_LOCAL` in the root
| | | |
| | | no `VMADDR_CID_HYPERVISOR` in the root
| | no `VMADDR_CID_HOST` in the root
| no `VMADDR_CID_ANY` in the root
error[E0432]: unresolved import `nix::sys::socket::VsockAddr`
--> src/lib.rs:41:42
|
41 | pub use nix::sys::socket::{SockaddrLike, VsockAddr};
| ^^^^^^^^^
| |
| no `VsockAddr` in `sys::socket`
| help: a similar name exists in the module: `SockAddr`
|
note: found an item that was configured out
--> /home/meena/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.24.3/src/sys/socket/mod.rs:79:42
|
79 | pub use crate::sys::socket::addr::vsock::VsockAddr;
| ^^^^^^^^^
error[E0599]: no variant or associated item named `Vsock` found for enum `AddressFamily` in the current scope
--> src/lib.rs:45:24
|
45 | AddressFamily::Vsock,
| ^^^^^ variant or associated item not found in `AddressFamily`
error[E0599]: no variant or associated item named `Vsock` found for enum `AddressFamily` in the current scope
--> src/lib.rs:75:49
|
75 | if addr.family() != Some(AddressFamily::Vsock) {
| ^^^^^ variant or associated item not found in `AddressFamily`
error[E0599]: no variant or associated item named `Vsock` found for enum `AddressFamily` in the current scope
--> src/lib.rs:196:49
|
196 | if addr.family() != Some(AddressFamily::Vsock) {
| ^^^^^ variant or associated item not found in `AddressFamily`
Some errors have detailed explanations: E0432, E0599.
For more information about an error, try `rustc --explain E0432`.
error: could not compile `vsock` (lib) due to 6 previous errors
warning: build failed, waiting for other jobs to finish...
meena@defbix ~/s/vsock-rs ❯❯❯
finally, we're getting somewhere!
my /usr/include/sys/sockets.h contains AF_VSOCK:
but does, indeed, not contain any of the other things constants… VMADDR_CID_ANY, VMADDR_CID_HOST, VMADDR_CID_HYPERVISOR, VMADDR_CID_LOCAL. The only one of those i can be sure of, according to the spec is VMADDR_CID_HOST.
Ignoring the breakage with cargo defaulting to x86_64-unknown-linux-musl on FreeBSD… how do I get started with making this crate compile on FreeBSD?
The text was updated successfully, but these errors were encountered:
I suspect you're the first person to try using this crate on anything other than Linux.
The unresolved imports errors you're getting are probably due to the libc and nix crates lacking the appropriate definitions on FreeBSD. These are added manually, not generated from the C header files, so you'll need to send them PRs to add the missing items. From my experience adding Android stuff there the maintainers are generally fairly responsive and helpful.
I'm not sure how much FreeBSD differs from Linux here, but I'd hope that once the dependencies are into libc and nix then getting this crate working on FreeBSD should be fairly straightforward.
thanks for the quick response!
i looked at nix at least and it looks quite easy to adapt. way easier to adapt than go's unix module…
I'm still at very much the start of this project, and i have never done any Kernel module development from scratch, let alone one as complex as a driver that's also a socket API.
Great start to break into a new field :D
I hope that soon I'll have more to go on.
thank you very much.
Hi Folks,
i'm trying to develop a virtio vsock driver for FreeBSD and was looking for ways to test it when coming across this project.
unfortunately, i have no idea how to compile it.
Here's a fresh nightly installed via https://rustup.rs:
that seems odd, but after adding
-Zbuild-std
as suggested, the library compiles.on to the echo server:
same thing.
Weird. We just built core and std, didn't we?
Let's add the same fix and see if that helps.
cargo build -Zbuild-std --manifest-path=echo_server/Cargo.toml
well, this is all very nonsensical. Let's set the target explicitly:
finally, we're getting somewhere!
my
/usr/include/sys/sockets.h
containsAF_VSOCK
:but does, indeed, not contain any of the other things constants…
VMADDR_CID_ANY
,VMADDR_CID_HOST
,VMADDR_CID_HYPERVISOR
,VMADDR_CID_LOCAL
. The only one of those i can be sure of, according to the spec isVMADDR_CID_HOST
.Ignoring the breakage with
cargo
defaulting tox86_64-unknown-linux-musl
on FreeBSD… how do I get started with making this crate compile on FreeBSD?The text was updated successfully, but these errors were encountered: