Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flang fails to build with Semantic errors in omp_lib.F90 ... Cannot read module file for #90769

Closed
sylvestre opened this issue May 1, 2024 · 21 comments
Assignees
Labels
build-problem flang Flang issues not falling into any other category offload openmp

Comments

@sylvestre
Copy link
Collaborator

since the move of offload, it is failing to build with:


FAILED: openmp/runtime/src/omp_lib.mod openmp/runtime/src/omp_lib_kinds.mod /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/runtimes/runtimes-bins/openmp/runtime/src/omp_lib.mod /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/runtimes/runtimes-bins/openmp/runtime/src/omp_lib_kinds.mod
cd /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/runtimes/runtimes-bins/openmp/runtime/src && /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/bin/flang-new -cpp -fsyntax-only omp_lib.F90
error: Semantic errors in omp_lib.F90
./omp_lib.F90:15:27: error: Cannot read module file for module 'iso_c_binding': Source file 'iso_c_binding.mod' was not found
          use, intrinsic :: iso_c_binding
                            ^^^^^^^^^^^^^
./omp_lib.F90:21:64: error: Must be a constant value
          integer, parameter, public :: omp_integer_kind       = c_int
                                                                 ^^^^^
./omp_lib.F90:23:64: error: Must be a constant value
          integer, parameter, public :: omp_real_kind          = c_float
                                                                 ^^^^^^^
./omp_lib.F90:24:64: error: Must be a constant value
          integer, parameter, public :: kmp_double_kind        = c_double
                                                                 ^^^^^^^^


 cmake -S ../llvm/ -B build-llvm \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-19 \
-DLLVM_VERSION_SUFFIX= \
-DCMAKE_SUPPRESS_REGENERATION=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
-DCMAKE_CXX_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DPACKAGE_VENDOR=Debian \
-DENABLE_LINKER_BUILD_ID=ON \
-DLLVM_TARGETS_TO_BUILD=Native \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;cross-project-tests;mlir;bolt;flang;polly;lldb" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libc;libunwind;openmp;offload" \
-DLLVM_ENABLE_PIC=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_BUILD_DOCS=OFF \
-DLLVM_INCLUDE_GO_TESTS=OFF \
-DLLVM_USE_RELATIVE_PATHS_IN_FILES=ON \
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
-DLLVM_ENABLE_CURL=ON \
-DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=ON \
-DCLANG_PLUGIN_SUPPORT=OFF \
-DCLANG_BUILD_EXAMPLES=OFF \
-DCLANG_DEFAULT_LINKER=ld \
-DCLANG_DEFAULT_RTLIB=libgcc \
-DCOMPILER_RT_BUILD_XRAY=OFF \
-DCOMPILER_RT_INCLUDE_TESTS=OFF \
-DCOMPILER_RT_USE_LIBCXX=OFF \
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
-DLIBUNWIND_INSTALL_LIBRARY=OFF \
-DLIBCXXABI_ENABLE_EXCEPTIONS=ON \
-DLIBCXXABI_USE_COMPILER_RT=ON \
-DLIBCXXABI_INSTALL_LIBRARY=OFF \
-DLIBCXX_ENABLE_EXCEPTIONS=ON \
-DLIBCXX_USE_COMPILER_RT=ON \
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \
-DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF \
-DLIBCXX_INSTALL_LIBRARY=OFF \
-DLIBCXX_INSTALL_MODULES=ON \
-DLLVM_LIBC_GPU_BUILD=ON \
-DBOOTSTRAP_LIBCXX_INSTALL_MODULES=ON \
-DOPENMP_ENABLE_LIBOMP_PROFILING=OFF \
-DOPENMP_ENABLE_LIBOMPTARGET_PROFILING=OFF \
-DLIBOMP_ENABLE_RTTI=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DCLANG_FORCE_MATCHING_LIBCLANG_SOVERSION=ON \
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
-DCMAKE_C_COMPILER_LAUNCHER=/opt/sccache//sccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/sccache//sccache -DLLVM_USE_LINKER=gold -DLLVM_BINUTILS_INCDIR=/usr/include/ -DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBOMP_LIBFLAGS="-lm" -DOPENMP_USE_LLVM_UNWINDER=ON -DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF -DLLDB_ENABLE_LUA=OFF \
-DBUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
-DRUNTIMES_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
-DCLANG_ENABLE_BOOTSTRAP=ON \
-DCLANG_BOOTSTRAP_TARGETS="check-all;check-llvm;check-clang;check-clang-tools;check-lld;check-libcxx;check-libcxxabi;check-mlir;check-libc;check-sanitizer;llvm-config;test-suite" \
-DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_SUPPRESS_REGENERATION;ENABLE_LINKER_BUILD_ID;LLVM_ENABLE_PIC;LLVM_ENABLE_RTTI;LLVM_INCLUDE_GO_TESTS;LLVM_USE_RELATIVE_PATHS_IN_FILES;CLANG_DEFAULT_LINKER;CLANG_DEFAULT_CXX_STDLIB;CLANG_DEFAULT_RTLIB;COMPILER_RT_USE_LIBCXX;COMPILER_RT_USE_BUILTINS_LIBRARY;COMPILER_RT_DEFAULT_TARGET_ONLY;COMPILER_RT_INCLUDE_TESTS;LIBUNWIND_USE_COMPILER_RT;LIBCXXABI_ENABLE_EXCEPTIONS;LIBCXXABI_USE_COMPILER_RT;LIBCXX_USE_COMPILER_RT;LIBCXX_ENABLE_EXCEPTIONS;LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY;LIBOMP_ENABLE_RTTI;LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN;CLANG_FORCE_MATCHING_LIBCLANG_SOVERSION;CMAKE_C_COMPILER_LAUNCHER;CMAKE_CXX_COMPILER_LAUNCHER;LLVM_LIBC_GPU_BUILD" \
-DBOOTSTRAP_CMAKE_BUILD_TYPE=RelWithDebInfo \
-DBOOTSTRAP_CMAKE_C_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1" \
-DBOOTSTRAP_CMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1" \
-DBOOTSTRAP_CMAKE_C_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
-DBOOTSTRAP_CMAKE_CXX_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
-DBOOTSTRAP_CMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DBOOTSTRAP_CMAKE_MODULE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DBOOTSTRAP_CMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DBOOTSTRAP_LLVM_ENABLE_FFI=ON \
-DBOOTSTRAP_LLVM_ENABLE_DUMP=ON \
-DBOOTSTRAP_LLVM_ENABLE_LIBPFM=ON \
-DBOOTSTRAP_LLVM_ENABLE_SPHINX=ON \
-DBOOTSTRAP_CLANG_DEFAULT_PIE_ON_LINUX=ON \
-DBOOTSTRAP_SPHINX_WARNINGS_AS_ERRORS=OFF \
-DBOOTSTRAP_LLVM_USE_RELATIVE_PATHS_IN_FILES=ON \
-DBOOTSTRAP_LLVM_INSTALL_UTILS=ON \
-DBOOTSTRAP_LLVM_VERSION_SUFFIX= \
-DBOOTSTRAP_LLVM_POLLY_LINK_INTO_TOOLS=ON \
-DBOOTSTRAP_LLVM_EXPERIMENTAL_TARGETS_TO_BUILD="M68k;Xtensa" \
-DBOOTSTRAP_LLVM_LINK_LLVM_DYLIB=ON \
-DBOOTSTRAP_LLVM_ENABLE_CURL=ON \
-DBOOTSTRAP_CLANG_LINK_CLANG_DYLIB=ON \
-DBOOTSTRAP_LIBCLANG_LIBRARY_VERSION=1 \
-DBOOTSTRAP_LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON \
-DBOOTSTRAP_PYTHON_EXECUTABLE=/usr/bin/python3 \
 -DBOOTSTRAP_CLANG_REPOSITORY_STRING=++20240501043318+be5075ab8daf-1~exp1  -DBOOTSTRAP_LLVM_ENABLE_Z3_SOLVER=ON  -DBOOTSTRAP_CLANG_SYSTEMZ_DEFAULT_ARCH=z196  -DBOOTSTRAP_CLANGD_ENABLE_REMOTE=ON  -DBOOTSTRAP_LLVM_USE_PERF=ON  -DBOOTSTRAP_LLVM_ENABLE_LIBPFM=ON  -DBOOTSTRAP_LLVM_USE_LINKER=gold  -DBOOTSTRAP_LLVM_BINUTILS_INCDIR=/usr/include/  -DBOOTSTRAP_LIBCXXABI_USE_LLVM_UNWINDER=ON  -DBOOTSTRAP_LIBOMP_LIBFLAGS="-lm"  -DBOOTSTRAP_OPENMP_USE_LLVM_UNWINDER=ON  -DBOOTSTRAP_MLIR_INSTALL_AGGREGATE_OBJECTS=OFF  -DBOOTSTRAP_LLDB_ENABLE_LUA=OFF \
-DBOOTSTRAP_BUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
-DBOOTSTRAP_RUNTIMES_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF"
VERBOSE=1  cmake --build build-llvm -j 20 --target stage2

@jdoerfert @jhuber6 probably the move to offload too

@sylvestre sylvestre added openmp build-problem flang Flang issues not falling into any other category offload labels May 1, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented May 1, 2024

@llvm/issue-subscribers-openmp

Author: Sylvestre Ledru (sylvestre)

since the move of offload, it is failing to build with: ```

FAILED: openmp/runtime/src/omp_lib.mod openmp/runtime/src/omp_lib_kinds.mod /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/runtimes/runtimes-bins/openmp/runtime/src/omp_lib.mod /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/runtimes/runtimes-bins/openmp/runtime/src/omp_lib_kinds.mod
cd /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/runtimes/runtimes-bins/openmp/runtime/src && /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/bin/flang-new -cpp -fsyntax-only omp_lib.F90
error: Semantic errors in omp_lib.F90
./omp_lib.F90:15:27: error: Cannot read module file for module 'iso_c_binding': Source file 'iso_c_binding.mod' was not found
use, intrinsic :: iso_c_binding
^^^^^^^^^^^^^
./omp_lib.F90:21:64: error: Must be a constant value
integer, parameter, public :: omp_integer_kind = c_int
^^^^^
./omp_lib.F90:23:64: error: Must be a constant value
integer, parameter, public :: omp_real_kind = c_float
^^^^^^^
./omp_lib.F90:24:64: error: Must be a constant value
integer, parameter, public :: kmp_double_kind = c_double
^^^^^^^^


cmake -S ../llvm/ -B build-llvm
-G Ninja
-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-19
-DLLVM_VERSION_SUFFIX=
-DCMAKE_SUPPRESS_REGENERATION=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2"
-DCMAKE_CXX_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2"
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DPACKAGE_VENDOR=Debian
-DENABLE_LINKER_BUILD_ID=ON
-DLLVM_TARGETS_TO_BUILD=Native
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;cross-project-tests;mlir;bolt;flang;polly;lldb"
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libc;libunwind;openmp;offload"
-DLLVM_ENABLE_PIC=ON
-DLLVM_ENABLE_RTTI=ON
-DLLVM_BUILD_DOCS=OFF
-DLLVM_INCLUDE_GO_TESTS=OFF
-DLLVM_USE_RELATIVE_PATHS_IN_FILES=ON
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON
-DLLVM_ENABLE_CURL=ON
-DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=ON
-DCLANG_PLUGIN_SUPPORT=OFF
-DCLANG_BUILD_EXAMPLES=OFF
-DCLANG_DEFAULT_LINKER=ld
-DCLANG_DEFAULT_RTLIB=libgcc
-DCOMPILER_RT_BUILD_XRAY=OFF
-DCOMPILER_RT_INCLUDE_TESTS=OFF
-DCOMPILER_RT_USE_LIBCXX=OFF
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON
-DLIBUNWIND_INSTALL_LIBRARY=OFF
-DLIBCXXABI_ENABLE_EXCEPTIONS=ON
-DLIBCXXABI_USE_COMPILER_RT=ON
-DLIBCXXABI_INSTALL_LIBRARY=OFF
-DLIBCXX_ENABLE_EXCEPTIONS=ON
-DLIBCXX_USE_COMPILER_RT=ON
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON
-DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF
-DLIBCXX_INSTALL_LIBRARY=OFF
-DLIBCXX_INSTALL_MODULES=ON
-DLLVM_LIBC_GPU_BUILD=ON
-DBOOTSTRAP_LIBCXX_INSTALL_MODULES=ON
-DOPENMP_ENABLE_LIBOMP_PROFILING=OFF
-DOPENMP_ENABLE_LIBOMPTARGET_PROFILING=OFF
-DLIBOMP_ENABLE_RTTI=OFF
-DLIBOMP_OMPT_SUPPORT=OFF
-DCLANG_FORCE_MATCHING_LIBCLANG_SOVERSION=ON
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
-DCMAKE_C_COMPILER_LAUNCHER=/opt/sccache//sccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/sccache//sccache -DLLVM_USE_LINKER=gold -DLLVM_BINUTILS_INCDIR=/usr/include/ -DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBOMP_LIBFLAGS="-lm" -DOPENMP_USE_LLVM_UNWINDER=ON -DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF -DLLDB_ENABLE_LUA=OFF
-DBUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF"
-DRUNTIMES_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF"
-DCLANG_ENABLE_BOOTSTRAP=ON
-DCLANG_BOOTSTRAP_TARGETS="check-all;check-llvm;check-clang;check-clang-tools;check-lld;check-libcxx;check-libcxxabi;check-mlir;check-libc;check-sanitizer;llvm-config;test-suite"
-DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_SUPPRESS_REGENERATION;ENABLE_LINKER_BUILD_ID;LLVM_ENABLE_PIC;LLVM_ENABLE_RTTI;LLVM_INCLUDE_GO_TESTS;LLVM_USE_RELATIVE_PATHS_IN_FILES;CLANG_DEFAULT_LINKER;CLANG_DEFAULT_CXX_STDLIB;CLANG_DEFAULT_RTLIB;COMPILER_RT_USE_LIBCXX;COMPILER_RT_USE_BUILTINS_LIBRARY;COMPILER_RT_DEFAULT_TARGET_ONLY;COMPILER_RT_INCLUDE_TESTS;LIBUNWIND_USE_COMPILER_RT;LIBCXXABI_ENABLE_EXCEPTIONS;LIBCXXABI_USE_COMPILER_RT;LIBCXX_USE_COMPILER_RT;LIBCXX_ENABLE_EXCEPTIONS;LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY;LIBOMP_ENABLE_RTTI;LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN;CLANG_FORCE_MATCHING_LIBCLANG_SOVERSION;CMAKE_C_COMPILER_LAUNCHER;CMAKE_CXX_COMPILER_LAUNCHER;LLVM_LIBC_GPU_BUILD"
-DBOOTSTRAP_CMAKE_BUILD_TYPE=RelWithDebInfo
-DBOOTSTRAP_CMAKE_C_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1"
-DBOOTSTRAP_CMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1"
-DBOOTSTRAP_CMAKE_C_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2"
-DBOOTSTRAP_CMAKE_CXX_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2"
-DBOOTSTRAP_CMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DBOOTSTRAP_CMAKE_MODULE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DBOOTSTRAP_CMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DBOOTSTRAP_LLVM_ENABLE_FFI=ON
-DBOOTSTRAP_LLVM_ENABLE_DUMP=ON
-DBOOTSTRAP_LLVM_ENABLE_LIBPFM=ON
-DBOOTSTRAP_LLVM_ENABLE_SPHINX=ON
-DBOOTSTRAP_CLANG_DEFAULT_PIE_ON_LINUX=ON
-DBOOTSTRAP_SPHINX_WARNINGS_AS_ERRORS=OFF
-DBOOTSTRAP_LLVM_USE_RELATIVE_PATHS_IN_FILES=ON
-DBOOTSTRAP_LLVM_INSTALL_UTILS=ON
-DBOOTSTRAP_LLVM_VERSION_SUFFIX=
-DBOOTSTRAP_LLVM_POLLY_LINK_INTO_TOOLS=ON
-DBOOTSTRAP_LLVM_EXPERIMENTAL_TARGETS_TO_BUILD="M68k;Xtensa"
-DBOOTSTRAP_LLVM_LINK_LLVM_DYLIB=ON
-DBOOTSTRAP_LLVM_ENABLE_CURL=ON
-DBOOTSTRAP_CLANG_LINK_CLANG_DYLIB=ON
-DBOOTSTRAP_LIBCLANG_LIBRARY_VERSION=1
-DBOOTSTRAP_LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON
-DBOOTSTRAP_PYTHON_EXECUTABLE=/usr/bin/python3
-DBOOTSTRAP_CLANG_REPOSITORY_STRING=++20240501043318+be5075ab8daf-1exp1 -DBOOTSTRAP_LLVM_ENABLE_Z3_SOLVER=ON -DBOOTSTRAP_CLANG_SYSTEMZ_DEFAULT_ARCH=z196 -DBOOTSTRAP_CLANGD_ENABLE_REMOTE=ON -DBOOTSTRAP_LLVM_USE_PERF=ON -DBOOTSTRAP_LLVM_ENABLE_LIBPFM=ON -DBOOTSTRAP_LLVM_USE_LINKER=gold -DBOOTSTRAP_LLVM_BINUTILS_INCDIR=/usr/include/ -DBOOTSTRAP_LIBCXXABI_USE_LLVM_UNWINDER=ON -DBOOTSTRAP_LIBOMP_LIBFLAGS="-lm" -DBOOTSTRAP_OPENMP_USE_LLVM_UNWINDER=ON -DBOOTSTRAP_MLIR_INSTALL_AGGREGATE_OBJECTS=OFF -DBOOTSTRAP_LLDB_ENABLE_LUA=OFF
-DBOOTSTRAP_BUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF"
-DBOOTSTRAP_RUNTIMES_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19
++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF"

VERBOSE=1 cmake --build build-llvm -j 20 --target stage2


@<!-- -->jdoerfert @<!-- -->jhuber6 probably the move to offload too

</details>

@llvmbot
Copy link
Collaborator

llvmbot commented May 1, 2024

@llvm/issue-subscribers-offload

Author: Sylvestre Ledru (sylvestre)

since the move of offload, it is failing to build with: ```

FAILED: openmp/runtime/src/omp_lib.mod openmp/runtime/src/omp_lib_kinds.mod /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/runtimes/runtimes-bins/openmp/runtime/src/omp_lib.mod /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/runtimes/runtimes-bins/openmp/runtime/src/omp_lib_kinds.mod
cd /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/runtimes/runtimes-bins/openmp/runtime/src && /home/sylvestre/dev/debian/pkg-llvm/llvm-toolchain/branches/llvm-project/build/build-llvm/bin/flang-new -cpp -fsyntax-only omp_lib.F90
error: Semantic errors in omp_lib.F90
./omp_lib.F90:15:27: error: Cannot read module file for module 'iso_c_binding': Source file 'iso_c_binding.mod' was not found
use, intrinsic :: iso_c_binding
^^^^^^^^^^^^^
./omp_lib.F90:21:64: error: Must be a constant value
integer, parameter, public :: omp_integer_kind = c_int
^^^^^
./omp_lib.F90:23:64: error: Must be a constant value
integer, parameter, public :: omp_real_kind = c_float
^^^^^^^
./omp_lib.F90:24:64: error: Must be a constant value
integer, parameter, public :: kmp_double_kind = c_double
^^^^^^^^


cmake -S ../llvm/ -B build-llvm
-G Ninja
-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-19
-DLLVM_VERSION_SUFFIX=
-DCMAKE_SUPPRESS_REGENERATION=ON
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2"
-DCMAKE_CXX_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2"
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DPACKAGE_VENDOR=Debian
-DENABLE_LINKER_BUILD_ID=ON
-DLLVM_TARGETS_TO_BUILD=Native
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;cross-project-tests;mlir;bolt;flang;polly;lldb"
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libc;libunwind;openmp;offload"
-DLLVM_ENABLE_PIC=ON
-DLLVM_ENABLE_RTTI=ON
-DLLVM_BUILD_DOCS=OFF
-DLLVM_INCLUDE_GO_TESTS=OFF
-DLLVM_USE_RELATIVE_PATHS_IN_FILES=ON
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON
-DLLVM_ENABLE_CURL=ON
-DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=ON
-DCLANG_PLUGIN_SUPPORT=OFF
-DCLANG_BUILD_EXAMPLES=OFF
-DCLANG_DEFAULT_LINKER=ld
-DCLANG_DEFAULT_RTLIB=libgcc
-DCOMPILER_RT_BUILD_XRAY=OFF
-DCOMPILER_RT_INCLUDE_TESTS=OFF
-DCOMPILER_RT_USE_LIBCXX=OFF
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON
-DLIBUNWIND_INSTALL_LIBRARY=OFF
-DLIBCXXABI_ENABLE_EXCEPTIONS=ON
-DLIBCXXABI_USE_COMPILER_RT=ON
-DLIBCXXABI_INSTALL_LIBRARY=OFF
-DLIBCXX_ENABLE_EXCEPTIONS=ON
-DLIBCXX_USE_COMPILER_RT=ON
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON
-DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF
-DLIBCXX_INSTALL_LIBRARY=OFF
-DLIBCXX_INSTALL_MODULES=ON
-DLLVM_LIBC_GPU_BUILD=ON
-DBOOTSTRAP_LIBCXX_INSTALL_MODULES=ON
-DOPENMP_ENABLE_LIBOMP_PROFILING=OFF
-DOPENMP_ENABLE_LIBOMPTARGET_PROFILING=OFF
-DLIBOMP_ENABLE_RTTI=OFF
-DLIBOMP_OMPT_SUPPORT=OFF
-DCLANG_FORCE_MATCHING_LIBCLANG_SOVERSION=ON
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF
-DCMAKE_C_COMPILER_LAUNCHER=/opt/sccache//sccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/sccache//sccache -DLLVM_USE_LINKER=gold -DLLVM_BINUTILS_INCDIR=/usr/include/ -DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBOMP_LIBFLAGS="-lm" -DOPENMP_USE_LLVM_UNWINDER=ON -DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF -DLLDB_ENABLE_LUA=OFF
-DBUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF"
-DRUNTIMES_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF"
-DCLANG_ENABLE_BOOTSTRAP=ON
-DCLANG_BOOTSTRAP_TARGETS="check-all;check-llvm;check-clang;check-clang-tools;check-lld;check-libcxx;check-libcxxabi;check-mlir;check-libc;check-sanitizer;llvm-config;test-suite"
-DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_SUPPRESS_REGENERATION;ENABLE_LINKER_BUILD_ID;LLVM_ENABLE_PIC;LLVM_ENABLE_RTTI;LLVM_INCLUDE_GO_TESTS;LLVM_USE_RELATIVE_PATHS_IN_FILES;CLANG_DEFAULT_LINKER;CLANG_DEFAULT_CXX_STDLIB;CLANG_DEFAULT_RTLIB;COMPILER_RT_USE_LIBCXX;COMPILER_RT_USE_BUILTINS_LIBRARY;COMPILER_RT_DEFAULT_TARGET_ONLY;COMPILER_RT_INCLUDE_TESTS;LIBUNWIND_USE_COMPILER_RT;LIBCXXABI_ENABLE_EXCEPTIONS;LIBCXXABI_USE_COMPILER_RT;LIBCXX_USE_COMPILER_RT;LIBCXX_ENABLE_EXCEPTIONS;LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY;LIBOMP_ENABLE_RTTI;LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN;CLANG_FORCE_MATCHING_LIBCLANG_SOVERSION;CMAKE_C_COMPILER_LAUNCHER;CMAKE_CXX_COMPILER_LAUNCHER;LLVM_LIBC_GPU_BUILD"
-DBOOTSTRAP_CMAKE_BUILD_TYPE=RelWithDebInfo
-DBOOTSTRAP_CMAKE_C_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1"
-DBOOTSTRAP_CMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1"
-DBOOTSTRAP_CMAKE_C_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2"
-DBOOTSTRAP_CMAKE_CXX_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2"
-DBOOTSTRAP_CMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DBOOTSTRAP_CMAKE_MODULE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DBOOTSTRAP_CMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id"
-DBOOTSTRAP_LLVM_ENABLE_FFI=ON
-DBOOTSTRAP_LLVM_ENABLE_DUMP=ON
-DBOOTSTRAP_LLVM_ENABLE_LIBPFM=ON
-DBOOTSTRAP_LLVM_ENABLE_SPHINX=ON
-DBOOTSTRAP_CLANG_DEFAULT_PIE_ON_LINUX=ON
-DBOOTSTRAP_SPHINX_WARNINGS_AS_ERRORS=OFF
-DBOOTSTRAP_LLVM_USE_RELATIVE_PATHS_IN_FILES=ON
-DBOOTSTRAP_LLVM_INSTALL_UTILS=ON
-DBOOTSTRAP_LLVM_VERSION_SUFFIX=
-DBOOTSTRAP_LLVM_POLLY_LINK_INTO_TOOLS=ON
-DBOOTSTRAP_LLVM_EXPERIMENTAL_TARGETS_TO_BUILD="M68k;Xtensa"
-DBOOTSTRAP_LLVM_LINK_LLVM_DYLIB=ON
-DBOOTSTRAP_LLVM_ENABLE_CURL=ON
-DBOOTSTRAP_CLANG_LINK_CLANG_DYLIB=ON
-DBOOTSTRAP_LIBCLANG_LIBRARY_VERSION=1
-DBOOTSTRAP_LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON
-DBOOTSTRAP_PYTHON_EXECUTABLE=/usr/bin/python3
-DBOOTSTRAP_CLANG_REPOSITORY_STRING=++20240501043318+be5075ab8daf-1exp1 -DBOOTSTRAP_LLVM_ENABLE_Z3_SOLVER=ON -DBOOTSTRAP_CLANG_SYSTEMZ_DEFAULT_ARCH=z196 -DBOOTSTRAP_CLANGD_ENABLE_REMOTE=ON -DBOOTSTRAP_LLVM_USE_PERF=ON -DBOOTSTRAP_LLVM_ENABLE_LIBPFM=ON -DBOOTSTRAP_LLVM_USE_LINKER=gold -DBOOTSTRAP_LLVM_BINUTILS_INCDIR=/usr/include/ -DBOOTSTRAP_LIBCXXABI_USE_LLVM_UNWINDER=ON -DBOOTSTRAP_LIBOMP_LIBFLAGS="-lm" -DBOOTSTRAP_OPENMP_USE_LLVM_UNWINDER=ON -DBOOTSTRAP_MLIR_INSTALL_AGGREGATE_OBJECTS=OFF -DBOOTSTRAP_LLDB_ENABLE_LUA=OFF
-DBOOTSTRAP_BUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF"
-DBOOTSTRAP_RUNTIMES_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19
++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF"

VERBOSE=1 cmake --build build-llvm -j 20 --target stage2


@<!-- -->jdoerfert @<!-- -->jhuber6 probably the move to offload too

</details>

@jhuber6
Copy link
Contributor

jhuber6 commented May 2, 2024

@mjklemm Any guesses here? I don't know anything about Fortran.

@mjklemm
Copy link
Contributor

mjklemm commented May 2, 2024

Hm. That's interesting. Does iso_c_binding.mod exist in flang/include/flang?

@sylvestre
Copy link
Collaborator Author

@mjklemm flang/module/iso_c_binding.f90 is the closest thing we have

@mjklemm
Copy link
Contributor

mjklemm commented May 3, 2024

@mjklemm flang/module/iso_c_binding.f90 is the closest thing we have

Ok. Thanks for checking. That means for some reason, Flang is not compiling iso_c_binding.f90. I will try to replicate this on my machine today.

@mjklemm
Copy link
Contributor

mjklemm commented May 3, 2024

I have tried to replicate this with a recent SHA on main and my development system. I only see an issue with GOLD having trouble:

FAILED: bin/merge-fdata 
: && /usr/bin/c++ -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fdebug-prefix-map=/work1/micklemm/builds/build-debian=../../../../home/micklemm/projects/llvm/llvm-project -fdebug-prefix-map=/home/micklemm/projects/llvm/llvm-project/= -no-canonical-prefixes -ffile-prefix-map=/work1/micklemm/builds/build-debian=../../../../home/micklemm/projects/llvm/llvm-project -ffile-prefix-map=/home/micklemm/projects/llvm/llvm-project/= -no-canonical-prefixes -O3 -DNDEBUG -Wl,-z,relro -Wl,--build-id -fuse-ld=gold    -Wl,--gc-sections  -Wl,--emit-relocs tools/bolt/tools/merge-fdata/CMakeFiles/merge-fdata.dir/merge-fdata.cpp.o -o bin/merge-fdata  -Wl,-rpath,"\$ORIGIN/../lib:"  lib/libLLVMSupport.a  -lrt  -ldl  -lm  /usr/lib/x86_64-linux-gnu/libz.so  /usr/lib/x86_64-linux-gnu/libzstd.so  /usr/lib/x86_64-linux-gnu/libtinfo.so  lib/libLLVMDemangle.a && :
/usr/bin/ld.gold: internal error in do_layout, at ../../gold/object.cc:1939
collect2: error: ld returned 1 exit status

However, all .mod files that should be there are built despite the above error, when using -k 0 with ninja.

I could try this in a Docker container to more closely resemble your environment. Would it be possible to provide me with a container or at least some more information on how I should build it up?

@sylvestre
Copy link
Collaborator Author

@mjklemm about your build issue, I had it before. Here is the workaround:
#57545 (comment)

my build env is a debian testing.

@mjklemm
Copy link
Contributor

mjklemm commented May 3, 2024

When I did the below in a Debian container, it worked for me, too:

root@0ae71c2ea53c:/build# find . -name \*.mod
./include/flang/iso_c_binding.mod
./include/flang/__fortran_ieee_exceptions.mod
./include/flang/ieee_arithmetic.mod
./include/flang/iso_fortran_env.mod
./include/flang/ieee_exceptions.mod
./include/flang/__cuda_builtins.mod
./include/flang/ieee_features.mod
./include/flang/__ppc_types.mod
./include/flang/__fortran_type_info.mod
./include/flang/__fortran_builtins.mod
./runtimes/runtimes-bins/openmp/runtime/src/omp_lib.mod
./runtimes/runtimes-bins/openmp/runtime/src/omp_lib_kinds.mod

These files also seem to install properly when installing the whole package with ninja install.

This is the container I was using:

docker run --rm -it -v $HOME/projects/llvm/llvm-project:/llvm-project debian:testing

And in the container:

export NINJA_STATUS='[%es %p %rx %f/%t] '; mkdir /build && cd /build && apt update && apt upgrade -y && apt install -y gcc g++ cmake python3 vim ninja-build ccache git binutils-dev && \
cmake -S /llvm-project/llvm/ \
      -G Ninja \
      -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-19 \
      -DLLVM_VERSION_SUFFIX= \
      -DCMAKE_SUPPRESS_REGENERATION=ON \
      -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_C_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
      -DCMAKE_CXX_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
      -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
      -DCMAKE_MODULE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
      -DCMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
      -DPACKAGE_VENDOR=Debian \
      -DENABLE_LINKER_BUILD_ID=ON \
      -DLLVM_TARGETS_TO_BUILD=Native \
      -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;cross-project-tests;mlir;bolt;flang;polly;lldb" \
      -DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libc;libunwind;openmp;offload" \
      -DLLVM_ENABLE_PIC=ON \
      -DLLVM_ENABLE_RTTI=ON \
      -DLLVM_BUILD_DOCS=OFF \
      -DLLVM_INCLUDE_GO_TESTS=OFF \
      -DLLVM_USE_RELATIVE_PATHS_IN_FILES=ON \
      -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
      -DLLVM_ENABLE_CURL=ON \
      -DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=ON \
      -DCLANG_PLUGIN_SUPPORT=OFF \
      -DCLANG_BUILD_EXAMPLES=OFF \
      -DCLANG_DEFAULT_LINKER=ld \
      -DCLANG_DEFAULT_RTLIB=libgcc \
      -DCOMPILER_RT_BUILD_XRAY=OFF \
      -DCOMPILER_RT_INCLUDE_TESTS=OFF \
      -DCOMPILER_RT_USE_LIBCXX=OFF \
      -DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
      -DLIBUNWIND_INSTALL_LIBRARY=OFF \
      -DLIBCXXABI_ENABLE_EXCEPTIONS=ON \
      -DLIBCXXABI_USE_COMPILER_RT=ON \
      -DLIBCXXABI_INSTALL_LIBRARY=OFF \
      -DLIBCXX_ENABLE_EXCEPTIONS=ON \
      -DLIBCXX_USE_COMPILER_RT=ON \
      -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
      -DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \
      -DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF \
      -DLIBCXX_INSTALL_LIBRARY=OFF \
      -DLIBCXX_INSTALL_MODULES=ON \
      -DLLVM_LIBC_GPU_BUILD=ON \
      -DBOOTSTRAP_LIBCXX_INSTALL_MODULES=ON \
      -DOPENMP_ENABLE_LIBOMP_PROFILING=OFF \
      -DOPENMP_ENABLE_LIBOMPTARGET_PROFILING=OFF \
      -DLIBOMP_ENABLE_RTTI=OFF \
      -DLIBOMP_OMPT_SUPPORT=OFF \
      -DCLANG_FORCE_MATCHING_LIBCLANG_SOVERSION=ON \
      -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
      -DCMAKE_C_COMPILER_LAUNCHER=ccache \
      -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
      -DLLVM_USE_LINKER=gold \
      -DLLVM_BINUTILS_INCDIR=/usr/include/ \
      -DLIBCXXABI_USE_LLVM_UNWINDER=ON \
      -DLIBOMP_LIBFLAGS="-lm" \
      -DOPENMP_USE_LLVM_UNWINDER=ON \
      -DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF \
      -DLLDB_ENABLE_LUA=OFF \
      -DBUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
      -DRUNTIMES_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
      -DCLANG_ENABLE_BOOTSTRAP=ON \
      -DCLANG_BOOTSTRAP_TARGETS="check-all;check-llvm;check-clang;check-clang-tools;check-lld;check-libcxx;check-libcxxabi;check-mlir;check-libc;check-sanitizer;llvm-config;test-suite" \
      -DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_SUPPRESS_REGENERATION;ENABLE_LINKER_BUILD_ID;LLVM_ENABLE_PIC;LLVM_ENABLE_RTTI;LLVM_INCLUDE_GO_TESTS;LLVM_USE_RELATIVE_PATHS_IN_FILES;CLANG_DEFAULT_LINKER;CLANG_DEFAULT_CXX_STDLIB;CLANG_DEFAULT_RTLIB;COMPILER_RT_USE_LIBCXX;COMPILER_RT_USE_BUILTINS_LIBRARY;COMPILER_RT_DEFAULT_TARGET_ONLY;COMPILER_RT_INCLUDE_TESTS;LIBUNWIND_USE_COMPILER_RT;LIBCXXABI_ENABLE_EXCEPTIONS;LIBCXXABI_USE_COMPILER_RT;LIBCXX_USE_COMPILER_RT;LIBCXX_ENABLE_EXCEPTIONS;LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY;LIBOMP_ENABLE_RTTI;LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN;CLANG_FORCE_MATCHING_LIBCLANG_SOVERSION;CMAKE_C_COMPILER_LAUNCHER;CMAKE_CXX_COMPILER_LAUNCHER;LLVM_LIBC_GPU_BUILD" \
      -DBOOTSTRAP_CMAKE_BUILD_TYPE=RelWithDebInfo \
      -DBOOTSTRAP_CMAKE_C_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1" \
      -DBOOTSTRAP_CMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1" \
      -DBOOTSTRAP_CMAKE_C_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
      -DBOOTSTRAP_CMAKE_CXX_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
      -DBOOTSTRAP_CMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
      -DBOOTSTRAP_CMAKE_MODULE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
      -DBOOTSTRAP_CMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
      -DBOOTSTRAP_LLVM_ENABLE_FFI=ON \
      -DBOOTSTRAP_LLVM_ENABLE_DUMP=ON \
      -DBOOTSTRAP_LLVM_ENABLE_LIBPFM=ON \
      -DBOOTSTRAP_LLVM_ENABLE_SPHINX=ON \
      -DBOOTSTRAP_CLANG_DEFAULT_PIE_ON_LINUX=ON \
      -DBOOTSTRAP_SPHINX_WARNINGS_AS_ERRORS=OFF \
      -DBOOTSTRAP_LLVM_USE_RELATIVE_PATHS_IN_FILES=ON \
      -DBOOTSTRAP_LLVM_INSTALL_UTILS=ON \
      -DBOOTSTRAP_LLVM_VERSION_SUFFIX= \
      -DBOOTSTRAP_LLVM_POLLY_LINK_INTO_TOOLS=ON \
      -DBOOTSTRAP_LLVM_EXPERIMENTAL_TARGETS_TO_BUILD="M68k;Xtensa" \
      -DBOOTSTRAP_LLVM_LINK_LLVM_DYLIB=ON \
      -DBOOTSTRAP_LLVM_ENABLE_CURL=ON \
      -DBOOTSTRAP_CLANG_LINK_CLANG_DYLIB=ON \
      -DBOOTSTRAP_LIBCLANG_LIBRARY_VERSION=1 \
      -DBOOTSTRAP_LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON \
      -DBOOTSTRAP_PYTHON_EXECUTABLE=/usr/bin/python3 \
      -DBOOTSTRAP_CLANG_REPOSITORY_STRING=++20240501043318+be5075ab8daf-1~exp1  \
      -DBOOTSTRAP_LLVM_ENABLE_Z3_SOLVER=ON  \
      -DBOOTSTRAP_CLANG_SYSTEMZ_DEFAULT_ARCH=z196  \
      -DBOOTSTRAP_CLANGD_ENABLE_REMOTE=ON  \
      -DBOOTSTRAP_LLVM_USE_PERF=ON  \
      -DBOOTSTRAP_LLVM_ENABLE_LIBPFM=ON  \
      -DBOOTSTRAP_LLVM_USE_LINKER=gold  \
      -DBOOTSTRAP_LLVM_BINUTILS_INCDIR=/usr/include/  \
      -DBOOTSTRAP_LIBCXXABI_USE_LLVM_UNWINDER=ON  \
      -DBOOTSTRAP_LIBOMP_LIBFLAGS="-lm"  \
      -DBOOTSTRAP_OPENMP_USE_LLVM_UNWINDER=ON  \
      -DBOOTSTRAP_MLIR_INSTALL_AGGREGATE_OBJECTS=OFF  \
      -DBOOTSTRAP_LLDB_ENABLE_LUA=OFF \
      -DBOOTSTRAP_BUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
      -DBOOTSTRAP_RUNTIMES_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
&& ninja -j 192

@sylvestre
Copy link
Collaborator Author

i am uploaded docker image which reproduces the issue

@sylvestre
Copy link
Collaborator Author

here is my docker file - i can confirm it reproduces the issue

# Use a base image
FROM debian:testing

# Install dependencies
RUN apt-get update && \
    apt-get install -y \
    git \
    cmake \
    ninja-build \
    python3 \
    && rm -rf /var/lib/apt/lists/*


RUN echo "deb-src http://ftp.fr.debian.org/debian/ testing main" > /etc/apt/sources.list.d/testing.list && \
    apt-get update && \
    apt-get build-dep -y llvm-toolchain-17 \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /llvm-build

# Clone LLVM repository
RUN git clone https://github.com/llvm/llvm-project.git

# Build LLVM
RUN cd llvm-project && cmake -S llvm/ -B build-llvm \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-19 \
-DLLVM_VERSION_SUFFIX= \
-DCMAKE_SUPPRESS_REGENERATION=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
-DCMAKE_CXX_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DPACKAGE_VENDOR=Debian \
-DENABLE_LINKER_BUILD_ID=ON \
-DLLVM_TARGETS_TO_BUILD=Native \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;cross-project-tests;mlir;bolt;flang;polly;lldb" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libc;libunwind;openmp;offload" \
-DLLVM_ENABLE_PIC=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_BUILD_DOCS=OFF \
-DLLVM_INCLUDE_GO_TESTS=OFF \
-DLLVM_USE_RELATIVE_PATHS_IN_FILES=ON \
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
-DLLVM_ENABLE_CURL=ON \
-DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=ON \
-DCLANG_PLUGIN_SUPPORT=OFF \
-DCLANG_BUILD_EXAMPLES=OFF \
-DCLANG_DEFAULT_LINKER=ld \
-DCLANG_DEFAULT_RTLIB=libgcc \
-DCOMPILER_RT_BUILD_XRAY=OFF \
-DCOMPILER_RT_INCLUDE_TESTS=OFF \
-DCOMPILER_RT_USE_LIBCXX=OFF \
-DCOMPILER_RT_USE_BUILTINS_LIBRARY=ON \
-DLIBUNWIND_INSTALL_LIBRARY=OFF \
-DLIBCXXABI_ENABLE_EXCEPTIONS=ON \
-DLIBCXXABI_USE_COMPILER_RT=ON \
-DLIBCXXABI_INSTALL_LIBRARY=OFF \
-DLIBCXX_ENABLE_EXCEPTIONS=ON \
-DLIBCXX_USE_COMPILER_RT=ON \
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON \
-DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY=ON \
-DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY=OFF \
-DLIBCXX_INSTALL_LIBRARY=OFF \
-DLIBCXX_INSTALL_MODULES=ON \
-DLLVM_LIBC_GPU_BUILD=ON \
-DBOOTSTRAP_LIBCXX_INSTALL_MODULES=ON \
-DOPENMP_ENABLE_LIBOMP_PROFILING=OFF \
-DOPENMP_ENABLE_LIBOMPTARGET_PROFILING=OFF \
-DLIBOMP_ENABLE_RTTI=OFF \
-DLIBOMP_OMPT_SUPPORT=OFF \
-DCLANG_FORCE_MATCHING_LIBCLANG_SOVERSION=ON \
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF \
-DLLVM_USE_LINKER=gold -DLLVM_BINUTILS_INCDIR=/usr/include/ -DLIBCXXABI_USE_LLVM_UNWINDER=ON -DLIBOMP_LIBFLAGS="-lm" -DOPENMP_USE_LLVM_UNWINDER=ON -DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF -DLLDB_ENABLE_LUA=OFF \
-DBUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
-DRUNTIMES_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
-DCLANG_ENABLE_BOOTSTRAP=ON \
-DCLANG_BOOTSTRAP_TARGETS="check-all;check-llvm;check-clang;check-clang-tools;check-lld;check-libcxx;check-libcxxabi;check-mlir;check-libc;check-sanitizer;llvm-config;test-suite" \
-DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_SUPPRESS_REGENERATION;ENABLE_LINKER_BUILD_ID;LLVM_ENABLE_PIC;LLVM_ENABLE_RTTI;LLVM_INCLUDE_GO_TESTS;LLVM_USE_RELATIVE_PATHS_IN_FILES;CLANG_DEFAULT_LINKER;CLANG_DEFAULT_CXX_STDLIB;CLANG_DEFAULT_RTLIB;COMPILER_RT_USE_LIBCXX;COMPILER_RT_USE_BUILTINS_LIBRARY;COMPILER_RT_DEFAULT_TARGET_ONLY;COMPILER_RT_INCLUDE_TESTS;LIBUNWIND_USE_COMPILER_RT;LIBCXXABI_ENABLE_EXCEPTIONS;LIBCXXABI_USE_COMPILER_RT;LIBCXX_USE_COMPILER_RT;LIBCXX_ENABLE_EXCEPTIONS;LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY;LIBOMP_ENABLE_RTTI;LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN;CLANG_FORCE_MATCHING_LIBCLANG_SOVERSION;CMAKE_C_COMPILER_LAUNCHER;CMAKE_CXX_COMPILER_LAUNCHER;LLVM_LIBC_GPU_BUILD" \
-DBOOTSTRAP_CMAKE_BUILD_TYPE=RelWithDebInfo \
-DBOOTSTRAP_CMAKE_C_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1" \
-DBOOTSTRAP_CMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1" \
-DBOOTSTRAP_CMAKE_C_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
-DBOOTSTRAP_CMAKE_CXX_FLAGS="-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2" \
-DBOOTSTRAP_CMAKE_SHARED_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DBOOTSTRAP_CMAKE_MODULE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DBOOTSTRAP_CMAKE_EXE_LINKER_FLAGS="-Wl,-z,relro -Wl,--build-id" \
-DBOOTSTRAP_LLVM_ENABLE_FFI=ON \
-DBOOTSTRAP_LLVM_ENABLE_DUMP=ON \
-DBOOTSTRAP_LLVM_ENABLE_LIBPFM=ON \
-DBOOTSTRAP_LLVM_ENABLE_SPHINX=ON \
-DBOOTSTRAP_CLANG_DEFAULT_PIE_ON_LINUX=ON \
-DBOOTSTRAP_SPHINX_WARNINGS_AS_ERRORS=OFF \
-DBOOTSTRAP_LLVM_USE_RELATIVE_PATHS_IN_FILES=ON \
-DBOOTSTRAP_LLVM_INSTALL_UTILS=ON \
-DBOOTSTRAP_LLVM_VERSION_SUFFIX= \
-DBOOTSTRAP_LLVM_POLLY_LINK_INTO_TOOLS=ON \
-DBOOTSTRAP_LLVM_EXPERIMENTAL_TARGETS_TO_BUILD="M68k;Xtensa" \
-DBOOTSTRAP_LLVM_LINK_LLVM_DYLIB=ON \
-DBOOTSTRAP_LLVM_ENABLE_CURL=ON \
-DBOOTSTRAP_CLANG_LINK_CLANG_DYLIB=ON \
-DBOOTSTRAP_LIBCLANG_LIBRARY_VERSION=1 \
-DBOOTSTRAP_LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON \
-DBOOTSTRAP_PYTHON_EXECUTABLE=/usr/bin/python3 \
 -DBOOTSTRAP_CLANG_REPOSITORY_STRING=++20240501043318+be5075ab8daf-1~exp1  -DBOOTSTRAP_LLVM_ENABLE_Z3_SOLVER=ON  -DBOOTSTRAP_CLANG_SYSTEMZ_DEFAULT_ARCH=z196  -DBOOTSTRAP_CLANGD_ENABLE_REMOTE=ON  -DBOOTSTRAP_LLVM_USE_PERF=ON  -DBOOTSTRAP_LLVM_ENABLE_LIBPFM=ON  -DBOOTSTRAP_LLVM_USE_LINKER=gold  -DBOOTSTRAP_LLVM_BINUTILS_INCDIR=/usr/include/  -DBOOTSTRAP_LIBCXXABI_USE_LLVM_UNWINDER=ON  -DBOOTSTRAP_LIBOMP_LIBFLAGS="-lm"  -DBOOTSTRAP_OPENMP_USE_LLVM_UNWINDER=ON  -DBOOTSTRAP_MLIR_INSTALL_AGGREGATE_OBJECTS=OFF  -DBOOTSTRAP_LLDB_ENABLE_LUA=OFF \
-DBOOTSTRAP_BUILTINS_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
-DBOOTSTRAP_RUNTIMES_CMAKE_ARGS="-DCMAKE_C_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_CXX_FLAGS=-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2;-DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_MODULE_LINKER_FLAGS=-Wl,-z,relro -Wl,--build-id -L/extra-dev/branches/llvm-toolchain-snapshot_19~++20240501043318+be5075ab8daf/build-llvm/lib;-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-O2 -DNDEBUG -g1;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF"


RUN  cd llvm-project && ls && pwd && VERBOSE=1 cmake --build build-llvm -j 20 --target stage2

@mjklemm
Copy link
Contributor

mjklemm commented May 6, 2024

Thanks for the Docker container. I was able to reproduce the error with it.

@sylvestre
Copy link
Collaborator Author

\o/
thanks for trying again and bearing with me :)

@sylvestre
Copy link
Collaborator Author

@mjklemm Sorry for the ping but have you been able to make progress ?
This bug is blocking most of the builds of 19 on https://apt.llvm.org/

@mjklemm
Copy link
Contributor

mjklemm commented May 7, 2024

Well, I have debugged this enough to be convinced that there should be a dependency of the flang-new target needs to be inserted such that the targets for openmp and offload depend on the flang-new target. Alas, I'm not too sure how to do it, as I'm not a CMake expert. @jhuber6 Do you know how to do this for a stage2 build? I did it for the stage1 build, but I cannot find where to do it proper for stage2.

@sylvestre
Copy link
Collaborator Author

@jdoerfert rings a bell ?

@Meinersbur
Copy link
Member

Meinersbur commented May 8, 2024

Looking at the CMakeLists.txt, the failing command is declared here:

COMMAND flang-new -cpp -fsyntax-only ${opts} -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
${CMAKE_BINARY_DIR}/projects/openmp/runtime/src/omp_lib.F90
DEPENDS flang-new ${FLANG_INTRINSIC_MODULES_DIR}/iso_c_binding.mod ${CMAKE_BINARY_DIR}/projects/openmp/runtime/src/omp_lib.F90 ${depends}

iso_c_binding.mod must be created before, which is done here:

COMMAND flang-new -cpp -fsyntax-only ${opts} -module-dir ${FLANG_INTRINSIC_MODULES_DIR}
${FLANG_SOURCE_DIR}/module/${filename}.f90

the omp_lib.mod command declares a dependency to "${FLANG_INTRINSIC_MODULES_DIR}/iso_c_binding.mod". The iso_c_binding.mod command declares it generates ${base}.mod (where ${base} is ${FLANG_INTRINSIC_MODULES_DIR}/iso_c_binding.mod). They seem to match, but CMake sometime weird with these dependencies. Would mismatch explain the symptom, ie. a race condition between the two commands?

@mjklemm
Copy link
Contributor

mjklemm commented May 8, 2024

@Meinersbur Thanks for having the right thought on this and helping me on this one!

mjklemm added a commit that referenced this issue May 9, 2024
#91517)

Fixes bug #90769. Many thanks
to @Meinersbur for providing the initial thought and solution to this.
@mjklemm
Copy link
Contributor

mjklemm commented May 9, 2024

I have merged a potential fix. Please have a go and let me know if it resolves the issue.

@mjklemm mjklemm self-assigned this May 9, 2024
@sylvestre
Copy link
Collaborator Author

I think it is now fixed. I am blocked on #91819 but a different issue.
many thanks!

@mjklemm
Copy link
Contributor

mjklemm commented May 11, 2024

Thanks for confirming! Happy to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-problem flang Flang issues not falling into any other category offload openmp
Projects
None yet
Development

No branches or pull requests

5 participants