Using own application repo


I am trying to use my own repo like described in the tutorial

Everything works fine if I compile stuff that is in the "samples" folder inside the ncs/nrf

I tried to copy one of the sample applications (for example the mqtt_simple" to ncs/applications_test/mqtt_simple and tried to compile with west 

west build -b nrf9160_pca10090ns

The build process stops with an error (without any hint what went wrong):

CMake Warning at C:/nrf91/ncs/zephyr/CMakeLists.txt:28 (message):

ZEPHYR_BASE = c:/nrf91/ncs/zephyr
PWD = c:/nrf91/ncs/applications_test/mqtt_simple
CMAKE_CURRENT_SOURCE_DIR = C:/nrf91/ncs/zephyr

You may be using a mix of symbolic links and real paths which causes subtle
and hard to debug CMake issues.

-- Configuring incomplete, errors occurred!
See also "C:/nrf91/ncs/applications_test/mqtt_simple/build/CMakeFiles/CMakeOutput.log".
See also "C:/nrf91/ncs/applications_test/mqtt_simple/build/CMakeFiles/CMakeError.log".
ERROR: command exited with status 1: 'c:\Program Files\CMake\bin\cmake.EXE' '-Bc:\nrf91\ncs\applications_test\mqtt_simple\build' '-Sc:\nrf91\ncs\applications_test\mqtt_simple' -GNinja -DBOARD=nrf9160_pca10090

Can you give me a hint what I need to do or configure to have applications outside the ncs repo?

  • Hi.

    The "C" in your ZEPHYR_BASE is lower case, while the one in the CMAKE_CURRENT_SOURCE_DIR is upper case. This confuses the build script.

    If it is set by you running the zephyr-env.cmd script, either do it from inside the zephyr/scripts folder or by having an upper case "C" in the path to the script.

    Best regards,


  • Hi!

    Thanks for your help.

    I tried the hello_world example. This works fine.

    When building the mqtt_simple it says the following:

    west build -b nrf9160_pca10090ns
    -- west build: build configuration:
           source directory: C:\nrf91\ncs\applications_test\mqtt_simple
           build directory: C:\nrf91\ncs\applications_test\mqtt_simple\build (created)
           BOARD: nrf9160_pca10090ns (origin: command line)
    -- west build: generating a build system
    CMake Error at CMakeLists.txt:9 (include):
      include could not find load file:
    -- Using application from 'C:/nrf91/ncs/applications_test/mqtt_simple'
    Zephyr version: 2.0.99
    -- Found PythonInterp: C:/Python37/python.exe (found suitable version "3.7.2", minimum required is "3.4")
    -- Selected BOARD nrf9160_pca10090ns
    -- Found west: C:/Python37/Scripts/west.exe (found suitable version "0.6.3", minimum required is "0.6.0")
    -- Cache files will be written to: C:\Users\UJDF716\AppData\Local/.cache/zephyr
    -- Loading C:/nrf91/ncs/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090ns.dts as base
    -- Overlaying C:/nrf91/ncs/zephyr/dts/common/common.dts
    Devicetree configuration written to C:/nrf91/ncs/applications_test/mqtt_simple/build/zephyr/include/generated/generated_dts_board.conf
    warning: TEST_RANDOM_GENERATOR (defined at subsys/random/Kconfig:8) was assigned the value 'y' but
    got the value 'n'. You can check symbol information (including dependencies) in the 'menuconfig'
    interface (see the Application Development Primer section of the manual), or in the Kconfig
    reference at (which is
    updated regularly from the master branch). See the 'Setting configuration values' section of the
    Board Porting Guide as well.
    Parsing Kconfig tree in C:/nrf91/ncs/applications_test/mqtt_simple/Kconfig
    Loaded configuration 'C:/nrf91/ncs/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090ns_defconfig'
    Merged configuration 'C:/nrf91/ncs/applications_test/mqtt_simple/prj.conf'
    Configuration saved to 'C:/nrf91/ncs/applications_test/mqtt_simple/build/zephyr/.config'
    -- The C compiler identification is GNU 7.3.1
    -- The CXX compiler identification is GNU 7.3.1
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/gnuarmemb/bin/arm-none-eabi-gcc.exe
    -- Using application from 'C:/nrf91/ncs/nrf/samples/nrf9160/spm'
    Zephyr version: 2.0.99
    Changed board to secure nrf9160_pca10090 (NOT NS)
    -- Loading C:/nrf91/ncs/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090.dts as base
    -- Overlaying C:/nrf91/ncs/zephyr/dts/common/common.dts
    -- Overlaying C:/nrf91/ncs/nrf/samples/nrf9160/spm/nrf9160_pca10090.overlay
    Devicetree configuration written to C:/nrf91/ncs/applications_test/mqtt_simple/build/spm/zephyr/include/generated/generated_dts_board.conf
    Parsing Kconfig tree in C:/nrf91/ncs/zephyr/Kconfig
    Loaded configuration 'C:/nrf91/ncs/zephyr/boards/arm/nrf9160_pca10090/nrf9160_pca10090_defconfig'
    Merged configuration 'C:/nrf91/ncs/nrf/samples/nrf9160/spm/prj.conf'
    Configuration saved to 'C:/nrf91/ncs/applications_test/mqtt_simple/build/spm/zephyr/.config'
    Running Partition Manager...
    -- Configuring incomplete, errors occurred!
    See also "C:/nrf91/ncs/applications_test/mqtt_simple/build/CMakeFiles/CMakeOutput.log".
    See also "C:/nrf91/ncs/applications_test/mqtt_simple/build/CMakeFiles/CMakeError.log".
    ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' '-BC:\nrf91\ncs\applications_test\mqtt_simple\build' '-SC:\nrf91\ncs\applications_test\mqtt_simple' -GNinja -DBOARD=nrf9160_pca10090ns

    It seems like there is a relative path to cmake/boilerplate.cmake in the CMakeLists.txt

    include(../../../cmake/boilerplate.cmake NO_POLICY_SCOPE)

    I set it manually to the correct path

    include(C:/nrf91/ncs/nrf/cmake/boilerplate.cmake NO_POLICY_SCOPE)

    Then it builds.

    Can you tell me what the correct environment variable would be to avoid absolute path?