[PATCH] D68430: Don't use object libraries with Xcode

Chris Bieneman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 18:25:56 PDT 2019


beanz added a comment.

In D68430#1693964 <https://reviews.llvm.org/D68430#1693964>, @jordan_rose wrote:

> I'm not quite sure //what// it's doing. The executable targets end up trying to link against the static libraries anyway, which of course haven't been built. It's possible that this is because the LIBTYPE is both STATIC and OBJECT and if it were just OBJECT we might be better off, but I'm not sure if Xcode's IDE features will be happy with a target that doesn't actually produce a library. I can try it if you want, though.


I don't think that is necessary, it sounds like we just need to disable this functionality if Xcode is the build tool. That is unfortunate, but Xcode's build system is problematic to work with.

> (I did look at CMake's Xcode generator logic for OBJECT targets and it looks completely bonkers to me, as if it's still building the static library but then removing it to make sure it's not depended on or something. Even if it builds cleanly I don't trust it to do dependency analysis correctly.)

Fair. Unfortunately Xcode's build dependencies aren't as expressive as other build systems, which causes some unfortunate limitations on what it can do.

> 
> 
>> This has the side-effect of making `libclang_cpp` effectively empty when you build with Xcode.
> 
> I can remove that target if you want, or have it link the libraries normally.

clang_cpp can't link the libraries "normally" because it has no unresolved symbols to force the contents of the libraries to link. I don't like it, but I think the best option is to disable clang_cpp under Xcode. You can add `AND XCODE` to the `if` on line 2 of clang/tools/clang-shlib/CMakeLists.txt, and that should do the trick.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68430





More information about the cfe-commits mailing list