[PATCH] D119804: [docs] HowToCrossCompileLLVM.rst: update cmake options

Siwei Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 19 05:29:28 PST 2022


fourdim added a comment.

In D119804#3333467 <https://reviews.llvm.org/D119804#3333467>, @rengolin wrote:

> In D119804#3333462 <https://reviews.llvm.org/D119804#3333462>, @rengolin wrote:
>
>> I think you forgot to upload the new diff for the GCC comment. It's looking the same as before for me.
>
> Hm, there wasn't any. But I did get a comment on the email that I wanted to reply to and it isn't here. Won't change the acceptance of the patch, it's more as FYI.
>
>> If you're compiling with GCC, you can use architecture options for your target, and the compiler driver will detect everything that it needs
>
> This is a common thread between Clang and GCC.
>
> In GCC, the target is defined at compile time, so if you use `target-gcc`, all of the options are already chosen. Paths, headers, libraries, even sysroot is already set.
>
> Clang also has `target-clang` (as a symlink to `clang`), but that's a shortcut to `clang -target target`, which may have some headers but doesn't have libraries, sysroot and may not get the right path (if the platform compiler is GCC and compiled in unexpected ways).
>
> That is why we need the other flags and why this document was written in the first place.
>
> We have debated for years if we want to have a default LLVM sysroot+libs+headers, and some side projects have started in that direction, but we shouldn't use a different toolchain from the system one if we want to link with objects compiled with the system compiler (statically or dynamically).
>
> In FreeBSD, Apple and OpenMandriva, Android, the system compiler is clang, so all libraries, paths and the sysroot should be easy to find and known, and clang does what you expect, too.
>
> But on other Linux distros, Windows and systems where the system toolchain isn't clang, you'll have that problem again.

Well, that seems a great challenge. Hope we will achieve that soon.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119804/new/

https://reviews.llvm.org/D119804



More information about the llvm-commits mailing list