I'm making more progress now. I eventually realised that configure's "--host" option is incredibly confusing - it really means "the target that we're compiling this tool or library for..." It only really makes sense if you're configuring to build a compiler, not a library like wolfcrypt...

Ok... I tried:

./configure \
CC="clang" \
AR="llvm-ar" \
AS="llvm-as" \
RANLIB="llvm-ranlib" \
LD="llvm-link" \
--enable-ecc \
CFLAGS="-O1 --target=thumbv7em-none-eabihf"

and got:

checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/home/rchapman/prog/wolfssl-5.1.1-commercial':
configure: error: C compiler cannot create executables
See `config.log' for more details

The specific error in config.log is

configure:3930: clang -O1 --target=thumbv7em-none-eabihf     conftest.c  >&5
clang: error: unable to execute command: Executable "ld.lld" doesn't exist!
clang: error: ld.lld command failed with exit code 1 (use -v to see invocation)

I checked that manual and didn't really understand what I need to do.

Do I need to set CC to "clang" or "clang --target=thumb7em-none-eabihf"

and so I need to set --host and/or --target on the ./configure command?

I have tried several of these combinations with no luck. It either just fails to configure,
or it configures, builds but always produces x86_64 binaries...


Could anyone advise how to configure to build wolfcrypt using clang (version 13) for an ARM/thumb target machine please?

The clang target triple is "thumbv7em-none-eabihf", but where do I specify that so it gets passed to clang's "--target" argument?

My host machine is 64-bit Ubuntu Linux.

Many thanks,