nrf connect sdk build use wrong compiler

i try to build simple hello world program in c++. it successfully compile just yesterday, but somehow it fail to compile now. on the log it seem to use /usr/bin/c++ to compile. is it suppose to use that? here is the log file.

> Executing task: nRF Connect: Build: semudah-nrf-firmware/build (active) <

Building semudah-nrf-firmware
west build --build-dir /workspaces/semudah-nrf-firmware/build /workspaces/semudah-nrf-firmware

[1/155] Building CXX object CMakeFiles/app.dir/src/main.cpp.o
FAILED: CMakeFiles/app.dir/src/main.cpp.o 
/usr/bin/c++ -DKERNEL -DNRF52832_XXAA -DUSE_PARTITION_MANAGER=0 -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR__=1 -I/workspaces/semudah-nrf-firmware/src/Example -I/workdir/tmp/zephyr/include/zephyr -I/workdir/tmp/zephyr/include -I/workspaces/semudah-nrf-firmware/build/zephyr/include/generated -I/workdir/tmp/zephyr/soc/arm/nordic_nrf/nrf52 -I/workdir/tmp/zephyr/soc/arm/nordic_nrf/common/. -I/workdir/tmp/nrf/include -I/workdir/tmp/modules/hal/cmsis/CMSIS/Core/Include -I/workdir/tmp/modules/hal/nordic/nrfx -I/workdir/tmp/modules/hal/nordic/nrfx/drivers/include -I/workdir/tmp/modules/hal/nordic/nrfx/mdk -I/workdir/tmp/zephyr/modules/hal_nordic/nrfx/. -I/workdir/tmp/modules/debug/segger/SEGGER -I/workdir/tmp/modules/debug/segger/Config -I/workdir/tmp/zephyr/modules/segger/. -isystem /workdir/tmp/zephyr/lib/libc/minimal/include -isystem /workdir/tmp/zephyr/subsys/cpp/include -isystem /workdir/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/include -isystem /workdir/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/include-fixed -Os -fcheck-new -std=c++11 -Wno-register -fno-exceptions -fno-rtti -imacros /workspaces/semudah-nrf-firmware/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -imacros /workdir/tmp/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/workspaces/semudah-nrf-firmware=CMAKE_SOURCE_DIR -fmacro-prefix-map=/workdir/tmp/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/workdir/tmp=WEST_TOPDIR -ffunction-sections -fdata-sections -nostdinc -nostdinc++ -MD -MT CMakeFiles/app.dir/src/main.cpp.o -MF CMakeFiles/app.dir/src/main.cpp.o.d -o CMakeFiles/app.dir/src/main.cpp.o -c /workspaces/semudah-nrf-firmware/src/main.cpp
c++: warning: ‘-mcpu=’ is deprecated; use ‘-mtune=’ or ‘-march=’ instead
c++: error: unrecognized argument in option ‘-mabi=aapcs’
c++: note: valid arguments to ‘-mabi=’ are: ms sysv
c++: error: unrecognized command line option ‘-mthumb’
c++: error: unrecognized command line option ‘-mfp16-format=ieee’
[2/155] Building CXX object CMakeFiles/app.dir/src/Example/Example.cpp.o
FAILED: CMakeFiles/app.dir/src/Example/Example.cpp.o 
/usr/bin/c++ -DKERNEL -DNRF52832_XXAA -DUSE_PARTITION_MANAGER=0 -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR__=1 -I/workspaces/semudah-nrf-firmware/src/Example -I/workdir/tmp/zephyr/include/zephyr -I/workdir/tmp/zephyr/include -I/workspaces/semudah-nrf-firmware/build/zephyr/include/generated -I/workdir/tmp/zephyr/soc/arm/nordic_nrf/nrf52 -I/workdir/tmp/zephyr/soc/arm/nordic_nrf/common/. -I/workdir/tmp/nrf/include -I/workdir/tmp/modules/hal/cmsis/CMSIS/Core/Include -I/workdir/tmp/modules/hal/nordic/nrfx -I/workdir/tmp/modules/hal/nordic/nrfx/drivers/include -I/workdir/tmp/modules/hal/nordic/nrfx/mdk -I/workdir/tmp/zephyr/modules/hal_nordic/nrfx/. -I/workdir/tmp/modules/debug/segger/SEGGER -I/workdir/tmp/modules/debug/segger/Config -I/workdir/tmp/zephyr/modules/segger/. -isystem /workdir/tmp/zephyr/lib/libc/minimal/include -isystem /workdir/tmp/zephyr/subsys/cpp/include -isystem /workdir/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/include -isystem /workdir/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/10.3.0/include-fixed -Os -fcheck-new -std=c++11 -Wno-register -fno-exceptions -fno-rtti -imacros /workspaces/semudah-nrf-firmware/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -imacros /workdir/tmp/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/workspaces/semudah-nrf-firmware=CMAKE_SOURCE_DIR -fmacro-prefix-map=/workdir/tmp/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/workdir/tmp=WEST_TOPDIR -ffunction-sections -fdata-sections -nostdinc -nostdinc++ -MD -MT CMakeFiles/app.dir/src/Example/Example.cpp.o -MF CMakeFiles/app.dir/src/Example/Example.cpp.o.d -o CMakeFiles/app.dir/src/Example/Example.cpp.o -c /workspaces/semudah-nrf-firmware/src/Example/Example.cpp
c++: warning: ‘-mcpu=’ is deprecated; use ‘-mtune=’ or ‘-march=’ instead
c++: error: unrecognized argument in option ‘-mabi=aapcs’
c++: note: valid arguments to ‘-mabi=’ are: ms sysv
c++: error: unrecognized command line option ‘-mthumb’
c++: error: unrecognized command line option ‘-mfp16-format=ieee’
[3/155] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/hex.c.o
[4/155] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/thread_entry.c.o
[5/155] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/notify.c.o
[6/155] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/printk.c.o
[7/155] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/sem.c.o
[8/155] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.o
[9/155] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/onoff.c.o
[10/155] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/rb.c.o
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/local/bin/cmake --build /workspaces/semudah-nrf-firmware/build
The terminal process terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

for my environment. i use vscode dev container. and use this docker file which modified from https://github.com/NordicPlayground/nrf-docker

FROM ubuntu:20.04 as base
WORKDIR /workdir

ARG arch=amd64

# System dependencies
RUN mkdir /workdir/project && \
    mkdir /workdir/.cache && \
    apt-get -y update && \
    apt-get -y upgrade && \
    apt-get -y install \
        wget \
        python3-pip \
        ninja-build \
        gperf \
        git \
        unzip \
        python3-setuptools \
        libncurses5 libncurses5-dev \
        libyaml-dev libfdt1 \
        libusb-1.0-0-dev udev \
        device-tree-compiler=1.5.1-1 \
        ruby && \
    apt-get -y clean && apt-get -y autoremove && \
    #
    # Latest PIP & Python dependencies
    #
    python3 -m pip install -U pip && \
    python3 -m pip install -U setuptools && \
    python3 -m pip install cmake>=3.20.0 wheel && \
    python3 -m pip install -U west==0.12.0 && \
    python3 -m pip install -U nrfutil && \
    # Downgrade protobuf manually until nrfutil's fix is released: https://github.com/NordicSemiconductor/pc-nrfutil/commit/c03b0dca945f38d8095dc71894b81dfbfd1dca7f
    python3 -m pip install -U 'protobuf<4.0.0' && \
    python3 -m pip install pc_ble_driver_py && \
    # Newer PIP will not overwrite distutils, so upgrade PyYAML manually
    python3 -m pip install --ignore-installed -U PyYAML && \
    #
    # ClangFormat
    #
    python3 -m pip install -U six && \
    apt-get -y install clang-format-9 && \
    ln -s /usr/bin/clang-format-9 /usr/bin/clang-format && \
    wget -qO- https://raw.githubusercontent.com/nrfconnect/sdk-nrf/main/.clang-format > /workdir/.clang-format && \
    #
    # Nordic command line tools
    #
    echo "Target architecture: $arch" && \
    case $arch in \
        "amd64") \
            NCLT_URL="https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-command-line-tools/sw/Versions-10-x-x/10-16-0/nrf-command-line-tools-10.16.0_Linux-amd64.tar.gz" \
            ;; \
        "arm64") \
            NCLT_URL="https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-command-line-tools/sw/Versions-10-x-x/10-16-0/nrf-command-line-tools-10.16.0_Linux-arm64.tar.gz" \
            ;; \
    esac && \
    # Releases: https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools/Download
    if [ ! -z "$NCLT_URL" ]; then \
        mkdir tmp && cd tmp && \
        wget -qO - "${NCLT_URL}" | tar xz && \
        DEBIAN_FRONTEND=noninteractive apt-get -y install ./*.deb && \
        cd .. && rm -rf tmp ; \
    else \
        echo "Skipping nRF Command Line Tools (not available for $arch)" ; \
    fi && \
    #
    # Zephyr Toolchain
    #
    echo "Target architecture: $arch" && \
    case $arch in \
        "amd64") \
            ZEPHYR_TOOLCHAIN_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.14.2/zephyr-sdk-0.14.2_linux-x86_64.tar.gz" \
            ;; \
        "arm64") \
            ZEPHYR_TOOLCHAIN_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.14.2/zephyr-sdk-0.14.2_linux-aarch64.tar.gz" \
            ;; \
        *) \
            echo "Unsupported target architecture: \"$arch\"" >&2 && \
            exit 1 ;; \
    esac && \
    wget -qO - "${ZEPHYR_TOOLCHAIN_URL}" | tar xz && \
    mv /workdir/zephyr-sdk-0.14.2 /workdir/zephyr-sdk && cd /workdir/zephyr-sdk && yes | ./setup.sh

# Download sdk-nrf and west dependencies to install pip requirements
FROM base
ARG sdk_nrf_revision=main
RUN \
    mkdir tmp && cd tmp && \
    west init -m https://github.com/nrfconnect/sdk-nrf --mr ${sdk_nrf_revision} && \
    west update --narrow -o=--depth=1 && \
    python3 -m pip install -r zephyr/scripts/requirements.txt && \
    python3 -m pip install -r nrf/scripts/requirements.txt && \
    python3 -m pip install -r bootloader/mcuboot/scripts/requirements.txt && \
    cd ..

COPY JLink_Linux_V766e_x86_64.deb JLink_Linux_V766e_x86_64.deb
RUN dpkg -i JLink_Linux_V766e_x86_64.deb

COPY nrf-command-line-tools_10.16.0_amd64.deb nrf-command-line-tools_10.16.0_amd64.deb
run dpkg -i nrf-command-line-tools_10.16.0_amd64.deb

run \
    apt-get install libgtest-dev -y && \
    cd /usr/src/gtest && \
    cmake CMakeLists.txt && \
    make && \
    cd lib && \
    cp *.a /usr/lib

WORKDIR /workdir/project
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV XDG_CACHE_HOME=/workdir/.cache
ENV ZEPHYR_TOOLCHAIN_VARIANT=zephyr
ENV ZEPHYR_SDK_INSTALL_DIR=/workdir/zephyr-sdk
ENV ZEPHYR_BASE=/workdir/project/zephyr
ENV PATH="${ZEPHYR_BASE}/scripts:${ZEPHYR_SDK_INSTALL_DIR}:${ZEPHYR_SDK_INSTALL_DIR}/arm-zephyr-eabi/bin:${PATH}"

Related