[PATCH] D41660: [cmake] Add new linux toolchain file

Don Hinton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 2 11:18:55 PST 2018


hintonda added a comment.

In https://reviews.llvm.org/D41660#965935, @hintonda wrote:

> In https://reviews.llvm.org/D41660#965877, @beanz wrote:
>
> > You should split the CMake cache file you created into two files, (1) a CMake Cache to manage the build configuration and (2) a tool chain file for targeting Linux. As @semeenai pointed out we absolutly want the behavior of the toolchain file being loaded multiple times. That is the correct way this build should work.
>
>
> I really like keeping this in a single file, but will break it up if necessary.
>
> The `if` part of the if/else is used in stage1 as a cache file, and the `else` part used in stage2 (and as you said, is loaded many times).  Splitting this into two files won't make much difference in that regard.
>
> > For bootstrap builds where you want the stage1 to run on your build host, you should be able to set `BOOTSTRAP_CMAKE_TOOLCHAIN_FILE` in the first stage build, to signal to the first stage build that the second stage will be cross-compiled, and we can customize the multi-stage dependencies correctly based on that. That avoids the need for the `ADDITIONAL_CLANG_BOOTSTRAP_DEPS` variable, which feels a bit hacky to me.
>
> Unless there's another way to do it, It's not hacky.  I believe the term is `escape hatch`.
>
> While I'm happy to use `BOOTSTRAP_CMAKE_TOOLCHAIN_FILE` instead of passing `-DCMAKE_TOOLCHAIN_FILE=${CMAKE_CURRENT_LIST_FILE}`, I do not see how it helps with this problem.  When running `ninja stage2`, I need to insure that the dependancies where built.  `BOOTSTRAP_LLVM_ENABLE_LLD` can be used to add `lld` to the dependency list, but since I'm setting `CLANG_DEFAULT_LINKER=llb`, I don't want clang adding `-fuse-ld`.


Did a quick test and setting BOOTSTRAP_CMAKE_TOOLCHAIN_FILE does not work in this case.

> If I run this on Linux for both stages, it doesn't matter, because clang/CMakeLists.txt add llvm-ar and llvm-ranlib automatically, but since I'm on APPLE (see clang/CMakeLists.txt:559), they don't get added.
> 
> So, how else would I add them?




Repository:
  rC Clang

https://reviews.llvm.org/D41660





More information about the cfe-commits mailing list