-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
Comments
@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
cmake -S ../llvm/ -B build-llvm
VERBOSE=1 cmake --build build-llvm -j 20 --target stage2
|
@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
cmake -S ../llvm/ -B build-llvm
VERBOSE=1 cmake --build build-llvm -j 20 --target stage2
|
@mjklemm Any guesses here? I don't know anything about Fortran. |
Hm. That's interesting. Does |
@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. |
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:
However, all 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? |
@mjklemm about your build issue, I had it before. Here is the workaround: my build env is a debian testing. |
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 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 |
i am uploaded docker image which reproduces the issue |
here is my docker file - i can confirm it reproduces the issue
|
Thanks for the Docker container. I was able to reproduce the error with it. |
\o/ |
@mjklemm Sorry for the ping but have you been able to make progress ? |
Well, I have debugged this enough to be convinced that there should be a dependency of the |
@jdoerfert rings a bell ? |
Looking at the CMakeLists.txt, the failing command is declared here: llvm-project/flang/tools/f18/CMakeLists.txt Lines 77 to 79 in c6efcc9
llvm-project/flang/tools/f18/CMakeLists.txt Lines 61 to 62 in c6efcc9
the |
@Meinersbur Thanks for having the right thought on this and helping me on this one! |
#91517) Fixes bug #90769. Many thanks to @Meinersbur for providing the initial thought and solution to this.
I have merged a potential fix. Please have a go and let me know if it resolves the issue. |
I think it is now fixed. I am blocked on #91819 but a different issue. |
Thanks for confirming! Happy to help! |
since the move of offload, it is failing to build with:
@jdoerfert @jhuber6 probably the move to offload too
The text was updated successfully, but these errors were encountered: