[PATCH] D98278: [test] Add ability to get error messages from CMake for errc substitution

Aaron Enye Shi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 18 10:52:37 PDT 2021


ashi1 added a comment.

In D98278#2618936 <https://reviews.llvm.org/D98278#2618936>, @zero9178 wrote:

> In D98278#2616932 <https://reviews.llvm.org/D98278#2616932>, @mstorsjo wrote:
>
>> In D98278#2616916 <https://reviews.llvm.org/D98278#2616916>, @zero9178 wrote:
>>
>>> Add GetErrcMessages.cmake, which contains a cmake function to automatically get the error messages of various posix error codes needed by lit by running a small C++ program.
>>> Currently ENOENT, EISDIR, EINVAL and EACCES are supplied. 
>>> These error messages are then currently supplied to clang, llvm and lld as the errc_messages config parameter.
>>>
>>> Regarding Cross compiling: the function uses try_run which when cross compiling may use the CMAKE_CROSSCOMPILING_EMULATOR to run the code.
>>
>> How does it behave if such a thing isn't hooked up? Ideally it'd fall back silently and these parts of tests would just fail, but not block things overall.
>
> It will fall back to using Python's strerror, potentially failing if pythons strerror would not return the same strings (only the case for MSVC I believe).

Hi, this patch is causing a failure when cmake runs `try_run()` with a `CMAKE_TOOLCHAIN_FILE` defined. It seems related to having a fall back if the try_run fails.
Here is the error, and the build uses MSVC. What do you think we could do about this? Thanks.

  [06:48:06][Step 1/4] CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately:
  [06:48:06][Step 1/4]    errc_exit_code (advanced)
  [06:48:06][Step 1/4]    errc_exit_code__TRYRUN_OUTPUT (advanced)
  [06:48:06][Step 1/4] For details see <manually removed>/TryRunResults.cmake


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98278



More information about the cfe-commits mailing list