[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
Mon Dec 16 05:01:39 PST 2024


h-vetinari wrote:

This now builds fine on linux & windows for me, though I'm running into an issue when doing the following on windows (pieced together a bit to avoid distractions that are due to packaging):

```batch
set "FC=flang.exe"
set "LD=lld-link.exe"

:: following https://github.com/conda-forge/clang-win-activation-feedstock/blob/main/recipe/activate-clang_win-64.bat
set "FFLAGS=-D_CRT_SECURE_NO_WARNINGS -fms-runtime-lib=dll -fuse-ld=lld -I%LIBRARY_PREFIX%\Library\include"
set "LDFLAGS=%LDFLAGS% -Wl,-defaultlib:%LIBRARY_PREFIX:\=/%/lib/clang/20/lib/windows/clang_rt.builtins-x86_64.lib"

%FC% hello_world.f90 
```
where the file in question looks like:
```fortran
program hello
  print *, "Hello World!"
end program hello
```
this fails with
```
LINK : fatal error LNK1104: cannot open file 'flang_rt.static.lib'
flang: error: linker command failed with exit code 1104 (use -v to see invocation)
```
despite being in the same prefix as flang, under
```
%LIBRARY_PREFIX%/lib/windows/flang_rt.static.lib
```
which is the default location for `-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX%` as of this PR. 

Aside from trivial modifications (e.g. `flang-new` -> `flang`), this matches our flag and testing setup as it's currently working for v19, so I'm expecting this to stay functional 

PS. The explicit linkage to `clang_rt.builtins-x86_64.lib` might not be necessary anymore after this PR (see [here](https://github.com/llvm/llvm-project/pull/110217#discussion_r1838900052)); it used to be necessary though, and I just haven't gotten around to removing it yet 

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


More information about the llvm-branch-commits mailing list