Skip to content

[flang] llvm 20 branch build broken on Windows #125152

@songdongsheng

Description

@songdongsheng

It can be confirmed that there is no problem in version 6087c30 . However, I don't have time to confirm that the problem occurred in that version.

First build clang and lld using MSVC:

    -DLLVM_ENABLE_PROJECTS="clang;lld" ^
    -DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx" ^

Use the built clang and lld to build more projects:

    -DLLVM_ENABLE_PROJECTS="llvm;clang;clang-tools-extra;openmp;lld;lldb;polly;mlir;flang" ^
    -DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx" ^

Then there is an error when building flang runtime:

E:\var\vcs\llvm-project-build_20.0.0-20250129\build64>ninja -j 1
[0/20] Performing build step for 'builtins'ninja: no work to do.

[1/20] No install step for 'builtins'
[4/20] Building CXX object tools\flang\runtime\CMakeFiles\FortranRuntime.static.dir\exceptions.cpp.obj
FAILED: tools/flang/runtime/CMakeFiles/FortranRuntime.static.dir/exceptions.cpp.obj
E:\var\vcs\llvm-project-build_20.0.0-20250129\build64_stage0\bin\clang-cl.exe  /nologo -TP -DFLANG_INCLUDE_TESTS=1 -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IE:\var\vcs\llvm-project-build_20.0.0-20250129\build64\tools\flang\runtime -IE:\var\vcs\llvm-project\flang\runtime -IE:\var\vcs\llvm-project\flang\include -IE:\var\vcs\llvm-project-build_20.0.0-20250129\build64\tools\flang\include -IE:\var\vcs\llvm-project-build_20.0.0-20250129\build64\include -IE:\var\vcs\llvm-project\llvm\include -imsvcE:\var\vcs\llvm-project\llvm\..\mlir\include -imsvcE:\var\vcs\llvm-project-build_20.0.0-20250129\build64\tools\mlir\include -imsvcE:\var\vcs\llvm-project-build_20.0.0-20250129\build64\tools\clang\include -imsvcE:\var\vcs\llvm-project\llvm\..\clang\include /DWIN32 /D_WINDOWS   /Zc:inline /Zc:__cplusplus /Oi /Brepro /bigobj /permissive- -Werror=unguarded-availability-new /W4  -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported /Gw -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -fno-lto /O2 /Ob2 /DNDEBUG -std:c++17 -MT   -U_GLIBCXX_ASSERTIONS -U_LIBCPP_ENABLE_ASSERTIONS  /EHs-c- /GR- /EHs-c- /GR- /EHs-c- /GR- /EHs-c- /GR- /EHs-c- /GR- /showIncludes /Fotools\flang\runtime\CMakeFiles\FortranRuntime.static.dir\exceptions.cpp.obj /Fdtools\flang\runtime\CMakeFiles\FortranRuntime.static.dir\FortranRuntime.static.pdb -c -- E:\var\vcs\llvm-project\flang\runtime\exceptions.cpp
E:\var\vcs\llvm-project\flang\runtime\exceptions.cpp(48,31): error: use of undeclared identifier '__FE_DENORM'
   48 |   static constexpr uint32_t s{__FE_DENORM}; // nonstandard, not a #define
      |                               ^
E:\var\vcs\llvm-project\flang\runtime\exceptions.cpp(64,29): error: constexpr variable 'map' must be initialized by a constant expression
   64 |   static constexpr uint32_t map[]{xm};
      |                             ^    ~~~~
E:\var\vcs\llvm-project\flang\runtime\exceptions.cpp(64,35): note: initializer of 's' is unknown
   64 |   static constexpr uint32_t map[]{xm};
      |                                   ^
E:\var\vcs\llvm-project\flang\runtime\exceptions.cpp(62,12): note: expanded from macro 'xm'
   62 | #define xm um(0), um(x)
      |            ^
E:\var\vcs\llvm-project\flang\runtime\exceptions.cpp(61,15): note: expanded from macro 'um'
   61 | #define um(p) om(p), om(p | u)
      |               ^
E:\var\vcs\llvm-project\flang\runtime\exceptions.cpp(60,15): note: expanded from macro 'om'
   60 | #define om(p) zm(p), zm(p | o)
      |               ^
E:\var\vcs\llvm-project\flang\runtime\exceptions.cpp(59,15): note: expanded from macro 'zm'
   59 | #define zm(p) sm(p), sm(p | z)
      |               ^
E:\var\vcs\llvm-project\flang\runtime\exceptions.cpp(58,29): note: expanded from macro 'sm'
   58 | #define sm(p) vm(p), vm(p | s)
      |                             ^
E:\var\vcs\llvm-project\flang\runtime\exceptions.cpp(48,29): note: declared here
   48 |   static constexpr uint32_t s{__FE_DENORM}; // nonstandard, not a #define
      |                             ^
2 errors generated.
ninja: build stopped: subcommand failed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions