Details
Diff Detail
Event Timeline
Hey @mgorny , thanks for working on this
I thought that this build configuration is actually tested by flang-aarch64-dylib, so I'm not sure why it fails for you. I suspect that you only have libclang.dylib available on your system? And the buildbot would still build libClangBasic.so/a as a separate library?
flang/lib/FrontendTool/CMakeLists.txt | ||
---|---|---|
18 | Where is TARGET defined? Please bear with me - I'm confused that in Flang (which only defines Flang CMake targets) we would be checking whether "target" is a particular Clang target? |
Yes, we don't install static clang libraries on Gentoo, and the buildbot probably has them (since the targets are present when doing in-tree build).
flang/lib/FrontendTool/CMakeLists.txt | ||
---|---|---|
18 | Unless I'm mistaken, if you're doing in-tree build of LLVM + Clang + Flang, then targets from other projects should be visible here. FWICS LLVM is ensuring that Clang is processed prior to Flang in all cases, so it should work. |
flang/lib/FrontendTool/CMakeLists.txt | ||
---|---|---|
18 | Sorry, I was not familiar with if (TARGET <target>), hence my question. For future reference, it's documented under CMake's existance checks. This makes sense, but I'm thinking that the following would be a bit more idiomatic. I'm also thinking that perhaps libclang-cpp should be added as a dependency too. if(CLANG_LINK_CLANG_DYLIB) add_dependencies(flangFrontendTool clangBasic) else() add_dependencies(flangFrontendTool clang-cpp) endif() CLANG_LINK_CLANG_DYLIB is defined whenever LLVM_LINK_LLVM_DYLIB is. So that ^^^ should be safe and always correct. WDYT? |
flang/lib/FrontendTool/CMakeLists.txt | ||
---|---|---|
18 | I suppose you meant if the other way around but yes, it should work. I'm going to try it right now and update the patch in a minute. |
Update to use CLANG_LINK_CLANG_DYLIB for the dependency, and to add a dep on clang-cpp alternatively to clangBasic.
Which build does this patch fix? My -DLLVM_ENABLE_PROJECTS='llvm;clang;mlir;flang' -DLLVM_LINK_LLVM_DYLIB=on build ninja check-flang works without this patch.
Note also that lldb has some clangBasic uses without the clang-cpp dispatch.
Ah, we should've looked at LLDB in search for inspiration - they do indeed have a nice solution :) I think that the approach in this patch is fine and we can improve things later (i.e. there's no rush). I created https://github.com/llvm/llvm-project/issues/58663 to track this. Thanks for the pointer @MaskRay !
Where is TARGET defined? Please bear with me - I'm confused that in Flang (which only defines Flang CMake targets) we would be checking whether "target" is a particular Clang target?