Topic: Errors when cross compiling with GCC ARM
I am trying to cross compile for ARM architecture (-mcpu=cortex-a72) from my host x86_64 architecture. I have been following the build instructions for cross compiling. https://www.wolfssl.com/documentation/m … th-gcc-arm.
After I git clone and run ./autogen.sh I run the following ./configure command:
./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 CFLAGS="-march=armv8-a --specs=nosys.specs -DHAVE_PK_CALLBACKS -DWOLFSSL_USER_IO -DNO_WRITEV" --disable-filesystem --enable-fastmath --disable-shared --enable-debug --enable-writedup --enable-lighty --disable-examples --enable-tls13 --enable-dtls13 --enable-dtls
where
--enable-writedup --enable-lighty --disable-examples --enable-tls13 --enable-dtls13 --enable-dtls
are my own configuration additions.
Some changes that I hade made in the makefile.common is as follows:
TOOLCHAIN = /bin/arm-none-eabi-
# Architecture
ARCHFLAGS = -mcpu=cortex-a72 -mthumb -mabi=aapcs
# LD: Link with nosys
#LDFLAGS += --specs=nosys.specs
# LD: Link with nano or rdimon implementation for standard library
#LDFLAGS += --specs=nano.specs
# Memory Map
#SRC_LD = -T./linker.ld
This results in the the following error after running the ./configure command in the terminal.
.
.
config.status: executing wolfssl/wolfcrypt/port/intel/quickassist_mem.h commands
configure: ---
configure: Running make clean...
configure: ---
configure: Generating user options header...
checking for wolfssl/openssl/aes.h... no
configure: error: Header file inconsistency detected -- error including wolfssl/openssl/aes.h.
.
.
Although I run into this error a Makefile is still created. When I try running make, I get the following output in the terminal:
.
.
make[2]: warning: -j5 forced in submake: resetting jobserver mode.
CC wolfcrypt/benchmark/benchmark.o
CC wolfcrypt/src/src_libwolfssl_la-sp_int.lo
CC wolfcrypt/src/src_libwolfssl_la-wc_port.lo
CC wolfcrypt/src/src_libwolfssl_la-error.lo
CC wolfcrypt/src/src_libwolfssl_la-wc_encrypt.lo
wolfcrypt/benchmark/benchmark.c: In function 'current_time':
wolfcrypt/benchmark/benchmark.c:15023:27: error: implicit declaration of function 'clock_gettime'; did you mean 'wc_GetTime'? [-Werror=implicit-function-declaration]
15023 | LIBCALL_CHECK_RET(clock_gettime(CLOCK_REALTIME, &tv));
| ^~~~~~~~~~~~~
wolfcrypt/benchmark/benchmark.c:596:29: note: in definition of macro 'LIBCALL_CHECK_RET'
596 | int _libcall_ret = (__VA_ARGS__); \
| ^~~~~~~~~~~
wolfcrypt/benchmark/benchmark.c:15023:27: error: nested extern declaration of 'clock_gettime' [-Werror=nested-externs]
15023 | LIBCALL_CHECK_RET(clock_gettime(CLOCK_REALTIME, &tv));
| ^~~~~~~~~~~~~
wolfcrypt/benchmark/benchmark.c:596:29: note: in definition of macro 'LIBCALL_CHECK_RET'
596 | int _libcall_ret = (__VA_ARGS__); \
| ^~~~~~~~~~~
CC wolfcrypt/src/src_libwolfssl_la-signature.lo
In file included from ./wolfssl/openssl/ssl.h:39,
from ./wolfssl/openssl/dh.h:29,
from ./wolfssl/openssl/evp.h:51,
from wolfcrypt/src/wc_port.c:81:
./wolfssl/ssl.h:2104:13: error: unknown type name 'WOLFSSL_BIO_ADDR'
2104 | WOLFSSL_API WOLFSSL_BIO_ADDR *wolfSSL_BIO_ADDR_new(void);
| ^~~~~~~~~~~~~~~~
./wolfssl/ssl.h:2105:40: error: unknown type name 'WOLFSSL_BIO_ADDR'; did you mean 'WOLFSSL_BY_DIR'?
2105 | WOLFSSL_API void wolfSSL_BIO_ADDR_free(WOLFSSL_BIO_ADDR *addr);
| ^~~~~~~~~~~~~~~~
| WOLFSSL_BY_DIR
./wolfssl/ssl.h:2106:41: error: unknown type name 'WOLFSSL_BIO_ADDR'; did you mean 'WOLFSSL_BY_DIR'?
2106 | WOLFSSL_API void wolfSSL_BIO_ADDR_clear(WOLFSSL_BIO_ADDR *addr);
| ^~~~~~~~~~~~~~~~
| WOLFSSL_BY_DIR
CC wolfcrypt/src/src_libwolfssl_la-wolfmath.lo
make[2]: *** [Makefile:8158: wolfcrypt/src/src_libwolfssl_la-wc_port.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
cc1: all warnings being treated as errors
make[2]: *** [Makefile:7602: wolfcrypt/benchmark/benchmark.o] Error 1
.
.
When I run the
./configure --enable-debug --enable-writedup --enable-lighty --disable-examples --enable-opensslextra --enable-tls13 --enable-dtls13 --enable-dtls
on my host, I am able to build everything successfully and run make without any errors.
I am unsure what I need to fix to get the ARM compilation working correctly.