microsoft / microsoft/demikernel

demikernel-dpdk-bindings build.rs uses x86-only -mavx flag unconditionally, breaks build on AArch64

Open Beginner friendly
#1,631 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

  1. 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

  2. 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 for demikernel-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)

  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.