[PATCH] Clang as a cross-compiler documentation

Renato Golin renato.golin at linaro.org
Sun Sep 8 13:48:28 PDT 2013


  Thanks Sean!

  r190281, feel free to correct/re-write.


================
Comment at: docs/CrossCompilationClang.rst:30
@@ +29,3 @@
+But Clang/LLVM is natively a cross-compiler, meaning that one set of
+programs can compile to all targets by setting the -target option. But that
+doesn't help finding the headers, libraries or binutils to generate
----------------
Stephen Kelly wrote:
> You should use the --target=<tgt> form, not -target <tgt>
I seem to have missed the discussion, is this a canonicalizaiton of Clang arguments? Are the single-dash options going to be deprecated some day?

================
Comment at: docs/CrossCompilation.rst:67
@@ +66,3 @@
+The basic option is to define the target architecture. For that, use
+``-target <triple>``. If you don't specify the target, CPU names won't
+match (since Clang assumes the host triple), and the compilation will
----------------
Stephen Kelly wrote:
> You should use the --target=<tgt> form, not -target <tgt>
> 
>  http://thread.gmane.org/gmane.comp.compilers.clang.devel/29975
Hi Stephen,

As you can see, I have replied to that thread in agreement, but that's hardly a standard set forward.

Is there a general rule that we should deprecate the old syntax, or is it just the preference of some?

================
Comment at: docs/CrossCompilation.rst:26-36
@@ +25,13 @@
+
+In GCC world, every host/target combination has its own set of binaries,
+headers, libraries, etc. So, it's usually simple to download a package
+with all files in, unzip to a directory and point the build system to
+that compiler, that will know about its location and find all it needs to
+when compiling your code.
+
+But Clang/LLVM is natively a cross-compiler, meaning that one set of
+programs can compile to all targets by setting the -target option. But that
+doesn't help finding the headers, libraries or binutils to generate
+target specific code. So you'll need special options to help Clang understand
+what target you're compiling to, where are your tools, etc.
+
----------------
Sean Silva wrote:
> These two paragraphs baffle me. It's basically like "Cross-compilation with GCC is easy, but clang arbitrarily doesn't do it that way and everything is therefore much more difficult". Is that really the message you're trying to get across? The way that this is written even makes the sentence "clang/llvm is natively a cross-compiler" sound like a weakness, rather than a strength.
> 
> Also, I'm not sure why it's necessary/relevant to devote a paragraph to how GCC does things; does that help the reader understand anything? It seems like the relevant comparison is with how native (i.e. non-cross) builds with Clang/LLVM find headers/libraries/tools/etc.
That was not my intention at all. I'll try to fix it.


http://llvm-reviews.chandlerc.com/D1606



More information about the cfe-commits mailing list