Topic: Compilation problem for cross compiling
Hello my friends, I am going to make an example with wolfssl library and FreeRTOS
my environment is :
Host Ubuntu
Target STM32f446 Nucleo-64 (ARM cortex M4 )
IDE System Workbench for STM32
so I realized first I need to compile the library for my environment so I installed arm-none-eabi-gcc toolchain on my ubuntu then with this configuration I tried to build the library (this configuration comes from manual section 2.6.1)
./configure --host=arm-none-eabi \
CC=arm-none-eabi-gcc LD=arm-none-eabi-ld \
AR=arm-none-eabi-ar RANLIB=arm-none-eabi-ranlib \
CFLAGS="-DNO_WOLFSSL_DIR \
-DWOLFSSL_USER_IO -DNO_WRITEV \
-mcpu=cortex-m4 -mthumb -Os \
-specs=rdimon.specs" CPPFLAGS="-I./"
So it was not successful and I received this error
CC wolfcrypt/test/testsuite_testsuite_test-test.o
CC examples/client/testsuite_testsuite_test-client.o
In file included from examples/client/client.c:47:0:
./wolfssl/test.h:143:14: fatal error: netdb.h: No such file or directory
#include <netdb.h>
^~~~~~~~~
compilation terminated.
make[2]: *** [examples/client/testsuite_testsuite_test-client.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory `/home/mohsen/wolfssl-4.8.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/mohsen/wolfssl-4.8.1'
make: *** [all] Error 2
I didn't find any solution for that so I tried to use another configuration which was mentioned inspection Building with configure in github (https://github.com/wolfSSL/wolfssl/tree … DE/GCC-ARM)
also I changed the -march=armv8-a to -march=armv7-m
./configure \
--host=arm-non-eabi \
CC=arm-none-eabi-gcc \
AR=arm-none-eabi-ar \
STRIP=arm-none-eabi-strip \
RANLIB=arm-none-eabi-ranlib \
--prefix=/home/mohsen/default-wolfssl-arm7 \
CFLAGS="-march=armv7-m --specs=nosys.specs \
-DHAVE_PK_CALLBACKS -DWOLFSSL_USER_IO -DNO_WRITEV" \
--disable-filesystem --enable-fastmath \
--disable-shared
It was successful so I linked this library to my IDE but when I tried to use any wolfssl function like MD5 I received this error.
In file included from /home/mohsen/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.17.0.201812190825/tools/compiler/arm-none-eabi/include/dirent.h:7:0,
from /home/mohsen/wolfssl-arm7/include/wolfssl/wolfcrypt/wc_port.h:723,
from /home/mohsen/wolfssl-arm7/include/wolfssl/wolfcrypt/types.h:35,
from /home/mohsen/wolfssl-arm7/include/wolfssl/wolfcrypt/md5.h:30,
from ../src/main.c:4:
/home/mohsen/Ac6/SystemWorkbench/plugins/fr.ac6.mcu.externaltools.arm-none.linux64_1.17.0.201812190825/tools/compiler/arm-none-eabi/include/sys/dirent.h:10:2: error: #error "<dirent.h> not supported"
#error "<dirent.h> not supported"
^~~~~
In file included from /home/mohsen/wolfssl-arm7/include/wolfssl/wolfcrypt/types.h:35:0,
from /home/mohsen/wolfssl-arm7/include/wolfssl/wolfcrypt/md5.h:30,
from ../src/main.c:4:
/home/mohsen/wolfssl-arm7/include/wolfssl/wolfcrypt/wc_port.h:788:9: error: unknown type name 'DIR'
DIR* dir;
^~~
make: *** [src/main.o] Error 1
What do you think where is my mistake?