nRF5 SDK is not maintained anymore
More Info: Consider nRF Connect SDK for new designs

external_lib not compiling out of the box

I am trying to get external_lib example application to compile for NRF5340pdk. I am using nRF Connect SDK v1.4.1 and picked the example provided in zepher/samples/application_development/external_lib. The code does not compile and does not seem to give any obvious errors. I am using a windows 10 PC for development. Do I need to do something more to get it to compile and run?

  • Hello, 

    I am facing the same problem with nRF Connect SDK v1.7.0. I downloaded the working version of mkdir as suggested by  and placed it in toolchain\usr\bin\  but it did not help.

    I would really appreciate any pointers in the right direction. I am hard stuck at the moment.

    Thanks,

    Hamza 

  • Hey If you remember what you changed in the paths to make it work, please let me know.

  • Hello Hamza,

    Could you please post your build log as well as the PATH variable from the terminal you used to build the sample with?

    Echo path variable from cmd:

    > echo %PATH%

    Thanks,

    Vidar

  • Hello,

    Here are the outputs from PATH:

    C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\libnvvp;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\Nsight Compute 2019.5.0\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\IVI Foundation\VISA\WinNT\Bin;C:\Program Files\MATLAB\R2020a\bin;C:\Program Files\Git\cmd;C:\ProgramData\chocolatey\bin;;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git LFS;C:\Program Files (x86)\ZeroTier\One\;C:\Program Files\Nordic Semiconductor\nrf-command-line-tools\bin\;C:\Program Files\PuTTY\;C:\Users\Anas\AppData\Local\Microsoft\WindowsApps;C:\Users\Anas\AppData\Local\Programs\Microsoft VS Code\bin;C:\Program Files\glfw-3.3.2.bin.WIN64\lib-mingw-w64;C:\Users\Anas\AppData\Local\GitHubDesktop\bin;C:\Users\Anas\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin;C:\Users\Anas\Downloads\open_model_zoo\tools\downloader;;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

    and here is the build output:

     Executing task: nRF Connect: Generate config nrf52840dk_nrf52840 for udp/external_lib <
    
    Building external_lib
    west build --build-dir c:\Users\Anas\Desktop\thread\udp\external_lib\build c:\Users\Anas\Desktop\thread\udp\external_lib --pristine --board nrf52840dk_nrf52840 -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE"
    
    -- west build: generating a build system
    Including boilerplate (Zephyr base): C:/Users/Anas/ncs/v1.7.0/zephyr/cmake/app/boilerplate.cmake
    -- Application: C:/Users/Anas/Desktop/thread/udp/external_lib
    -- Zephyr version: 2.6.99 (C:/Users/Anas/ncs/v1.7.0/zephyr), build: v2.6.99-ncs1
    -- Found Python3: C:/Users/Anas/ncs/v1.7.0/toolchain/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter 
    -- Found west (found suitable version "0.11.1", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Cache files will be written to: C:/Users/Anas/ncs/v1.7.0/zephyr/.cache
    -- Found dtc: C:/Users/Anas/ncs/v1.7.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (c:/Users/Anas/ncs/v1.7.0/toolchain/opt)
    -- Found BOARD.dts: C:/Users/Anas/ncs/v1.7.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Generated zephyr.dts: C:/Users/Anas/Desktop/thread/udp/external_lib/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: C:/Users/Anas/Desktop/thread/udp/external_lib/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: C:/Users/Anas/Desktop/thread/udp/external_lib/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: C:/Users/Anas/Desktop/thread/udp/external_lib/build/zephyr/dts.cmake
    Parsing C:/Users/Anas/ncs/v1.7.0/zephyr/Kconfig
    Loaded configuration 'C:/Users/Anas/ncs/v1.7.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840_defconfig'
    Merged configuration 'C:/Users/Anas/Desktop/thread/udp/external_lib/prj.conf'
    Configuration saved to 'C:/Users/Anas/Desktop/thread/udp/external_lib/build/zephyr/.config'
    Kconfig header saved to 'C:/Users/Anas/Desktop/thread/udp/external_lib/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: C:/Users/Anas/ncs/v1.7.0/toolchain/opt/bin/arm-none-eabi-gcc.exe
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/Anas/Desktop/thread/udp/external_lib/build
    -- west build: building application
    [1/158] Creating directories for 'mylib_project'
    [2/158] No download step for 'mylib_project'
    [3/158] No update step for 'mylib_project'
    [4/158] No patch step for 'mylib_project'
    [5/158] No configure step for 'mylib_project'
    [6/158] Performing build step for 'mylib_project'
    FAILED: mylib/src/mylib_project-stamp/mylib_project-build mylib/lib/libmylib.a 
    cmd.exe /C "cd /D C:\Users\Anas\Desktop\thread\udp\external_lib\mylib && make PREFIX=C:/Users/Anas/Desktop/thread/udp/external_lib/build/mylib CC=C:/Users/Anas/ncs/v1.7.0/toolchain/opt/bin/arm-none-eabi-gcc.exe AR=C:/Users/Anas/ncs/v1.7.0/toolchain/opt/bin/arm-none-eabi-ar.exe "CFLAGS=-IC:/Users/Anas/ncs/v1.7.0/zephyr/include -IC:/Users/Anas/Desktop/thread/udp/external_lib/build/zephyr/include/generated -IC:/Users/Anas/ncs/v1.7.0/zephyr/soc/arm/nordic_nrf/nrf52 -IC:/Users/Anas/ncs/v1.7.0/zephyr/lib/libc/minimal/include -IC:/Users/Anas/ncs/v1.7.0/nrf/include -IC:/Users/Anas/ncs/v1.7.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/Users/Anas/ncs/v1.7.0/modules/hal/nordic/nrfx -IC:/Users/Anas/ncs/v1.7.0/modules/hal/nordic/nrfx/drivers/include -IC:/Users/Anas/ncs/v1.7.0/modules/hal/nordic/nrfx/mdk -IC:/Users/Anas/ncs/v1.7.0/zephyr/modules/hal_nordic/nrfx/. -IC:/Users/Anas/ncs/v1.7.0/modules/debug/segger/SEGGER -IC:/Users/Anas/ncs/v1.7.0/modules/debug/segger/Config -IC:/Users/Anas/ncs/v1.7.0/zephyr/modules/segger/. -Ic:/users/anas/ncs/v1.7.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/include -Ic:/users/anas/ncs/v1.7.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/include-fixed -DKERNEL -D__ZEPHYR__=1 -D_FORTIFY_SOURCE=2 -DBUILD_VERSION=v2.6.99-ncs1 -DUSE_PARTITION_MANAGER=0 -D__PROGRAM_START -DNRF52840_XXAA -Os -imacros C:/Users/Anas/Desktop/thread/udp/external_lib/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -imacros C:/Users/Anas/ncs/v1.7.0/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-address-of-packed-member -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=C:/Users/Anas/Desktop/thread/udp/external_lib=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/Users/Anas/ncs/v1.7.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/Users/Anas/ncs/v1.7.0=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -isystemC:/Users/Anas/ncs/v1.7.0/zephyr/lib/libc/minimal/include -isystemc:/users/anas/ncs/v1.7.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/include -isystemc:/users/anas/ncs/v1.7.0/toolchain/opt/bin/../lib/gcc/arm-none-eabi/9.2.1/include-fixed" && C:\Users\Anas\ncs\v1.7.0\toolchain\opt\bin\cmake.exe -E touch C:/Users/Anas/Desktop/thread/udp/external_lib/build/mylib/src/mylib_project-stamp/mylib_project-build"
    mkdir -p C:/Users/Anas/Desktop/thread/udp/external_lib/build/mylib/obj C:/Users/Anas/Desktop/thread/udp/external_lib/build/mylib/lib
    The syntax of the command is incorrect.
    make: *** [c:\Users\Anas\Desktop\thread\udp\external_lib\build\Makefile:12: all] Error 1
    [7/158] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'c:\Users\Anas\ncs\v1.7.0\toolchain\opt\bin\cmake.EXE' --build 'c:\Users\Anas\Desktop\thread\udp\external_lib\build'
    The terminal process terminated with exit code: 1.
    
    Terminal will be reused by tasks, press any key to close it.

    I also compiled with the -p option removed, however, it still failed.

  • Hello,

    The -p option does not seem to be supported for some reason. It is required to make all the parent folders for 'obj' and 'lib' inside your build directory.

    Can you try to build the project from the bash terminal instead?

    It would be better if this sample didn't rely on GNU Make, and instead used cmake for building the library..

Related