-
Notifications
You must be signed in to change notification settings - Fork 140
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");
}