Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

warning: attempt to assign the value 'y' to the undefined symbol

I found a lot of posts with this warning/error, but I could not find a fitting solution among them.

in my case, I copied the `peripheral_lbs` project to another folder,
then sourced the zephyr environment script from ncs/vX.X.X/zephyr and
ran west build in the project folder.
the error is:

`warning: attempt to assign the value 'y' to the undefined symbol NCS_SAMPLES_DEFAULTS`

I assume the reason is that NCS_SAMPLES_DEFAULTS is not a Zephyr definition, but a nordic specific one.
A google search gave me this result, what supports my assumption:
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/kconfig/index-nrf.html

How do I tell kconfig/west (?) that there are more symbols available?

  • If the same thing happens when you build the peripheral_lbs inside its initial location (nrf\samples\bluetooth\peripheral_lbs\CMakeLists.txt) that might signify that there is something wrong with your setup, the Toochain Manager should set up everything for you and it should build out-of-the-box. 

    Let's see what happens if you use the command prompt that comes with the Toolchain Manager. Could you try the following:

    • Open the command prompt through the Toolchain Manager (don't use v1.4.99-dev1 as in the image below, use v1.4.2 instead)

    • Redirect to /opt/nordic/ncs/v1.4.2/nrf/samples/bluetooth/peripheral_lbs and build the sample
      • Don't set the Zephyr Base or run zephyr\zephyr-env.cmd. The Toolchain Manager will set up everything for you.

    If it fails, could you upload the build log?

  • Building the example from CLI this way worked, if I build inside the samples folders.

    On trying to build from custom folders (copies of samples), west does not know how to `build`.

  • Could you try to update to the latest Toolchain Manager (TM):

    I got a colleague with a Mac to test the steps you mentioned (using Toolchain Manager v0.9.1)

    • Copy  ncs\v1.4.2\nrf\samples\bluetooth\peripheral_lbs\ to any folder (e.g. ~/temp/peripheral_lbs/)
    • open terminal in new folder
      • Not the terminal from the Toolchain Manager 
    • source /opt/nordic/ncs/v1.4.2/zephyr/zephyr-env.sh
    • west build -b nrf52840dk_nrf52840

    and it built without problems.

    Try to update the TM and see if it works then. I not, please get back to me.

  • Thanks for the effort you guys put in!

    I updated the toolchain manager to 0.9.1 yesterday.

    I reinstalled the Toolchain.

    Same behaviour.

    Maybe something is messed up cause i went with the "getting started assistant" first, then realized the toolchain manager is a thing. Not sure if that could be messing something up, but also not sure how to revert all the things done during the getting started steps.

    Here is the output and what I did (first line is setup from toolchain manager I assume):

    ➜  ~ cd /opt/nordic/ncs/v1.4.2 ; export PATH=/opt/nordic/ncs/v1.4.2/toolchain/bin:/usr/bin:/bin:/usr/sbin:/sbin ; export GIT_EXEC_PATH=/opt/nordic/ncs/v1.4.2/toolchain/Cellar/git/2.26.2/libexec/git-core ; export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb ; export GNUARMEMB_TOOLCHAIN_PATH=/opt/nordic/ncs/v1.4.2/toolchain ; clear
    
    ➜  v1.4.2 cd nrf/samples/bluetooth/peripheral_lbs 
    ➜  peripheral_lbs git:(a61d43c6) west build -b nrf52840dk_nrf52840 --pristine
    -- west build: making build dir /opt/nordic/ncs/v1.4.2/nrf/samples/bluetooth/peripheral_lbs/build pristine
    -- west build: generating a build system
    Including boilerplate (Zephyr base): /opt/nordic/ncs/v1.4.2/zephyr/cmake/app/boilerplate.cmake
    -- Application: /opt/nordic/ncs/v1.4.2/nrf/samples/bluetooth/peripheral_lbs
    -- Using NCS Toolchain 1.4.0 for building. (/opt/nordic/ncs/v1.4.2/toolchain/cmake)
    -- Zephyr version: 2.4.0 (/opt/nordic/ncs/v1.4.2/zephyr)
    -- Found Python3: /opt/nordic/ncs/v1.4.2/toolchain/bin/python3 (found suitable exact version "3.8.2") found components:  Interpreter 
    -- Found west (found suitable version "0.7.2", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: /Users/larsheinrichs/Library/Caches/zephyr
    -- Found dtc: /opt/nordic/ncs/v1.4.2/toolchain/bin/dtc (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/opt/nordic/ncs/v1.4.2/toolchain)
    -- Found BOARD.dts: /opt/nordic/ncs/v1.4.2/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Generated zephyr.dts: /opt/nordic/ncs/v1.4.2/nrf/samples/bluetooth/peripheral_lbs/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /opt/nordic/ncs/v1.4.2/nrf/samples/bluetooth/peripheral_lbs/build/zephyr/include/generated/devicetree_unfixed.h
    Parsing /opt/nordic/ncs/v1.4.2/nrf/samples/bluetooth/peripheral_lbs/Kconfig
    Loaded configuration '/opt/nordic/ncs/v1.4.2/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration '/opt/nordic/ncs/v1.4.2/nrf/samples/bluetooth/peripheral_lbs/prj.conf'
    Configuration saved to '/opt/nordic/ncs/v1.4.2/nrf/samples/bluetooth/peripheral_lbs/build/zephyr/.config'
    Kconfig header saved to '/opt/nordic/ncs/v1.4.2/nrf/samples/bluetooth/peripheral_lbs/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /opt/nordic/ncs/v1.4.2/toolchain/bin/arm-none-eabi-gcc
    CMake Warning at /opt/nordic/ncs/v1.4.2/zephyr/CMakeLists.txt:1331 (message):
      __ASSERT() statements are globally ENABLED
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /opt/nordic/ncs/v1.4.2/nrf/samples/bluetooth/peripheral_lbs/build
    -- west build: building application
    [1/197] Preparing syscall dependency handling
    
    [192/197] Linking C executable zephyr/zephyr_prebuilt.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      193916 B         1 MB     18.49%
                SRAM:       30527 B       256 KB     11.65%
            IDT_LIST:         136 B         2 KB      6.64%
    [197/197] Linking C executable zephyr/zephyr.elf
    
    ➜  peripheral_lbs cp -R /opt/nordic/ncs/v1.4.2/nrf/samples/bluetooth/peripheral_lbs ~/Workspaces/development/peripheral_lbs
    ➜  peripheral_lbs cd ~/Workspaces/development/peripheral_lbs 
    ➜  peripheral_lbs rm -r build 
    ➜  peripheral_lbs west build -b nrf52840dk_nrf52840 --pristine
    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')
    ➜  peripheral_lbs 

  • Was just wondering if the toolchain could not just run in a preconfigured docker container and google led me to https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/getting-started/posts/build-ncs-application-firmware-images-using-docker

    I wonder why I did not run into this earlier.
    There are some urgent things on my desk right now, but I will give this a try later.

Related