Skip to content

Commit

Permalink
[dpdk-rs] Enhancement: set -std=c11 when invoking toolchains
Browse files Browse the repository at this point in the history
starting with dpdk release 23.11 it is a requirement that application
toolchains use a C11 conformant compiler [1].

1. https://doc.dpdk.org/guides/rel_notes/release_23_11.html

Signed-off-by: Tyler Retzlaff <roretzla@microsoft.com>
  • Loading branch information
tylerretzlaff committed Dec 20, 2023
1 parent 104ca1f commit 66457ea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dpdk-rs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ fn os_build() -> Result<()> {
// Step 2: Generate bindings for the DPDK headers.
let bindings: Bindings = Builder::default()
.clang_arg(&format!("-I{}", include_path))
.clang_arg("-std=c11")
.allowlist_recursively(true)
.allowlist_type("rte_mbuf")
.allowlist_type("rte_mempool")
Expand Down Expand Up @@ -161,6 +162,7 @@ fn os_build() -> Result<()> {
// that aren't compiled into the libraries.
let mut builder: Build = cc::Build::new();
builder.opt_level(3);
builder.flag("-std=c11");
builder.flag("-march=native");
builder.file("inlined.c");
builder.include(include_path);
Expand Down Expand Up @@ -298,6 +300,7 @@ fn os_build() -> Result<()> {
.allowlist_function("rte_eth_tx_burst")
.allowlist_function("rte_eth_rx_burst")
.allowlist_function("rte_eal_init")
.clang_arg("-std=c11")
.clang_arg("-mavx")
.header("wrapper.h")
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
Expand All @@ -312,6 +315,7 @@ fn os_build() -> Result<()> {
let mut builder: Build = cc::Build::new();
builder.opt_level(3);
builder.pic(true);
builder.flag("-std=c11");
builder.flag("-march=native");
builder.file("inlined.c");
for header_location in &header_locations {
Expand Down

0 comments on commit 66457ea

Please sign in to comment.