Michael Dalpee via llvm-dev
2018-Apr-03 13:20 UTC
[llvm-dev] Clang Cross compilation GCC Source Requirement
Hi, I am new to CLANG/LLVM and wish to use it to cross compile an application for an arm target. I was able to get this to work for a small test application, but only after I pointed clang at the gcc toolchain source I was formerly using by providing --sysroot and -I arguments - otherwise, I was getting undefined header file errors. It seems a bit odd that given CLANG is intended to be a gcc replacement, I still need to provide a gcc toolchain for it to work. Am I doing this right? Mike -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180403/29e2fa8e/attachment.html>
Peter Smith via llvm-dev
2018-Apr-03 13:48 UTC
[llvm-dev] Clang Cross compilation GCC Source Requirement
Hello Mike, It is likely that you are doing it right, although you might be able to use the --gcc-toolchain option to point clang at your gcc toolchain. This should prevent you having to add -I arguments although my experience has been that you often need --sysroot as well. Without -gcc-toolchain clang will follow some heuristics to find a cross-compilation toolchain that may or may not work depending on where you have gcc installed. There is some information available on https://llvm.org/docs/HowToCrossCompileBuiltinsOnArm.html that you might find helpful. Hope this is of some use Peter On 3 April 2018 at 14:20, Michael Dalpee via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Hi, > > I am new to CLANG/LLVM and wish to use it to cross compile an application > for an arm target. I was able to get this to work for a small test > application, but only after I pointed clang at the gcc toolchain source I > was formerly using by providing --sysroot and -I arguments - otherwise, I > was getting undefined header file errors. > > It seems a bit odd that given CLANG is intended to be a gcc replacement, I > still need to provide a gcc toolchain for it to work. Am I doing this > right? > > Mike > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >
Joerg Sonnenberger via llvm-dev
2018-Apr-03 14:01 UTC
[llvm-dev] Clang Cross compilation GCC Source Requirement
On Tue, Apr 03, 2018 at 09:20:33AM -0400, Michael Dalpee via llvm-dev wrote:> It seems a bit odd that given CLANG is intended to be a gcc replacement, I > still need to provide a gcc toolchain for it to work. Am I doing this > right?You don't need to provide a gcc toolchain. You need to provide a linker, potentially an assembler and a target environment though. The target environment can be a snapshot of the real system, i.e. just a copy of /lib and /usr. Joerg