Skip to content

Conversation

@daniel-noland
Copy link
Collaborator

@daniel-noland daniel-noland commented Dec 19, 2025

Note

(wait for #1142 to merge)

DPDK wrapper and compile-env

This PR is part 2 of my effort to absorb needed functions from dpdk-sys into dataplane using a native nix build system rather than the (very hacky) fake-nix method.

This PR has two main goals:

  1. to build out an extensible and (reasonably) user friendly system for expressing the flags and target architecture you wish to compile with / against.
  2. to build the dpdk_wrapper.a static library needed to bind rust to DPDK.

Reviewers of this PR should be able to successfully run all of the following commands on any reasonably modern Linux system with nix installed.

nix build -f default.nix pkgs.dpdk-wrapper --extra-experimental-features nix-command

nix build -f default.nix --argstr prof debug pkgs.dpdk-wrapper --extra-experimental-features nix-command 
nix build -f default.nix --argstr prof release pkgs.dpdk-wrapper --extra-experimental-features nix-command
 
nix build -f default.nix --argstr target x86_64-unknown-linux-gnu pkgs.dpdk-wrapper --extra-experimental-features nix-command 
nix build -f default.nix --argstr target x86_64-unknown-linux-musl pkgs.dpdk-wrapper --extra-experimental-features nix-command 
nix build -f default.nix --argstr target aarch64-unknown-linux-gnu pkgs.dpdk-wrapper --extra-experimental-features nix-command 
nix build -f default.nix --argstr target aarch64-unknown-linux-musl pkgs.dpdk-wrapper --extra-experimental-features nix-command

nix build -f default.nix --argstr prof debug --argstr target x86_64-unknown-linux-gnu pkgs.dpdk-wrapper --extra-experimental-features nix-command 
nix build -f default.nix --argstr prof debug --argstr target x86_64-unknown-linux-musl pkgs.dpdk-wrapper --extra-experimental-features nix-command 
nix build -f default.nix --argstr prof release --argstr target x86_64-unknown-linux-gnu pkgs.dpdk-wrapper --extra-experimental-features nix-command 
nix build -f default.nix --argstr prof release --argstr target x86_64-unknown-linux-musl pkgs.dpdk-wrapper --extra-experimental-features nix-command 
nix build -f default.nix --argstr prof debug --argstr target aarch64-unknown-linux-gnu pkgs.dpdk-wrapper --extra-experimental-features nix-command 
nix build -f default.nix --argstr prof debug --argstr target aarch64-unknown-linux-musl pkgs.dpdk-wrapper --extra-experimental-features nix-command 
nix build -f default.nix --argstr prof release --argstr target aarch64-unknown-linux-gnu pkgs.dpdk-wrapper --extra-experimental-features nix-command 
nix build -f default.nix --argstr prof release --argstr target aarch64-unknown-linux-musl pkgs.dpdk-wrapper --extra-experimental-features nix-command 

@daniel-noland daniel-noland added this to the GW R3 milestone Dec 19, 2025
@daniel-noland daniel-noland self-assigned this Dec 19, 2025
@daniel-noland daniel-noland added dont-merge Do not merge this Pull Request dependencies Pull requests that update a dependency file enhancement New feature or request design related to high level design labels Dec 19, 2025
@daniel-noland daniel-noland changed the title dpdk sys take 2 phase 2 nix build system part 2 Dec 19, 2025
@daniel-noland daniel-noland linked an issue Dec 19, 2025 that may be closed by this pull request
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
I put the profiles at the top level to start, but in retrospect there is little reason to put them there. It just makes
the top level directory listing more noisy and spreads the nix code around.

Signed-off-by: Daniel Noland <daniel@githedgehog.com>
These flags will be used in a follow up commit to build the x86_64 rust wrapper to dpdk.

Signed-off-by: Daniel Noland <daniel@githedgehog.com>
These flags are empty for the moment, but may be needed in the future. They are included mostly for symmetry with the
x86_64 build.

Signed-off-by: Daniel Noland <daniel@githedgehog.com>
These are collections of commonly used C/CXX/LDFLAGS which can be
recycled across other profiles. They will be connected to the build
in a future commit.

Signed-off-by: Daniel Noland <daniel@githedgehog.com>
This commit builds on prior work to introduce a functioning cross compile infrastructure for the dataplane, complete
C/CXX/LDFLAGS calculated based on the user supplied target and profile.

As of this commit, you should be able to compile dpdk with any combination of debug / release profiles, x86_64 / aarch64
processors, and gnu / musl libc.

All of the following commands should work and should continue to work unless stated otherwise.

```
nix-build -f default.nix pkgs.dpdk
nix-build -f default.nix --argstr prof 'debug' pkgs.dpdk
nix-build -f default.nix --argstr prof 'release' pkgs.dpdk
nix-build -f default.nix --argstr target 'x86_64-unknown-linux-gnu' pkgs.dpdk
nix-build -f default.nix --argstr target 'x86_64-unknown-linux-musl' pkgs.dpdk
nix-build -f default.nix --argstr target 'aarch64-unknown-linux-gnu' pkgs.dpdk
nix-build -f default.nix --argstr target 'aarch64-unknown-linux-musl' pkgs.dpdk
nix-build -f default.nix --argstr prof 'debug' --argstr target x86_64-unknown-linux-gnu pkgs.dpdk
nix-build -f default.nix --argstr prof 'debug' --argstr target x86_64-unknown-linux-musl pkgs.dpdk
nix-build -f default.nix --argstr prof 'release' --argstr target x86_64-unknown-linux-gnu pkgs.dpdk
nix-build -f default.nix --argstr prof 'release' --argstr target x86_64-unknown-linux-musl pkgs.dpdk
nix-build -f default.nix --argstr prof 'debug' --argstr target aarch64-unknown-linux-gnu pkgs.dpdk
nix-build -f default.nix --argstr prof 'debug' --argstr target aarch64-unknown-linux-musl pkgs.dpdk
nix-build -f default.nix --argstr prof 'release' --argstr target aarch64-unknown-linux-gnu pkgs.dpdk
nix-build -f default.nix --argstr prof 'release' --argstr target aarch64-unknown-linux-musl pkgs.dpdk
```

Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
Signed-off-by: Daniel Noland <daniel@githedgehog.com>
@daniel-noland daniel-noland force-pushed the pr/daniel-noland/dpdk-sys-take-2-phase-2 branch from 99deb22 to 1ff5324 Compare December 22, 2025 01:26
@daniel-noland daniel-noland force-pushed the pr/daniel-noland/dpdk-sys-take-2-phase-2 branch from ff4fdb8 to 4a5df4f Compare December 23, 2025 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file design related to high level design dont-merge Do not merge this Pull Request enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rework feral build system

2 participants