I built llvm+clang+lld from source code in a docker container.
% CC=$HOME/toolchains/bin/gcc CXX=$HOME/toolchains/bin/g++ \
cmake ../llvm \
-G "Unix Makefiles" \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DCMAKE_CXX_LINK_FLAGS="-Wl,-rpath,$HOME/toolchains/lib64 -L$HOME/toolchains/lib64"
% make -j && sudo make install
Then i try to compile a hello world program with clang.
// test.c
#include <stdio.h>
int main(int argc, char**argv) {
printf("hello\n");
return 0;
}
Then I compile the test.c with clang and got following error message.
% clang test.c
**error: unknown target CPU 'x86-64'**
Are there something wrong with my building process?