How can I build LLVM with my gcc toolchain exactly

Hi, I’m from ByteDance.
I was confused when I built LLVM with gcc toolchain.

This is just a guess as you haven’t included the full invocation or output of the failing command, but perhaps you need -DGCC_INSTALL_PREFIX=/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830

Thanks for your reply! But it still does not work.

Host environment:debian9 gcc6.3
My toolchain: gcc8.3

Command:
CXX=/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/bin/g++ CC=/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/bin/gcc cmake -G Ninja -DLLVM_ENABLE_PROJECTS=“clang;clang-tools-extra;lld;lldb;openmp” -DLLVM_ENABLE_RUNTIMES=“compiler-rt;libcxx;libcxxabi;libunwind” -DLLVM_TARGETS_TO_BUILD=“X86;ARM;AArch64” -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DGCC_INSTALL_PREFIX=/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830 -DCMAKE_CXX_LINK_FLAGS=“-Wl,-rpath /home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/lib64 -L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/lib64 -Wl,-rpath /home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64 -L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64 -Wl,-dynamic-linker /home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64/ld-linux-x86-64.so.2 -L/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830/sysroot/lib64/ld-linux-x86-64.so.2” …/llvm

Info:
[99/302] Building C object CMakeFiles/clang_rt.builtins-i386.dir/floatsidf.c.o
FAILED: CMakeFiles/clang_rt.builtins-i386.dir/floatsidf.c.o
/home/liuke.gehry/llvm/llvm-project/build_13_release/./bin/clang --target=x86_64-unknown-linux-gnu -DVISIBILITY_HIDDEN -O3 -DNDEBUG -m32 -std=c11 -fPIC -fno-builtin -fvisibility=hidden -MD -MT CMakeFiles/clang_rt.builtins-i386.dir/floatsidf.c.o -MF CMakeFiles/clang_rt.builtins-i386.dir/floatsidf.c.o.d -o CMakeFiles/clang_rt.builtins-i386.dir/floatsidf.c.o -c /home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/floatsidf.c
In file included from /home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/floatsidf.c:16:
In file included from /home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/fp_lib.h:23:
In file included from /home/liuke.gehry/llvm/llvm-project/compiler-rt/lib/builtins/int_lib.h:93:
In file included from /data00/home/liuke.gehry/llvm/llvm-project/build_13_release/lib/clang/13.0.1/include/limits.h:21:
In file included from /usr/include/limits.h:25:
/usr/include/features.h:364:12: fatal error: ‘sys/cdefs.h’ file not found

include <sys/cdefs.h>

^~~~~~~~~~~~~
1 error generated.

It still includes system headers from “/usr/include”.

This is just a guess as you haven’t included the full invocation or output of the failing command, but perhaps you need -DGCC_INSTALL_PREFIX=/home/liuke.gehry/toolchain/x86_64-x86_64-gcc-830

You should check multilib support on your debian system. I don't think
gcc has `sys/cdefs.h` packaged.

I don’t install ‘multilib’ in my debian system, that’s why I want to specify my gcc8 toolchain.
Actually, I want to build llvm13 with gcc8 toolchain instead of a host environment. What should be my correct steps?

Or how to disable ‘multilib’ during building llvm13? I only apply it in the 64bit system.