Issue with cross compiling

I tried adding the configuration options you suggested, and it gave me this output:

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 2.20.51.0.2 -momit-leaf-frame-pointer -v -coverage-file hello.ll -resource-dir /home/ryan/llvm/build/R31/Debug+Asserts/bin/…/lib/clang/3.1 -I /home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux/usr/include -isysroot /home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux/usr/local/include -internal-isystem /home/ryan/llvm/build/R31/Debug+Asserts/bin/…/lib/clang/3.1/include -internal-externc-isystem /home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux/include -internal-externc-isystem /home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux/usr/include -fno-dwarf-directory-asm -fdebug-compilation-dir /home/ryan -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 “/home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux/usr/local/include”
ignoring nonexistent directory “/home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux/include”
ignoring duplicate directory “/home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux/usr/include”
as it is a non-system directory that duplicates a system directory
#include “…” search starts here:
#include <…> search starts here:
/home/ryan/llvm/build/R31/Debug+Asserts/bin/…/lib/clang/3.1/include
/home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux/usr/include
End of search list.
hello.c:4:3: warning: implicitly declaring library function ‘printf’ with type
‘int (const char *, …)’
printf(“Test\n”);
^
hello.c:4:3: note: please include the header <stdio.h> or explicitly provide a
declaration for ‘printf’
1 warning generated.

This successfully generates the code, but it indicates that it did not correctly include <stdio.h> when compiling; even though the first line of my file is #include <stdio.h>, it tells me to include the header <stdio.h>. This is a sign that something is still not working. Any ideas?

The stdio.h from compiler-rt/SDKs does not include "printf" definition
at all because compiler-rt is not a replacement for libc. That's why
you get the last warning.

On my 32-bit debian system I just run the following command and it
works without any errors and warnings:
$ clang -target mipsel-linux-gnu test.c -mfloat-abi=hard -S -emit-llvm
-o test.ll

If you work on 64-bit OS you have to install gcc multilib for your
distribution to get gnu/stubs-32.h. An alternative way is to install
any MIPS toolchain and points sysroot to it.