[cfe-dev] Issue with cross compiling

Simon Atanasyan satanasyan at mips.com
Sat Jun 2 02:40:09 PDT 2012


On Sat, Jun 2, 2012 at 12:01 AM, ryan baird <ryanrbaird at gmail.com> wrote:
> #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.

--
Simon




More information about the cfe-dev mailing list