[PATCH] D71081: gn build: Add support for building scudo and its unit tests.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 07:44:40 PST 2019


thakis added a comment.

In D71081#1772598 <https://reviews.llvm.org/D71081#1772598>, @thakis wrote:

> I think the problem there is that on mac, libc++ headers are supposed to go with the compiler, and the stage1 clang in out/gn doesn't have libc++ headers installed next to it. The stage2_unix toolchain should depend on copying libc++ headers to the build output dir on macOS.
>
> For now I'll disable this on mac, but every other stage2_unix target that uses C++ headers will have the same problem. So hopefully I'll find time to fix this right soon.


I looked a this some. It's easy to add a dep on libc++ [1]. However, scudo still fails to build with errors like `../../compiler-rt/lib/scudo/standalone/common.h:155:11: error: unknown type name 'MapPlatformData'`, and nothing seems to define that type on non-Linux. Is scudo supposed to build on mac in the cmake build?

1:

  % git diff
  diff --git a/llvm/utils/gn/build/toolchain/BUILD.gn b/llvm/utils/gn/build/toolchain/BUILD.gn
  index b8e46034cca..9ebbe001d0b 100644
  --- a/llvm/utils/gn/build/toolchain/BUILD.gn
  +++ b/llvm/utils/gn/build/toolchain/BUILD.gn
  @@ -183,7 +183,9 @@ template("stage2_unix_toolchain") {
         "//:clang($host_toolchain)",
         "//:lld($host_toolchain)",
       ]
  -    if (current_os != "mac") {
  +    if (current_os == "mac") {
  +      deps += [ "//libcxx/include" ]
  +    } else {
         deps += [ "//:llvm-ar($host_toolchain)" ]
       }
     }
  diff --git a/llvm/utils/gn/secondary/compiler-rt/lib/scudo/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/scudo/BUILD.gn
  index a95613c5bcd..8c658837cd2 100644
  --- a/llvm/utils/gn/secondary/compiler-rt/lib/scudo/BUILD.gn
  +++ b/llvm/utils/gn/secondary/compiler-rt/lib/scudo/BUILD.gn
  @@ -1,11 +1,7 @@
   import("//llvm/utils/gn/build/toolchain/compiler.gni")
   
   supported_toolchains = []
  -# FIXME: On macOS, stage2_unix currently doesn't copy libc++ headers to
  -# the out dir, but clang relies on them on mac to compile code that uses C++
  -# standard library headers. scudo needs C++ standard library headers, so disable
  -# this on mac until stage2_unix correctly copies libc++ headers.
  -if (target_os != "win" && target_os != "mac")  {
  +if (target_os != "win")  {
     supported_toolchains += [ "//llvm/utils/gn/build/toolchain:stage2_unix" ]
   }
   if (android_ndk_path != "") {


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71081





More information about the llvm-commits mailing list