Issue with cross compiling

I’m new to llvm, and I’m trying to use clang and llc to generate mips32 assembly. I just built the project on my computer and tried to compile a simple C file:

#include <stdio.h>
int main() {

I trid to run clang with the following arguments, which I was previously using on a machine that already had the llvm environment:
clang -v -I/home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux/usr/include -mfloat-abi=hard -ccc-host-triple mipsel-unknown-linux -ccc-clang-archs mipsel -S -emit-llvm $1 -o “$NAME.ll”

However, I got the following error:

clang version 3.1 (tags/RELEASE_31/final 157818)
Target: mipsel-unknown-linux
Thread model: posix
“/home/ryan/llvm/build/R31/Debug+Asserts/bin/clang” -cc1 -triple mipsel-unknown-linux -emit-llvm -disable-free -main-file-name hello.c -mrelocation-model static -mdisable-fp-elim -mconstructor-aliases -target-cpu mips32 -target-abi o32 -mfloat-abi hard -target-linker-version -momit-leaf-frame-pointer -v -coverage-file hello.ll -resource-dir /home/ryan/llvm/build/R31/Debug+Asserts/bin/…/lib/clang/3.1 -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/local/include -internal-isystem /home/ryan/llvm/build/R31/Debug+Asserts/bin/…/lib/clang/3.1/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fno-dwarf-directory-asm -fdebug-compilation-dir /home/ryan/llvm/build/R31/tests -ferror-limit 19 -fmessage-length 80 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o hello.ll -x c hello.c
clang -cc1 version 3.1 based upon LLVM 3.1 default target x86_64-unknown-linux-gnu
ignoring nonexistent directory “/include”
#include “…” search starts here:
#include <…> search starts here:
End of search list.
In file included from hello.c:1:
In file included from /usr/include/stdio.h:28:
In file included from /usr/include/features.h:385:
/usr/include/gnu/stubs.h:7:11: fatal error: ‘gnu/stubs-32.h’ file not found

include <gnu/stubs-32.h>


I’m trying to figure out how to solve this problem; there seems to be a stubs-32.h file in another location: /home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux/usr/include. Is there something wrong with my installation of llvm & clang, or is there another package I need to install on my computer?

Try using --sysroot /home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux