[PATCH] D142279: [cmake] Use LLVM_ENABLE_ASSERTIONS to enable assertions in libstdc++

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 06:55:58 PST 2023


foad added a comment.

In D142279#4102125 <https://reviews.llvm.org/D142279#4102125>, @foad wrote:

> @mehdi_amini @rriddle the pre-merge checks for this patch seem to consistently fail `MLIR :: Examples/standalone/test.toy` but I can't see why and I can't reproduce it locally, even if I follow the "Reproduce build locally" instructions from the builder. Do you have any ideas? Thanks.

I can reproduce the failure now (I think I somehow missed the cmake option -DLLVM_BUILD_EXAMPLES=ON). I don't know much about cmake, but the problem seems to be that the `LLVMConfig.cmake` generated in the build directory contains:

  set(LLVM_DEFINITIONS "-DBUILD_EXAMPLES -D_GNU_SOURCE -D_DEBUG -D$<$<COMPILE_LANGUAGE:CXX>:_GLIBCXX_ASSERTIONS> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS")

Note that it contains an unevaluated generator expression, which I //think// is a problem. There is some discussion here <https://stackoverflow.com/questions/51283000/generator-expression-in-configure-file> which suggests you could use `file(GENERATE ...)` instead of `configure_file(...)` to create `LLVMConfig.cmake`, but I'm not prepared to tackle that.

For completeness there are also some cmake bug reports including this one <https://gitlab.kitware.com/cmake/cmake/-/issues/21647> which might explain how the string containing the unevaluated generator expression is not correctly escaped when cmake uses it in a ninja build, leading to the ninja syntax error:

  ninja: error: build.ninja:621: bad $-escape (literal $ must be written as $$)

I'm going to avoid all of this by not using generator expressions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142279



More information about the llvm-commits mailing list