Sudden Build Errors in Visual Studio Code

Hello,

Up until today I had been developing fine with visual studio code, installed via Toolchain Manager. Then, I clicked "Pristine Build" for the first time in a few days. All of a sudden the build failed and now nothing requiring MCUboot will build properly. 

The error I'm seeing is this, when the build gets to the stage of building McuBoot:

/opt/nordic/ncs/v1.8.0/zephyr/scripts/kconfig/kconfig.py: /opt/nordic/ncs/v1.8.0/bootloader/mcuboot/boot/zephyr/Kconfig:11: '/modules/mcuboot/boot/zephyr/Kconfig' not found (in 'source "$(ZEPHYR_NRF_MODULE_DIR)/modules/mcuboot/boot/zephyr/Kconfig"'). Check that environment variables are set correctly (e.g. $srctree, which is set to '/opt/nordic/ncs/v1.8.0/zephyr'). Also note that unset environment variables expand to the empty string.

 

I've tried: 

Uninstalling and re-installing nRF Connect SDK v1.8.0 from the Toolchain manager

Uninstalling and reinstalling Visual Studio code, and then all of its required plugins via Toolchain Manager.

Building a default project that utilizes Mcuboot, that build also fails in the same way that mine does.

An additional thing of note is that when I click "Open VS Code" from within toolchain manager, it will never actually open VS Code. If code isn't installed or is missing plugins, then it will suggest I install them, but then it will just sit on the "Checking iv VS Code and dependencies are installed" screen indefinitely, never doing anything after that.

I am on an M1 Mac, and I am using all Intel versions of software, as suggested. 

Again, everything was working fine yesterday. I have no idea what could have caused this. I hope you guys will have some ideas!

Thanks

  • Hi Griffin,

    I completely understand your eagerness to find the root cause of the problem and I am willing to help.

    Could you please try the following
    Open Toolchain Manager and open command prompt.
    1. Try building application which contains MCUboot, such as asset tracker v2. Does it succeed? Are there any errors?
    2. Try building the same application using VS Code. Does it succeed? Are there any errors?

    Best regards,
    Dejan

  • Hi Dejans,

    Has anyone at Nordic taken a Mac with M1 and tried to build the ble_dfu_peripheral_lbs sample as I described in my repro sequence from last Friday? I would think doing so would short cut all this back and forth.

    To keep this moving forward, I just attempted the instructions you gave for Griffin.

    I created the asset_tracker_v2 application from sample. (As a freestanding app.) It failed to configure, and after a pristine build, here is the error log.

    =================================================================== begin error log

    > Executing task: nRF Connect: Generate config nrf52840dk_nrf52840 for /Users/Steve/Projects/asset_tracker_v2 <

    Building asset_tracker_v2
    west build --build-dir /Users/Steve/Projects/asset_tracker_v2/build /Users/Steve/Projects/asset_tracker_v2 --pristine --board nrf52840dk_nrf52840 -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DBOARD_ROOT:STRING="/Users/Steve/Projects/asset_tracker_v2"

    -- west build: generating a build system
    Including boilerplate (Zephyr base): /opt/nordic/ncs/v1.9.1/zephyr/cmake/app/boilerplate.cmake
    -- Application: /Users/Steve/Projects/asset_tracker_v2
    -- Zephyr version: 2.7.99 (/opt/nordic/ncs/v1.9.1/zephyr), build: v2.7.99-ncs1-1
    -- Found Python3: /opt/nordic/ncs/v1.9.1/toolchain/opt/[email protected]/bin/python3.9 (found suitable exact version "3.9.6") found components: Interpreter
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: /Users/Steve/Library/Caches/zephyr
    -- Found dtc: /opt/nordic/ncs/v1.9.1/toolchain/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/opt/nordic/ncs/v1.9.1/toolchain)
    -- Found BOARD.dts: /opt/nordic/ncs/v1.9.1/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Generated zephyr.dts: /Users/Steve/Projects/asset_tracker_v2/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /Users/Steve/Projects/asset_tracker_v2/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /Users/Steve/Projects/asset_tracker_v2/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /Users/Steve/Projects/asset_tracker_v2/build/zephyr/dts.cmake

    warning: Experimental symbol NET_SOCKETS_OFFLOAD is enabled.


    warning: NRF_MODEM_LIB (defined at /opt/nordic/ncs/v1.9.1/nrf/lib/nrf_modem_lib/Kconfig:6) has direct dependencies SOC_NRF9160_SICA with value n, but is currently being y-selected by the following symbols:
    - MODEM_INFO (defined at /opt/nordic/ncs/v1.9.1/nrf/lib/modem_info/Kconfig:7), with value y, direct dependencies y (value: y)

    error: Aborting due to Kconfig warnings

    Parsing /Users/Steve/Projects/asset_tracker_v2/Kconfig
    Loaded configuration '/opt/nordic/ncs/v1.9.1/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration '/Users/Steve/Projects/asset_tracker_v2/prj.conf'
    Merged configuration '/Users/Steve/Projects/asset_tracker_v2/build/zephyr/misc/generated/extra_kconfig_options.conf'
    CMake Error at /opt/nordic/ncs/v1.9.1/zephyr/cmake/kconfig.cmake:272 (message):
    command failed with return code: 1
    Call Stack (most recent call first):
    /opt/nordic/ncs/v1.9.1/zephyr/cmake/app/boilerplate.cmake:544 (include)
    /opt/nordic/ncs/v1.9.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    /opt/nordic/ncs/v1.9.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
    /Users/Steve/Projects/asset_tracker_v2/build/CMakeLists.txt:9 (find_package)


    -- Configuring incomplete, errors occurred!
    FATAL ERROR: command exited with status 1: /opt/nordic/ncs/v1.9.1/toolchain/bin/cmake -DWEST_PYTHON=/opt/nordic/ncs/v1.9.1/toolchain/opt/[email protected]/bin/python3.9 -B/Users/Steve/Projects/asset_tracker_v2/build -S/Users/Steve/Projects/asset_tracker_v2 -GNinja -DBOARD=nrf52840dk_nrf52840 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DBOARD_ROOT:STRING=/Users/Steve/Projects/asset_tracker_v2
    The terminal process terminated with exit code: 1.

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

    > Executing task: nRF Connect: Dynamic Build Task <

    Building asset_tracker_v2
    west build --build-dir /Users/Steve/Projects/asset_tracker_v2/build /Users/Steve/Projects/asset_tracker_v2 --pristine --board nrf52840dk_nrf52840 -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DBOARD_ROOT:STRING="/Users/Steve/Projects/asset_tracker_v2" -DCONFIG_DEBUG_OPTIMIZATIONS:STRING="y" -DCONFIG_DEBUG_THREAD_INFO:STRING="y" -DCONF_FILE:STRING="/Users/Steve/Projects/asset_tracker_v2/prj.conf"

    -- west build: generating a build system
    Including boilerplate (Zephyr base): /opt/nordic/ncs/v1.9.1/zephyr/cmake/app/boilerplate.cmake
    -- Application: /Users/Steve/Projects/asset_tracker_v2
    -- Zephyr version: 2.7.99 (/opt/nordic/ncs/v1.9.1/zephyr), build: v2.7.99-ncs1-1
    -- Found Python3: /opt/nordic/ncs/v1.9.1/toolchain/opt/[email protected]/bin/python3.9 (found suitable exact version "3.9.6") found components: Interpreter
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: /Users/Steve/Library/Caches/zephyr
    -- Found dtc: /opt/nordic/ncs/v1.9.1/toolchain/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/opt/nordic/ncs/v1.9.1/toolchain)
    -- Found BOARD.dts: /opt/nordic/ncs/v1.9.1/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Generated zephyr.dts: /Users/Steve/Projects/asset_tracker_v2/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /Users/Steve/Projects/asset_tracker_v2/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /Users/Steve/Projects/asset_tracker_v2/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /Users/Steve/Projects/asset_tracker_v2/build/zephyr/dts.cmake

    warning: Experimental symbol NET_SOCKETS_OFFLOAD is enabled.


    warning: NRF_MODEM_LIB (defined at /opt/nordic/ncs/v1.9.1/nrf/lib/nrf_modem_lib/Kconfig:6) has direct dependencies SOC_NRF9160_SICA with value n, but is currently being y-selected by the following symbols:
    - MODEM_INFO (defined at /opt/nordic/ncs/v1.9.1/nrf/lib/modem_info/Kconfig:7), with value y, direct dependencies y (value: y)

    error: Aborting due to Kconfig warnings

    Parsing /Users/Steve/Projects/asset_tracker_v2/Kconfig
    Loaded configuration '/opt/nordic/ncs/v1.9.1/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration '/Users/Steve/Projects/asset_tracker_v2/prj.conf'
    Merged configuration '/Users/Steve/Projects/asset_tracker_v2/build/zephyr/misc/generated/extra_kconfig_options.conf'
    CMake Error at /opt/nordic/ncs/v1.9.1/zephyr/cmake/kconfig.cmake:272 (message):
    command failed with return code: 1
    Call Stack (most recent call first):
    /opt/nordic/ncs/v1.9.1/zephyr/cmake/app/boilerplate.cmake:544 (include)
    /opt/nordic/ncs/v1.9.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
    /opt/nordic/ncs/v1.9.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
    /Users/Steve/Projects/asset_tracker_v2/build/CMakeLists.txt:9 (find_package)


    -- Configuring incomplete, errors occurred!
    FATAL ERROR: command exited with status 1: /opt/nordic/ncs/v1.9.1/toolchain/bin/cmake -DWEST_PYTHON=/opt/nordic/ncs/v1.9.1/toolchain/opt/[email protected]/bin/python3.9 -B/Users/Steve/Projects/asset_tracker_v2/build -S/Users/Steve/Projects/asset_tracker_v2 -GNinja -DBOARD=nrf52840dk_nrf52840 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DBOARD_ROOT:STRING=/Users/Steve/Projects/asset_tracker_v2 -DCONFIG_DEBUG_OPTIMIZATIONS:STRING=y -DCONFIG_DEBUG_THREAD_INFO:STRING=y -DCONF_FILE:STRING=/Users/Steve/Projects/asset_tracker_v2/prj.conf
    The terminal process terminated with exit code: 1.

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

    =================================================================== end error log

    When I tried your first instruction to build from the terminal, I got the following.

    west build --build-dir /Users/Steve/Projects/asset_tracker_v2/build /Users/Steve/Projects/asset_tracker_v2 --pristine --board nrf52840dk_nrf52840 -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DCONFIG_DEBUG_OPTIMIZATIONS=y -DCONFIG_DEBUG_THREAD_INFO=y -DBOARD_ROOT:STRING="/Users/Steve/Projects/asset_tracker_v2"
    usage: west [-h] [-z ZEPHYR_BASE] [-v] [-V] <command> ...
    west: error: argument <command>: invalid choice: 'build' (choose from 'init', 'update', 'list', 'manifest', 'diff', 'status', 'forall', 'help', 'config', 'topdir', 'selfupdate')

    Looking forward to getting this resolved. 

    Best,

    Steve

  • Hi Steve,

    Could you try using nrf9160dk_nrf9160_ns board instead of nrf52840dk_52840 when building asset_tracker_v2?
    Please provide the same log as you did for nrf52840dk.

    When you run west build command, Zephyr_base cannot be found. In order to fix this, run the following:
    1. open terminal in the Toolchain Manager
    2. run "source /opt/nordic/ncs/v1.9.1/zephyr/zephyr-env.sh"
    3. navigate to the project folder
    4. run "rm -r build"
    5. run "west build -b nrf9160dk_nrf9160_ns"

    Best regards,
    Dejan

  • I recently ran into this issue when trying to add mcuboot to a project. While I can't speak to the cause, here is what I did to workaround for anyone else that runs into this.

    1) Install vscode command line. In VSCODE, CMD-SHIFT-P, shell command install code in path 

    2) Open terminal 

    3) Navigate to the project / app folder. cd "/blah/blah/my_first_app"

    4) Run code as root. "sudo code ." // open this folder in visual studio code, with superuser 

    5) Build project 

  • Hi,

    Thanks for sharing your findings.

    Best regards,
    Dejan

Related