Skip to content

srsRAN crashes on non-AVX-512 CPUs (SIGILL) #22

Description

@AntoineBRU

While running the 5G-MAG MBS tutorials on a laptop with an Intel i7-10510U (supports AVX2 but not AVX-512), the gnb_with_mbs and ue_with_mbs containers crashed immediately at startup with exit code 132 (SIGILL — illegal instruction).

The root cause is that the srsRAN cmake build auto-detects CPU capabilities at build time and generates binaries with AVX-512 instructions, which then fail at runtime on any host that does not support AVX-512.

The fix is straightforward: passing -DCMAKE_CXX_FLAGS="-march=native" to cmake forces the compiler to match the actual capabilities of the CPU running the build.

Problem

When building Docker images on a CPU that supports AVX2 but not AVX-512 (e.g. Intel i7-10510U), the gnb_with_mbs and ue_with_mbs containers crash immediately at startup with exit code 132:

Illegal instruction (core dumped) gnb -c ...

The srsRAN cmake build auto-detects CPU capabilities during compilation and emits AVX-512 instructions. The resulting binaries then fail at runtime on any host that does not support AVX-512. Since Docker images are built on the host CPU but may also be run on different hardware, this affects any deployment where the build host and runtime host differ in ISA support.

Fix

Add -DCMAKE_CXX_FLAGS="-march=native" to the cmake invocation in both srsRAN Dockerfiles. This flag instructs the compiler to generate code matching the actual capabilities of the CPU performing the build, and to avoid generating instructions not supported by that CPU.

images/base-mbs-srsran-project/Dockerfile — before:

RUN cd rt-srsRAN_Project && mkdir build && cd build && cmake ../ -DENABLE_EXPORT=ON \
    -DENABLE_ZEROMQ=ON -DBUILD_TESTS=OFF \
    && make -j `nproc`

After:

RUN cd rt-srsRAN_Project && mkdir build && cd build && cmake ../ -DENABLE_EXPORT=ON \
    -DENABLE_ZEROMQ=ON -DBUILD_TESTS=OFF -DCMAKE_CXX_FLAGS="-march=native" \
    && make -j `nproc`

images/base-mbs-srsran-4g/Dockerfile — before:

RUN cd srsRAN_4G && mkdir build && cd build && cmake ../ -DENABLE_SRSEPC=OFF \
    -DENABLE_SRSENB=OFF -DENABLE_GUI=OFF \
    && make -j `nproc`

After:

RUN cd srsRAN_4G && mkdir build && cd build && cmake ../ -DENABLE_SRSEPC=OFF \
    -DENABLE_SRSENB=OFF -DENABLE_GUI=OFF -DCMAKE_CXX_FLAGS="-march=native" \
    && make -j `nproc`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions