[395/402] Linking C executable zephyr\zephyr_pre0.elf FAILED: ... ... collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed.

Hello Team, I'm trying to use the implement some WolfSSL extensions into my project and get errors while building it.

Preinformation:
I installed the SDK v2.7.0 using the nrf Connect for Desktop application.
Furthermore installed the WolfSSL extension using the guide from Github WolfSSL Zephyr .

The base code is from the DECT sample dect_phy, with some adjustments adding the UART, which is working fine.

Addingin functions from WolfSSL results in errors while building it as follows.

Error: (line 3 and 4 are "..." because I couldn't insert that part of the error due to not being able to post it)
[395/402] Linking C executable zephyr\zephyr_pre0.elf
FAILED: zephyr/zephyr_pre0.elf.zephyr/zephyr_pre0.map C:/ncs/v2.7.0/BA/v1.7/build/zephyr/zephyr_pre0.map
...
...
&& C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.exe -E true""
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_setsockopt':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:532: undefined reference to `nrf_setsockopt'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_getsockopt':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:561: undefined reference to `nrf_getsockopt'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_listen':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:463: undefined reference to `nrf_listen'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_sendto':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:659: undefined reference to `nrf_sendto'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_recvfrom':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:605: undefined reference to `nrf_recvfrom'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:612: undefined reference to `nrf_recvfrom'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_close':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:1024: undefined reference to `nrf_close'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_poll_prepare':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:920: undefined reference to `nrf_setsockopt'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_fcntl':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:862: undefined reference to `nrf_fcntl'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:858: undefined reference to `nrf_fcntl'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_socket':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:350: undefined reference to `nrf_socket'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_create':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:1117: undefined reference to `nrf_close'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_getaddrinfo':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:790: undefined reference to `nrf_getaddrinfo'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:835: undefined reference to `nrf_freeaddrinfo'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_accept':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:388: undefined reference to `nrf_accept'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:422: undefined reference to `nrf_close'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:422: undefined reference to `nrf_close'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_bind':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:449: undefined reference to `nrf_bind'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
modules/nrf/lib/nrf_modem_lib/lib..__nrf__lib__nrf_modem_lib.a(nrf91_sockets.c.obj): in function `nrf91_socket_offload_connect':
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:482: undefined reference to `nrf_connect'
c:/ncs/toolchains/ce3b5ff664/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe:
C:/ncs/v2.7.0/nrf/lib/nrf_modem_lib/nrf91_sockets.c:486: undefined reference to `nrf_connect'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\ce3b5ff664\opt\bin\cmake.EXE' --build 'c:\ncs\v2.7.0\BA\v1.7\build'

prj.conf 

# -----------------------------------------------------------------------------
# Config for Zephyr with DECT NR+ and UART
# -----------------------------------------------------------------------------

# Enable DECT NR+ PHY
CONFIG_NRF_MODEM_LIB=y
CONFIG_MODEM_ANTENNA=n
CONFIG_NRF_MODEM_LINK_BINARY_DECT_PHY=y

# Enable logging and hardware info
CONFIG_HWINFO=y
CONFIG_LOG=y
CONFIG_PRINTK=y
CONFIG_LOG_MODE_IMMEDIATE=y

# Enable UART
CONFIG_UART_INTERRUPT_DRIVEN=y

# to enable the random number generator for WolfSSL
CONFIG_ENTROPY_GENERATOR=y
CONFIG_ENTROPY_DEVICE_RANDOM_GENERATOR=y

# -----------------------------------------------------------------------------
# Added Configurations for the WolfSSL
# -----------------------------------------------------------------------------

# WolfSSL configuration
CONFIG_WOLFSSL=y
CONFIG_WOLFSSL_DTLS=y
CONFIG_WOLFSSL_TLS_VERSION_1_3=y

CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y

CONFIG_POSIX_API=y
# CONFIG_NET_SOCKETS_POSIX_NAMES=y

CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y
CONFIG_POSIX_CLOCK=y



CmakeLists.txt

cmake_minimum_required(VERSION 3.20.0)

include(CMakePrintHelpers)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(v1.7)

cmake_print_variables(ZEPHYR_BASE)

target_sources(app PRIVATE src/main.c)

add_definitions(-DWOLFSSL_USER_SETTINGS)
target_include_directories(app PRIVATE C:/ncs/v2.7.0/modules/crypto/wolfssl)

Related