microsoft / microsoft/demikernel
demikernel-dpdk-bindings build.rs uses x86-only -mavx flag unconditionally, breaks build on AArch64
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.2k
- Forks
- 151
- PR merge metrics
- No merged PRs in 30d
Description
Description
When building demikernel-dpdk-bindings on AArch64, the build script fails because it unconditionally adds the x86-only compiler flag -mavx. Clang rejects this flag on non-x86 architectures.
How to Reproduce
-
export PKG_CONFIG_PATH=${DPDK_PREFIX}/lib/aarch64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$DPDK_PREFIX/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH
export CFLAGS="-I$DPDK_PREFIX/include"
export LIBDPDK_PATH="$DPDK_PREFIX"
export CC="$(which clang)" # demikernel often builds bindings fine with clang
export INSTALL_PREFIX=/data/work/install/demikernel
make LIBOS=catnip PKG_CONFIG_PATH=$DPDK_PREFIX/lib/aarch64-linux-gnu/pkgconfig RUST_BACKTRACE=1 -
Results in the following output:
mkdir -p /data/work/demikernel/lib git config --local core.hooksPath .githooks LD_LIBRARY_PATH: /data/work/install/dpdk/lib/aarch64-linux-gnu:/data/work/install/dpdk/lib/aarch64-linux-gnu: PKG_CONFIG_PATH: /data/work/install/dpdk/lib/aarch64-linux-gnu/pkgconfig /home/supratim/.cargo/bin/cargo build --lib --features=catnip-libos --no-default-features --features=mlx4 --profile release
...
error: failed to run custom build command fordemikernel-dpdk-bindings v1.1.8
Caused by: process didn't exit successfully:/data/work/demikernel/target/release/build/demikernel-dpdk-bindings-f5a218369eb03f72/build-script-build (exit status: 101) -
Also, see this error message :
error: unsupported option '-mavx' for target 'aarch64-unknown-linux-gnu' thread 'main' panicked at .../demikernel-dpdk-bindings-1.1.8/build.rs:314:29: Failed to generate bindings
Expected Behavior
-mavx and other ISA-specific flags should only be added when:
CARGO_CFG_TARGET_ARCH == "x86_64"
Suggested Fix
change in build.rs :
let arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
if arch == "x86_64" {
cc.flag("-mavx");
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in demikernel-dpdk-bindings/build.rs around the binding-generation failure reported at line 314, and inspect where -mavx and other ISA-specific flags are added. Reproduce the AArch64 build with the listed environment and make command, then verify the build completes without unsupported x86 flags.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100