Closed anp closed 3 years ago
It looks like perhaps your clang binary doesn't have support for WebAssembly. Although then I would expect to see an error message more like this:
clang --target=foo hello.c
error: unknown target triple 'foo', please use -triple or -arch
You can see the targets that are included by running llc --version
. For example on my system:
$ llc --version
LLVM (http://llvm.org/):
LLVM version 11.0.1
Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: broadwell
Registered Targets:
aarch64 - AArch64 (little endian)
aarch64_32 - AArch64 (little endian ILP32)
aarch64_be - AArch64 (big endian)
amdgcn - AMD GCN GPUs
arm - ARM
arm64 - ARM64 (little endian)
arm64_32 - ARM64 (little endian ILP32)
armeb - ARM (big endian)
avr - Atmel AVR Microcontroller
bpf - BPF (host endian)
bpfeb - BPF (big endian)
bpfel - BPF (little endian)
hexagon - Hexagon
lanai - Lanai
mips - MIPS (32-bit big endian)
mips64 - MIPS (64-bit big endian)
mips64el - MIPS (64-bit little endian)
mipsel - MIPS (32-bit little endian)
msp430 - MSP430 [experimental]
nvptx - NVIDIA PTX 32-bit
nvptx64 - NVIDIA PTX 64-bit
ppc32 - PowerPC 32
ppc64 - PowerPC 64
ppc64le - PowerPC 64 LE
r600 - AMD GPUs HD2XXX-HD6XXX
riscv32 - 32-bit RISC-V
riscv64 - 64-bit RISC-V
sparc - Sparc
sparcel - Sparc LE
sparcv9 - Sparc V9
systemz - SystemZ
thumb - Thumb
thumbeb - Thumb (big endian)
wasm32 - WebAssembly 32-bity-xxx-yy'
wasm64 - WebAssembly 64-bit
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64
xcore - XCore
Right, surprising to have such a recent clang version without wasm, but makes sense. The xcode CLI tools also didn't seem to come with a standalone llc
binary, which is a bit more confusing.
I'll try using the prebuilt clang's y'all have in releases and see if I can make progress that way.
You need to install llvm
from Homebrew
. Xcode's clang
doesn't have support for WebAssembly.
Indeed, thanks!
brew install llvm
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc
works for me
I'm trying out the SDK and have downloaded only the sysroot. It's extracted to
/Users/adam/code/wasi-sysroot
, but when I pass it to clang I get an error:The contents of
main.cc
don't seem to matter but the error above came from a file withint main() {}
as its contents.I see that your release tarballs are using clang 11, whereas the xcode tools seem to have given me 12:
Maybe that's the issue?
This error was one of several others I was seeing in the larger project from which I pulled this command. The contents of the sysroot seem valid on disk, as the other errors disappeared when I began passing
--sysroot=...
.