Meinersbur wrote:

@h-vetinari Thanks you the complete paths in the internal FLANG_RT_* variables. 
Unfortunately it was not sufficient for me to understand what is going on. This 
is what I can conclude:

1. You are using a runtimes build (`cmake <llvm-project-source-dir>/runtimes 
-DLLVM_ENABLE_RUNTIMES=flang-rt -DLLVM_BINARY_DIR=<llvm-project-binary-dir>`), 
separate from the build of LLVM/Flang.

2. Source dir is 
`/home/conda/feedstock_root/build_artifacts/flang-split_1738098969735/work`

3. Build directory of the runtimes build is 
`/home/conda/feedstock_root/build_artifacts/flang-split_1738098969735/work/build`
 

4. Install dir (CMAKE_INSTALL_PREFIX) is ... `$PREFIX`


Ideas for causes for it not working:

 * You are using the same build dir for LLVM+Flang and runtimes. Should be 
rejected by CMake, but still. Use some other location than 
`/home/conda/feedstock_root/build_artifacts/flang-split_1738098969735/work` to 
build LLVM+Flang. 
 
 * You are invoking Flang from the build-dir. libflang_rt.runtime.a is located 
in a different build dirs.
 
 * You are invoking the system's Flang, not the just-built Flang.
 
 * You are using two different CMAKE_INSTALL_PREFIX for LLVM+Flang and runtimes.

Since the back-and-forth isn't effective, I ask you to send a reproducer that 
works without conda. If you cannot reproduce it without conda, I am assuming 
the problem is with conda.

Here is my reproducer:
```sh
#! /bin/bash
set -xeuo pipefail

# Change to the location of the root llvm-project source directory
LLVM_SOURCE_DIR="${HOME}/src/llvm-project-flangrt"

ROOTDIR=`realpath --no-symlinks $(dirname $0)`
LLVM_BUILD_DIR="${ROOTDIR}/build/llvm_flang"
RUNTIMES_BUILD_DIR="${ROOTDIR}/build/runtimes"
INSTALL_PREFIX="${ROOTDIR}/install"

mkdir -p "${LLVM_BUILD_DIR}"
cmake -S "${LLVM_SOURCE_DIR}/llvm" -B "${LLVM_BUILD_DIR}" \
  -GNinja \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_ENABLE_PROJECTS='clang;mlir;flang' \
  -DFLANG_INCLUDE_RUNTIME=OFF \
  -DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" 
(cd "${LLVM_BUILD_DIR}" && ninja all install)

mkdir -p "${RUNTIMES_BUILD_DIR}"
cmake -S "${LLVM_SOURCE_DIR}/runtimes" -B "${RUNTIMES_BUILD_DIR}" \
  -GNinja \
  -DCMAKE_BUILD_TYPE=Release \
  -DLLVM_BINARY_DIR="${LLVM_BUILD_DIR}" \
  -DLLVM_ENABLE_RUNTIMES='flang-rt' \
  -DCMAKE_Fortran_COMPILER="${INSTALL_PREFIX}/bin/flang" \
  -DCMAKE_Fortran_COMPILER_WORKS=ON \
  -DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" 
(cd "${RUNTIMES_BUILD_DIR}" && ninja install)

find "${LLVM_BUILD_DIR}" -name "libflang_rt.*"
find "${RUNTIMES_BUILD_DIR}" -name "libflang_rt.*"
find "${INSTALL_PREFIX}" -name "libflang_rt.*"
"${INSTALL_PREFIX}/bin/flang" -v 
"${LLVM_SOURCE_DIR}/flang-rt/test/Driver/exec.f90" -o "${ROOTDIR}/exec"
"${ROOTDIR}/exec"
```
Please try it out in your environment, change according what you need for your 
build, and send be the output starting with the `find` lines:
```
[...]
[ 98%/102.489s :: 0->1->70 (of 71)] Install the project...
-- Install configuration: "Release"
-- Installing: 
/home/meinersbur/build/llvm-project-flangrt/install/lib/clang/21/lib/x86_64-unknown-linux-gnu/libflang_rt.runtime.a
+ find /home/meinersbur/build/llvm-project-flangrt/build/llvm_flang -name 
'libflang_rt.*'
+ find /home/meinersbur/build/llvm-project-flangrt/build/runtimes -name 
'libflang_rt.*'
/home/meinersbur/build/llvm-project-flangrt/build/runtimes/flang-rt/lib/libflang_rt.runtime.a
+ find /home/meinersbur/build/llvm-project-flangrt/install -name 'libflang_rt.*'
/home/meinersbur/build/llvm-project-flangrt/install/lib/clang/21/lib/x86_64-unknown-linux-gnu/libflang_rt.runtime.a
+ /home/meinersbur/build/llvm-project-flangrt/install/bin/flang -v 
/home/meinersbur/src/llvm-project-flangrt/flang-rt/test/Driver/exec.f90 -o 
/home/meinersbur/build/llvm-project-flangrt/exec
flang version 21.0.0git (/home/meinersbur/src/llvm-project-flangrt/clang 
0c759c1051b51a1f4dde3bec2f8ae8ea9dd9842e)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/meinersbur/build/llvm-project-flangrt/install/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/lib/cuda, version 12.0
 "/home/meinersbur/build/llvm-project-flangrt/install/bin/flang" -fc1 -triple 
x86_64-unknown-linux-gnu -emit-obj -fcolor-diagnostics -mrelocation-model pic 
-pic-level 2 -pic-is-pie -target-cpu x86-64 -resource-dir 
/home/meinersbur/build/llvm-project-flangrt/install/lib/clang/21 
-mframe-pointer=all -o /tmp/meinersbur/exec-e14f69.o -x f95-cpp-input 
/home/meinersbur/src/llvm-project-flangrt/flang-rt/test/Driver/exec.f90
 "/usr/bin/ld" -z relro --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -pie 
-dynamic-linker /lib64/ld-linux-x86-64.so.2 -o 
/home/meinersbur/build/llvm-project-flangrt/exec /lib/x86_64-linux-gnu/Scrt1.o 
/lib/x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o 
-L/home/meinersbur/build/llvm-project-flangrt/install/lib/clang/21/lib/x86_64-unknown-linux-gnu
 -L/usr/lib/gcc/x86_64-linux-gnu/13 
-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib64 -L/lib/x86_64-linux-gnu 
-L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/lib 
-L/usr/lib /tmp/meinersbur/exec-e14f69.o 
-L/home/meinersbur/build/llvm-project-flangrt/install/lib -lflang_rt.runtime 
-lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s 
--no-as-needed /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o 
/lib/x86_64-linux-gnu/crtn.o
+ /home/meinersbur/build/llvm-project-flangrt/exec
 Hello, World!                   
```


https://github.com/llvm/llvm-project/pull/110217
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to