Topic: Build error

Hi,
I am new to the wolfSSL library and I am trying to run a test application "wolfssl_test" and I am getting errors.

 *  Executing task: nRF Connect: Generate config nrf5340dk_nrf5340_cpuapp for d:\work\nrf\app\wolfssl_test 

Building wolfssl_test
west build --build-dir d:/work/nrf/app/wolfssl_test/build d:/work/nrf/app/wolfssl_test --pristine --board nrf5340dk_nrf5340_cpuapp -- -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE=d:/work/nrf/app/wolfssl_test/prj.conf -DBOARD_ROOT=d:/work/nrf/app/wolfssl_test

-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: D:/work/nrf/app/wolfssl_test
-- Found Python3: D:/work/nrf/sdk/v2.2.0/toolchains/v2.2.0/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter 
-- Cache files will be written to: D:/work/nrf/sdk/v2.2.0/v2.2.0/zephyr/.cache
-- Zephyr version: 3.2.99 (D:/work/nrf/sdk/v2.2.0/v2.2.0/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Found host-tools: zephyr 0.15.1 (D:/work/nrf/sdk/v2.2.0/toolchains/v2.2.0/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.15.1 (D:/work/nrf/sdk/v2.2.0/toolchains/v2.2.0/opt/zephyr-sdk)
-- Found Dtc: D:/work/nrf/sdk/v2.2.0/toolchains/v2.2.0/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") 
-- Found BOARD.dts: D:/work/nrf/sdk/v2.2.0/v2.2.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
-- Generated zephyr.dts: D:/work/nrf/app/wolfssl_test/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: D:/work/nrf/app/wolfssl_test/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: D:/work/nrf/app/wolfssl_test/build/zephyr/dts.cmake

d:/work/nrf/app/wolfssl_test/prj.conf:4: warning: attempt to assign the value '16384' to the undefined symbol COMMON_LIBC_MALLOC_ARENA_SIZE

error: Aborting due to Kconfig warnings

Parsing D:/work/nrf/sdk/v2.2.0/v2.2.0/zephyr/Kconfig
Loaded configuration 'D:/work/nrf/sdk/v2.2.0/v2.2.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
Merged configuration 'd:/work/nrf/app/wolfssl_test/prj.conf'
CMake Error at D:/work/nrf/sdk/v2.2.0/v2.2.0/zephyr/cmake/modules/kconfig.cmake:328 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  D:/work/nrf/sdk/v2.2.0/v2.2.0/nrf/cmake/modules/kconfig.cmake:29 (include)
  D:/work/nrf/sdk/v2.2.0/v2.2.0/zephyr/cmake/modules/zephyr_default.cmake:108 (include)
  D:/work/nrf/sdk/v2.2.0/v2.2.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  D:/work/nrf/sdk/v2.2.0/v2.2.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:2 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: 'D:\work\nrf\sdk\v2.2.0\toolchains\v2.2.0\opt\bin\cmake.EXE' '-DWEST_PYTHON=D:\work\nrf\sdk\v2.2.0\toolchains\v2.2.0\opt\bin\python.exe' '-Bd:\work\nrf\app\wolfssl_test\build' -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE=d:/work/nrf/app/wolfssl_test/prj.conf -DBOARD_ROOT=d:/work/nrf/app/wolfssl_test '-Sd:\work\nrf\app\wolfssl_test'

 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: nRF Connect: Build [pristine]: wolfssl_test/build (active) 

Building wolfssl_test
west build --build-dir d:/work/nrf/app/wolfssl_test/build d:/work/nrf/app/wolfssl_test --pristine --board nrf5340dk_nrf5340_cpuapp --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION=NONE -DBOARD_ROOT=d:/work/nrf/app/wolfssl_test -DCONF_FILE=d:/work/nrf/app/wolfssl_test/prj.conf

-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: D:/work/nrf/app/wolfssl_test
-- Found Python3: D:/work/nrf/sdk/v2.3.0/toolchains/v2.3.0/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter 
-- Cache files will be written to: D:/work/nrf/sdk/v2.3.0/v2.3.0/zephyr/.cache
-- Zephyr version: 3.2.99 (D:/work/nrf/sdk/v2.3.0/v2.3.0/zephyr)
-- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Found host-tools: zephyr 0.15.2 (D:/work/nrf/sdk/v2.3.0/toolchains/v2.3.0/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.15.2 (D:/work/nrf/sdk/v2.3.0/toolchains/v2.3.0/opt/zephyr-sdk)
-- Found Dtc: D:/work/nrf/sdk/v2.3.0/toolchains/v2.3.0/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") 
-- Found BOARD.dts: D:/work/nrf/sdk/v2.3.0/v2.3.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
-- Generated zephyr.dts: D:/work/nrf/app/wolfssl_test/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: D:/work/nrf/app/wolfssl_test/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: D:/work/nrf/app/wolfssl_test/build/zephyr/dts.cmake
Parsing D:/work/nrf/sdk/v2.3.0/v2.3.0/zephyr/Kconfig
Loaded configuration 'D:/work/nrf/sdk/v2.3.0/v2.3.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
Merged configuration 'd:/work/nrf/app/wolfssl_test/prj.conf'

d:/work/nrf/app/wolfssl_test/prj.conf:4: warning: attempt to assign the value '16384' to the undefined symbol COMMON_LIBC_MALLOC_ARENA_SIZE

error: Aborting due to Kconfig warnings

CMake Error at D:/work/nrf/sdk/v2.3.0/v2.3.0/zephyr/cmake/modules/kconfig.cmake:328 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  D:/work/nrf/sdk/v2.3.0/v2.3.0/nrf/cmake/modules/kconfig.cmake:29 (include)
  D:/work/nrf/sdk/v2.3.0/v2.3.0/zephyr/cmake/modules/zephyr_default.cmake:108 (include)
  D:/work/nrf/sdk/v2.3.0/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  D:/work/nrf/sdk/v2.3.0/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:2 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: 'D:\work\nrf\sdk\v2.3.0\toolchains\v2.3.0\opt\bin\cmake.EXE' '-DWEST_PYTHON=D:\work\nrf\sdk\v2.3.0\toolchains\v2.3.0\opt\bin\python.exe' '-Bd:\work\nrf\app\wolfssl_test\build' -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp -DNCS_TOOLCHAIN_VERSION=NONE -DBOARD_ROOT=d:/work/nrf/app/wolfssl_test -DCONF_FILE=d:/work/nrf/app/wolfssl_test/prj.conf '-Sd:\work\nrf\app\wolfssl_test'

 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

I have followed the setup from the below reference, and I have updated the SDK.
https://github.com/wolfSSL/wolfssl/blob … /README.md

Please let me know if I am missing any setup or configuration to be done.

Share

2 (edited by jordan 2024-02-01 11:22:02)

Re: Build error

Hi Ajmal,

In your wolfssl_test/prj.conf try replacing

COMMON_LIBC_MALLOC_ARENA_SIZE

with

MINIMAL_LIBC_MALLOC_ARENA_SIZE

The COMMON_LIBC_MALLOC parm is recent to Zephyr 3.4, but doesn't exist in older Zephyr versions. (our wolfSSL Zephyr samples were written for Zephyr 3.4).

After updating the parm all four of the examples worked for me with the Zephyr 3.2 branch. I attached a small patch to apply if that's handier.

Let me know if this helps!

Edit: the file didn't attach. Here is the git diff:

$git diff
diff --git a/zephyr/samples/wolfssl_benchmark/prj.conf b/zephyr/samples/wolfssl_benchmark/prj.conf
index b7e4eee..09af544 100644
--- a/zephyr/samples/wolfssl_benchmark/prj.conf
+++ b/zephyr/samples/wolfssl_benchmark/prj.conf
@@ -1,6 +1,6 @@
 # Configure stack and heap sizes
 CONFIG_MAIN_STACK_SIZE=32768
-CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192
+CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192
 
 # Pthreads
 CONFIG_PTHREAD_IPC=y
diff --git a/zephyr/samples/wolfssl_test/prj.conf b/zephyr/samples/wolfssl_test/prj.conf
index a989213..c2f9974 100644
--- a/zephyr/samples/wolfssl_test/prj.conf
+++ b/zephyr/samples/wolfssl_test/prj.conf
@@ -1,7 +1,7 @@
 
 # Configure stack and heap sizes
 CONFIG_MAIN_STACK_SIZE=32768
-CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=16384
+CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=16384
 
 # Pthreads
 CONFIG_PTHREAD_IPC=y
diff --git a/zephyr/samples/wolfssl_tls_sock/prj.conf b/zephyr/samples/wolfssl_tls_sock/prj.conf
index f8b0f29..b8ddf9e 100644
--- a/zephyr/samples/wolfssl_tls_sock/prj.conf
+++ b/zephyr/samples/wolfssl_tls_sock/prj.conf
@@ -2,7 +2,7 @@
 CONFIG_MAIN_STACK_SIZE=16384
 CONFIG_ENTROPY_GENERATOR=y
 CONFIG_INIT_STACKS=y
-CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192
+CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=8192
 
 # General config
 CONFIG_NEWLIB_LIBC=y
diff --git a/zephyr/samples/wolfssl_tls_thread/prj.conf b/zephyr/samples/wolfssl_tls_thread/prj.conf
index 4a1e290..e675b38 100644
--- a/zephyr/samples/wolfssl_tls_thread/prj.conf
+++ b/zephyr/samples/wolfssl_tls_thread/prj.conf
@@ -2,7 +2,7 @@
 CONFIG_MAIN_STACK_SIZE=16384
 CONFIG_ENTROPY_GENERATOR=y
 CONFIG_INIT_STACKS=y
-CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=65536
+CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=65536
 
 # Pthreads
 CONFIG_PTHREAD_IPC=y

Best,
Jordan

Share

Re: Build error

Thank you for the quick response, Jordan.

That fixed the errors.

I am now getting new error,

../sdk/v2.2.0/v2.2.0/modules/crypto/wolfssl/wolfssl/wolfcrypt/settings.h:1760:14: fatal error: C:/ncs/v2.2.0/zephyr/include/zephyr/kernel.h: No such file or directory
 1760 |     #include <C:/ncs/v2.2.0/zephyr/include/zephyr/kernel.h>

I think the above error is because the SDK in my PC is in different location and so I am getting this fatal error: No such file or directory.
Is it possible to get SDK path dynamically? like how VS Code get the SDK/toolchain path dynamically after installation?

Share

4 (edited by jordan 2024-02-02 07:11:21)

Re: Build error

Hi Ajmal,

I recommend to check the location of the zephyr kernel.h header file. The Zephyr header files were rearranged a bit over versions. For example:

In Zephyr 3.4:

$find zephyr/* -name "zephyr.h"
zephyr/include/zephyr/zephyr.h
$find zephyr/* -name "rand32.h"
zephyr/include/zephyr/random/rand32.h

In Zephyr 2.7.4:

$find zephyr/* -name "kernel.h"
zephyr/include/kernel.h
$find zephyr/* -name "rand32.h"
zephyr/include/random/rand32.h

You might need to update the wolfssl module include paths for zephyr header files.

For example I needed to make these changes for Zephyr 2.7.4:

diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c
index 5187334..9dcb8eb 100644
--- a/wolfcrypt/src/random.c
+++ b/wolfcrypt/src/random.c
@@ -3562,11 +3562,11 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
     #if KERNEL_VERSION_NUMBER >= 0x30500
         #include <zephyr/random/random.h>
     #else
-        #include <zephyr/random/rand32.h>
+        #include <random/rand32.h>
     #endif
 
     #ifndef _POSIX_C_SOURCE
-        #include <zephyr/posix/time.h>
+        #include <posix/time.h>
...

I didn't need to do this for the Zephyr v3.2-branch that I pulled, but maybe your version is different.

Share