[cfe-dev] Issue with cross compiling

ryan baird ryanrbaird at gmail.com
Fri Jun 1 13:01:49 PDT 2012


> On Fri, Jun 01, 2012 at 12:54:57PM -0600, ryan baird wrote:
> >
> > 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"
>
> Try using --sysroot
/home/ryan/llvm/src/R31/final/projects/compiler-rt/SDKs/linux
>
> Joerg

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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120601/c2991ccf/attachment.html>


More information about the cfe-dev mailing list