When building out-of-tree we need to use CLANG_DIR to find
installed Clang components.
Details
Diff Detail
- Repository
- rZORG LLVM Github Zorg
Event Timeline
This seems fine to me, but maybe @awarzynski can also have a look, since he knows the details of the new driver build better :)
@stevanradakovic , are LLVM, MLIR and Clang _installed_ or just _built_? Basically, CLANG_DIRneeds to point to a directory that contains AddClang.cmake. AFAIK, that script is not copied into the build directory (but it will be installed in CMAKE_INSTALL_PREFIX). Could you double check?
@awarzynski you're right it's not there. I have a local builder and it failed for this exact reason: http://ex40-01.tcwglab.linaro.org:8019/#/builders/16/builds/112
so what is the default value for CMAKE_INSTALL_PREFIX? is that where clang_dir should point to?
Yes, but CMAKE_INSTALL_PREFIX will be empty unless the install target is run, e.g. ninja install (or make install). Alternatively, AddClang.cmake could be copied into the build dir (similarly to AddLLVM.cmake and AddClang.cmake). Either should work. Previous effort in this direction: https://reviews.llvm.org/D94533.
@awarzynski Hm even after running ninja install it's still not found here. Even though in step 7 I can clearly see AddClang.cmake (line 2629). I thought the CLANG_DIR path was ambiguous but it's not.
I think the issue might be here: https://github.com/llvm/llvm-project/blob/7515e81e8c58ca07ac5fede7149634c0dfacae8a/flang/CMakeLists.txt#L52
We seem to be using CLANG_DIR directly, but for LLVM_DIR and MLIR_DIR we build absolute paths if needed.
@awarzynski, does this sound correct to you?
Thanks for looking into this! It sounds very plausible. Have you been able to test it?
I've also noticed that you're installing into the build dir (as opposed to some other, dedicated directory). I think that that should work fine (though I haven't checked), but it's possible that LLVM_DIR, MLIR_DIR and CLANG_DIR refer to build locations (which will work for LLVM and MLIR, but not for Clang). It's something that's worth double-checking.
@awarzynski no dice. The result is the same if I put the arbitrary install path http://ex40-01.tcwglab.linaro.org:8019/#/builders/16/builds/224
Noted, thanks for checking! @rovka's suggestion implemented here: https://reviews.llvm.org/D99088.
Great to see this progressing!
So is the CMake change not required then? Since https://reviews.llvm.org/D99088 hasn't been merged yet, and this already works.
Ah, makes sense :) Thanks for confirming. Great effort, really pleased to see this one working!
LGTM
PS Please could you double-check the latest version of https://reviews.llvm.org/D99088, it should be OK!