Have try with setting passing AR=clang-ar?

I actually set

    AR=/usr/lib/llvm-13/bin/llvm-ar

Then I set

    RANLIB=/usr/lib/llvm-13/bin/llvm-ranlib

That got me a little further down the road, but now I'm getting this error

    /usr/bin/ld: unrecognised emulation mode: armelf_linux_eabi
    Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu elf_l1om elf_k1om i386pep i386pe
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

I added this to CFLAGS

    -B/usr/lib/llvm-13/bin

But it still uses the system linker.

How do I specify which linker to use?

On Mon, 11 Oct 2021 at 09:44, Quentin Rameau <quinq@fifth.space> wrote:
> Hello everyone,

Hi Matt,

> I'm trying to cross compile from Ubuntu 20.04 to armv7a-linux-musleabihf
> using LLVM. Configure looks like this
>
> ./configure \
> --prefix=$VECX/usr \
> --syslibdir=$VECX/lib \
> --target=armv7a-linux-eabihf \
> CC=/usr/lib/llvm-13/bin/clang \
> CFLAGS="--target=armv7a-linux-eabihf -mcpu=cortex-a8"
>
> Then
>
> make && make install
>
> The compilation fails with the following
>
> make: armv7a-linux-eabihf-ar: Command not found
> make: *** [Makefile:167: lib/libc.a] Error 127
>
> It's looking for an archiver from a cross compiler toolchain, but should be
> using llvm-ar.
>
> Which configure options should I use to get LLVM to cross compile
> successfully?

Have try with setting passing AR=clang-ar?