Error : clang (8.0) *unknown arch 0xe0* for Ubuntu 18.04

Hi ,

Here is the below error, Can you please analyze and provide the solution or suggestion for below problem.

Error : clang (8.0) unknown arch 0xe0 for Ubuntu 18.04

clang -v
clang version 8.0
Target: amdgcn-unknown-amdhsa
Thread model: posix
InstalledDir: /usr/bin
Found CUDA installation: /usr/local/cuda-10.0, version 10.0

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

$ cat t.c
#include <stdio.h>

int main(int argc, char *argv[])
printf(“hello world\n”);

$ clang t.c -o test
In file included from t.c:1:
/usr/include/stdio.h:33:10: fatal error: ‘stddef.h’ file not found
#include <stddef.h>
1 error generated.

$ clang t.c -o test -isystem /usr/lib/llvm-5.0/lib/clang/5.0.1/include/

$ ./test
-bash: ./test: cannot execute binary file: Exec format error

$ file test

test: ELF 64-bit LSB shared object, unknown arch 0xe0 version 1, dynamically linked, not stripped

Thank you.

I don’t really have enough information to know for sure, but it looks like your clang was installed for cuda. It is reporting the default target as amdgcn, which is a GPU. So it looks like you’re compiling your test program for the GPU then trying to run it on the CPU.

If you want to build CPU code, I would suggest installing a new clang distribution to get a compiler that has the host as its default target.