llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.93k stars 11.53k forks source link

Flang build fails on GitHub Action MacOS X86_64 runners #101789

Open tstellar opened 1 month ago

tstellar commented 1 month ago

I'm trying to do a release build with flang on the GitHub Action MacOS X86_64 runners and it is failing with this error:

[338/2224] Generating ../../../../include/flang/__fortran_builtins.mod
FAILED: include/flang/__fortran_builtins.mod /Users/runner/work/llvm-project/llvm-project/build/tools/clang/stage2-bins/include/flang/__fortran_builtins.mod 
cd /Users/runner/work/llvm-project/llvm-project/build/tools/clang/stage2-bins/tools/flang/tools/f18 && /usr/local/Cellar/cmake/3.30.1/bin/cmake -E make_directory /Users/runner/work/llvm-project/llvm-project/build/tools/clang/stage2-bins/include/flang && /Users/runner/work/llvm-project/llvm-project/build/tools/clang/stage2-bins/bin/flang-new -cpp -fsyntax-only -module-dir /Users/runner/work/llvm-project/llvm-project/build/tools/clang/stage2-bins/include/flang /Users/runner/work/llvm-project/llvm-project/flang/module/__fortran_builtins.f90
dyld[6699]: unknown imports format
/bin/sh: line 1:  6699 Abort trap: 6           /Users/runner/work/llvm-project/llvm-project/build/tools/clang/stage2-bins/bin/flang-new -cpp -fsyntax-only -module-dir /Users/runner/work/llvm-project/llvm-project/build/tools/clang/stage2-bins/include/flang /Users/runner/work/llvm-project/llvm-project/flang/module/__fortran_builtins.f90

I think it may be possible that this error is a symptom of running out of memory. Does this command use a lot of memory?

How To Reproduce

cmake -G Ninja -S llvm -B build \
      -DLLVM_RELEASE_ENABLE_PGO=OFF -DBOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF -DBOOTSTRAP_DARWIN_osx_ARCHS=x86_64 -DBOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=x86_64 \
      -C clang/cmake/caches/Release.cmake \
      -DBOOTSTRAP_LLVM_PARALLEL_LINK_JOBS=1 \
      -DBOOTSTRAP_CPACK_PACKAGE_FILE_NAME="LLVM-19.1.0-rc1-macOS-X64"

ninja -C build stage2-package
tstellar commented 1 month ago

I also noticed in some old logs this same command failing with the error:

'rebase opcodes terminated early at offset 1 of 80016'

So maybe this is an OOM issue.

klausler commented 1 month ago

I don't know what's happening, but OOM seems an unlikely hypothesis. Some build steps for flang-new require many times the memory that flang-new itself requires to compile a small Fortran source file, which it what was happening above. (In other words, if you had insufficient memory, there's no way you could get to this stage and only then fail due to OOM in normal operation.)

tstellar commented 1 month ago

The latest build I did of this configuration was successful: https://github.com/llvm/llvm-project/actions/runs/10182363159/job/28186519668