If libcxxabi is not included CMake will error out:
Cannot find target libcxxabi-SHARED
I ran into this doing the 15.0.0 release
Differential D133475
[docs] Fix build-docs.sh thieta on Sep 8 2022, 12:20 AM. Authored by
Details
If libcxxabi is not included CMake will error out: Cannot find target libcxxabi-SHARED I ran into this doing the 15.0.0 release
Diff Detail
Event TimelineComment Actions This is weird, I just tried locally and I don't get the same issue. Does it reproduce for you when running this from the root of the monorepo? For me, it doesn't. mkdir -p build cmake -S runtimes -B build -GNinja \ -DLLVM_ENABLE_RUNTIMES="libcxx" \ -DLLVM_ENABLE_SPHINX=ON \ -DSPHINX_WARNINGS_AS_ERRORS=OFF ninja -C build docs-libcxx-html I'm not against the change, but I'd like to understand what's going on instead of blindly hiding the issue. Comment Actions I ran the exact same commands: CMake Error at /home/tobias/code/llvm-project/libcxx/src/CMakeLists.txt:261 (add_custom_command): Error evaluating generator expression: $<TARGET_PROPERTY:libcxx-abi-shared,IMPORTED_LIBNAME> Target "libcxx-abi-shared" not found. CMake Error at /home/tobias/code/llvm-project/libcxx/src/CMakeLists.txt:261 (add_custom_command): Error evaluating generator expression: $<TARGET_PROPERTY:libcxx-abi-shared,IMPORTED_LIBNAME> Target "libcxx-abi-shared" not found. Could it be linux specific issue? Comment Actions @ldionne any ideas? would like to fix this before 15.0.1 next week so I don't have to manually build the docs. Comment Actions Okay, I looked into it and the issue is basically that libcxx-abi-shared does not exist when libcxxabi is not in LLVM_ENABLE_RUNTIMES. That's normally okay, except when we generate a linker script in place of libc++.so (aka on Linux), since that requires resolving the ABI library's target to know to add -lc++abi. I would normally expect that generator expressions inside the linker script generation are only evaluated if we actually perform the POST_BUILD step it's associated to, but that's not how CMake works. It seems to eagerly evaluate the generator expressions, leading to problems since at least one of them is invalid. Potential fixes:
(2) seems like a lot of breakage and user-facing complexity for little to no benefit. Therefore, I conclude that the best way forward would be (1). I also think it's kind of weird to do that, but all the other options really don't make sense to me. So as far as I'm concerned, you can ship this to unblock you in the short term. However, I'll look into doing (1) and landing that for LLVM 16. Comment Actions I have solved similar problems in CMake before by having a separate script that's called from POST_BUILD with cmake -E script <script_path> where the script can be configured with a configure_file() in cmake to inject variables. It's not great, but it's a working portable solution.
I think you are right - but it would have to be logged as a warning I think.
Thanks, will do. |