[llvm-branch-commits] [clang] [flang] [lld] [llvm] [Flang] LLVM_ENABLE_RUNTIMES=flang-rt (PR #110217)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 8 06:54:19 PST 2024


jeanPerier wrote:

When building the runtime out of tree and running check-flang-rt, I am seeing an error about LLVM header not found:

```
make -j check-flang-rt
[  1%] Building CXX object flang-rt/unittests/third-party/unittest/CMakeFiles/llvm_gtest.dir/googletest/src/gtest-all.cc.o
[  1%] Building CXX object flang-rt/lib/Testing/CMakeFiles/NonGTestTesting.dir/local/home/jperier/f18-llvm-project/flang/lib/Testing/testing.cpp.o
[  4%] Building CXX object flang-rt/lib/Testing/CMakeFiles/NonGTestTesting.dir/local/home/jperier/f18-llvm-project/flang/lib/Testing/fp-testing.cpp.o
[  4%] Building CXX object flang-rt/unittests/third-party/unittest/CMakeFiles/llvm_gtest.dir/googlemock/src/gmock-all.cc.o
llvm-project/flang/lib/Testing/testing.cpp:10:10: fatal error: llvm/Support/raw_ostream.h: No such file or directory
 #include "llvm/Support/raw_ostream.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [flang-rt/lib/Testing/CMakeFiles/NonGTestTesting.dir/build.make:76: flang-rt/lib/Testing/CMakeFiles/NonGTestTesting.dir/local/home/jperier/f18-llvm-project/flang/lib/Testing/testing.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
llvm-project/flang/lib/Testing/fp-testing.cpp:10:10: fatal error: llvm/Support/Errno.h: No such file or directory
 #include "llvm/Support/Errno.h"
```

I first built flang like this:
```
cmake 
   -DCMAKE_C_COMPILER=gcc \
  -DCMAKE_CXX_COMPILER=g++ \
  -DFLANG_BUILD_EXAMPLES=ON \
  -DLLVM_TARGETS_TO_BUILD=host
  -DLLVM_INSTALL_UTILS=ON \
  -DLLVM_INSTALL_GTEST=ON \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_ENABLE_PROJECTS=\"clang;mlir;flang;openmp\" \
  -DLLVM_ENABLE_LIBOMPTARGET=OFF \
  -DOPENMP_ENABLE_LIBOMPTARGET=OFF \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
  -DCMAKE_INSTALL_PREFIX=$INSTALLDIR \
  -DCMAKE_CXX_STANDARD=17 \
  -DFLANG_RUNTIME_F128_MATH_LIB=libquadmath \
  $LLVM_SRC/llvm

make -j 16
make -j install
```
and then the runtime like this:

```
cmake \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX=$INSTALLDIR \
  -DLLVM_ENABLE_RUNTIMES="flang-rt" \
  -DCMAKE_C_COMPILER=gcc \
  -DCMAKE_CXX_COMPILER=g++ \
  -DLLVM_BINARY_DIR=$LLVM_BUILD_DIR \
  -DLLVM_DIR=$LLVM_BUILD_DIR/lib/cmake/llvm \
  -DClang_DIR=$LLVM_BUILD_DIR/lib/cmake/clang \
  -DCMAKE_Fortran_COMPILER=$INSTALLDIR/bin/flang-new \
  -DCMAKE_Fortran_COMPILER_WORKS=yes \
  -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu \
  -DLLVM_RUNTIMES_TARGET=x86_64-linux-gnu \
  -DCMAKE_CXX_STANDARD=17 \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DFLANG_RUNTIME_F128_MATH_LIB=libquadmath \
  -DCMAKE_EXE_LINKER_FLAGS=\"$LDOPTS\" \
  -DLLVM_STATIC_LINK_CXX_STDLIB=ON \
  $LLVM_SRC/runtimes"
make -j 16
make -j 16 check-flang-rt
```

Am I missing some cmake option for the out of tree runtime build?

https://github.com/llvm/llvm-project/pull/110217


More information about the llvm-branch-commits mailing list