MQTT example not finding lte_lc.h

Hello!

I am a beginner and am trying out an MQTT example on my nRF9161 DK that I recently bought in my Visual Studio Code on Windows 11. I am aware that the sample application is for the nRF9160, but I am still optimistic as the build was partially successful. The I get the following error:

C:/Users/phani/workspace/wifi_mqtt_test/src/main.c:4:10: fatal error: zephyr/modem/lte_lc.h: No such file or directory
4 | #include <zephyr/modem/lte_lc.h>
| ^~~~~~~~~~~~~~~~~~~~~~~

 

I looked into the include files and I found that the lte_lc.h file needed for this program is missing:

The version of command line tools that I'm using is v2.7.0-rc3 which is the latest as of 3/June/24.

Here are the include statements in the sample: 

#include <zephyr/kernel.h>

#include <zephyr/net/mqtt.h>

#include <zephyr/net/socket.h>

#include <modem/lte_lc.h>

Is there any way I can fix it?

  • Hi Phani,

    Do you mean this sample? MQTT — nRF Connect SDK 2.7.0 documentation (nordicsemi.com)

    It actually supports nRF9161DK. I suggest retry with NCS v2.7.0 since it is the official release now.

    C:\NCS\v2.7.0\nrf\samples\net\mqtt>west nrf9161dk/nrf9161/ns
    usage: west [-h] [-z ZEPHYR_BASE] [-v] [-V] <command> ...
    west: unknown command "nrf9161dk/nrf9161/ns"; workspace C:\NCS\v2.7.0 does not define this extension command -- try "west help"
    
    C:\NCS\v2.7.0\nrf\samples\net\mqtt>west build -b nrf9161dk/nrf9161/ns 
    -- west build: generating a build system
    Loading Zephyr module(s) (Zephyr base): sysbuild_default
    -- Found Python3: C:/NCS/toolchains/ce3b5ff664/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/NCS/v2.7.0/zephyr/.cache
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf9161dk, Revision: 0.9.0, qualifiers: nrf9161/ns
    Parsing C:/NCS/v2.7.0/zephyr/share/sysbuild/Kconfig
    Loaded configuration 'C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/_sysbuild/empty.conf'   
    Merged configuration 'C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/_sysbuild/empty.conf'   
    Merged configuration 'C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/_sysbuild/empty.conf'   
    Configuration saved to 'C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/zephyr/.config'       
    Kconfig header saved to 'C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/_sysbuild/autoconf.h'-- 
       **************************
       * Running CMake for mqtt *
       **************************
    
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/NCS/v2.7.0/nrf/samples/net/mqtt
    -- CMake version: 3.21.0
    -- Using NCS Toolchain 2.6.20240605.885759407716 for building. (C:/NCS/toolchains/ce3b5ff664/cmake)
    -- Found Python3: C:/NCS/toolchains/ce3b5ff664/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/NCS/v2.7.0/zephyr/.cache
    -- Zephyr version: 3.6.99 (C:/NCS/v2.7.0/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf9161dk, Revision: 0.9.0, qualifiers: nrf9161/ns
    -- Found host-tools: zephyr 0.16.5 (C:/NCS/toolchains/ce3b5ff664/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (C:/NCS/toolchains/ce3b5ff664/opt/zephyr-sdk)
    -- Found Dtc: C:/NCS/toolchains/ce3b5ff664/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/NCS/v2.7.0/zephyr/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns.dts
    -- Found devicetree overlay: C:/NCS/v2.7.0/nrf/samples/net/mqtt/boards/nrf9161dk_nrf9161_ns.overlay
    -- Generated zephyr.dts: C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/mqtt/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/mqtt/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/mqtt/zephyr/dts.cmake
    
    warning: Experimental symbol NET_CONNECTION_MANAGER is enabled.
    
    Parsing C:/NCS/v2.7.0/nrf/samples/net/mqtt/Kconfig
    Loaded configuration 'C:/NCS/v2.7.0/zephyr/boards/nordic/nrf9161dk/nrf9161dk_nrf9161_ns_defconfig'
    Merged configuration 'C:/NCS/v2.7.0/nrf/samples/net/mqtt/prj.conf'
    Merged configuration 'C:/NCS/v2.7.0/nrf/samples/net/mqtt/boards/nrf9161dk_nrf9161_ns.conf'
    Merged configuration 'C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/mqtt/zephyr/.config.sysbuild'
    Configuration saved to 'C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/mqtt/zephyr/.config'  
    Kconfig header saved to 'C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/mqtt/zephyr/include/generated/autoconf.h'
    -- Found GnuLd: c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/NCS/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    CMake Warning at C:/NCS/v2.7.0/zephyr/kernel/CMakeLists.txt:170 (message):
    
    
              CONFIG_HEAP_MEM_POOL_SIZE is less than requested minimum:
                512 < 1024
              Setting the system heap size to 1024
    
    
    CMake Warning at C:/NCS/v2.7.0/zephyr/CMakeLists.txt:2027 (message):
      __ASSERT() statements are globally ENABLED
    
    
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/mqtt
    Dropping partition 'nonsecure_storage' since it is empty.
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/NCS/v2.7.0/nrf/samples/net/mqtt/build
    ←[92m-- west build: building application
    [5/10] Performing build step for 'mqtt'
    [4/349] Generating include/generated/version.h
    -- Zephyr version: 3.6.99 (C:/NCS/v2.7.0/zephyr), build: v3.6.99-ncs2
    [5/349] Generating ../../tfm/CMakeCache.txt
    -- Found Git: C:/NCS/toolchains/ce3b5ff664/mingw64/bin/git.exe (found version "2.37.3.windows.1")
    -- The C compiler identification is GNU 12.2.0
    -- The CXX compiler identification is GNU 12.2.0
    -- The ASM compiler identification is GNU
    -- Found assembler: C:/NCS/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe
    -- Found Python3: C:/NCS/toolchains/ce3b5ff664/opt/bin/python.exe (found version "3.9.13") found components: Interpreter
    -- Found Python3: C:/NCS/toolchains/ce3b5ff664/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/NCS/v2.7.0/zephyr/.cache
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/mqtt/tfm 
    [10/349] Performing build step for 'tfm'
    [164/168] Linking C executable bin\tfm_s.axf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       32104 B        32 KB     97.97%
                 RAM:       10424 B        32 KB     31.81%
    [168/168] Generating ../bin/tfm_s.elf
    [16/349] Performing install step for 'tfm'
    -- Install configuration: "MinSizeRel"
    ----- Installing platform NS -----
    [349/349] Linking C executable zephyr\zephyr.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      185756 B       992 KB     18.29%
                 RAM:       60612 B     195224 B     31.05%
            IDT_LIST:          0 GB        32 KB      0.00%
    Generating files from C:/NCS/v2.7.0/nrf/samples/net/mqtt/build/mqtt/zephyr/zephyr.elf for board: nrf9161dk
    [10/10] Generating ../merged.hex

    Best regards,

    Charlie

  • Hello!

    Thanks for the reference, but I was using this sample previously:

    nRF9160: Simple MQTT — nRF Connect SDK 1.5.1 documentation (nordicsemi.com)

    I realize now I got the SDK version wrong. Ill try both ways, see which one fits for my use case.

    Thanks for the info!

    Best

    Axlotl

Related