- Recent linux machine of some kind required for development
Note
I might be able to make this work on Mac if folks are interested and can help test.
- Bash (you very likely have this)
- Docker (install through your package manager
- Cargo / Rust (install via
rustup
) - just (install through your package manager or cargo)
Warning
System privileges required for testing!
This project requires root privileges to run the tests.
This is because the tests require access to raw network interfaces.
You can either run in docker or with sudo
.
sudo
happens by default when you run cargo test
.
git clone git@github.com:githedgehog/dataplane.git
pushd dataplane
In the source directory, run
just refresh-compile-env
You should now have a directory called compile-env
which contains the tools needed to build dpdk-sys
such as clang
and lld
.
You should also have ./compile-env/sysroot
which contains the libraries that dpdk-sys
needs to link against.
Both x86_64-unknown-linux-gnu
and x86_64-unknown-linux-musl
targets are currently supported.
The sysroot is currently built using nix, but you don't need nix to build the project.
The idea is to symlink /nix
to ./compile-env/nix
so that the build scripts can find the libraries they need.
This is a compromise between requiring the developer to understand nix (which can be non-trivial) and requiring the developer to have a bunch of libraries installed on their system.
Warning
This is a hack! It works fine but the plan won't work if you already have /nix. If you already have /nix talk to me, and we will make it work. It should be pretty easy.
just fake-nix
Note
If you move your project directory, you will need to run just fake-nix refake
to update the symlinks.
At this point you should be able to run
cargo build
You should now have statically linked ELF executables in target/x86_64-unknown-linux-gnu/debug/scratch
and target/x86_64-unknown-linux-musl/debug/scratch
.
Additionally, you can run
just build
To run the test suite under glibc
cargo test --target x86_64-unknown-linux-gnu
To run the test suite under musl
cargo test --target x86_64-unknown-linux-musl