Nixpkgs version
Describe the bug
When invoking flang to compile and link a fortran program, the linker fails
/nix/store/i839kg98izahkn1iq17sn3wliliic7pm-binutils-2.44/bin/ld: cannot find Scrt1.o: No such file or directory
/nix/store/i839kg98izahkn1iq17sn3wliliic7pm-binutils-2.44/bin/ld: cannot find crti.o: No such file or directory
/nix/store/i839kg98izahkn1iq17sn3wliliic7pm-binutils-2.44/bin/ld: cannot find crtbeginS.o: No such file or directory
flang-20: error: linker command failed with exit code 1 (use -v to see invocation)
Steps to reproduce
Take a simple fortran program like
! test.f95
program test
print*, 'test'
end program
and run
$ nix-shell -p flang
$ flang test.f95
Expected behaviour
Flang correctly identifies & links the runtime. For example,
$ flang -c test.f95
/nix/store/kilyfvfmh9x9rlaj47ph1916lbc1pnsr-gcc-wrapper-14.3.0/bin/ld \
--hash-style=gnu --eh-frame-hdr -m elf_x86_64 -pie -o a.out \
/nix/store/pdwlyjkmc6icc0wb5gaw08m9ynqrg683-glibc-2.40-218/lib/Scrt1.o \
/nix/store/pdwlyjkmc6icc0wb5gaw08m9ynqrg683-glibc-2.40-218/lib/crti.o \
/nix/store/06409a3d2d3b1113zdk9rm5a3ns4rizz-gcc-14.3.0/lib/gcc/x86_64-unknown-linux-gnu/14.3.0/crtbeginS.o \
-L/lib/../lib64 -L/lib test.o \
-L/nix/store/8rvn83lz6095k0rsqz958szcjb19687v-flang-20.1.8/lib \
-L/nix/store/aas6l2pmz2wpd0lrk0cldnhzxvgjafik-gfortran-14.3.0-libgcc/lib \
-L/nix/store/06409a3d2d3b1113zdk9rm5a3ns4rizz-gcc-14.3.0/lib/gcc/x86_64-unknown-linux-gnu/14.3.0/ \
-lFortranRuntime -lFortranDecimal -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed \
/nix/store/06409a3d2d3b1113zdk9rm5a3ns4rizz-gcc-14.3.0/lib/gcc/x86_64-unknown-linux-gnu/14.3.0/crtendS.o \
/nix/store/pdwlyjkmc6icc0wb5gaw08m9ynqrg683-glibc-2.40-218/lib/crtn.o
### Screenshots
_No response_
### Relevant log output
```console
flang version 20.1.8
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /nix/store/8rvn83lz6095k0rsqz958szcjb19687v-flang-20.1.8/bin
"/nix/store/8rvn83lz6095k0rsqz958szcjb19687v-flang-20.1.8/bin/flang" -fc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -resource-dir /nix/store/8rvn83lz6095k0rsqz958szcjb19687v-flang-20.1.8/lib/clang/20 -mframe-pointer=all -o /tmp/nix-shell-655059-1096684053/test-3f96cf.o -x f95-cpp-input test.f95
"/nix/store/kilyfvfmh9x9rlaj47ph1916lbc1pnsr-gcc-wrapper-14.3.0/bin/ld" --hash-style=gnu --eh-frame-hdr -m elf_x86_64 -pie -o a.out Scrt1.o crti.o crtbeginS.o -L/lib/../lib64 -L/lib /tmp/nix-shell-655059-1096684053/test-3f96cf.o -L/nix/store/8rvn83lz6095k0rsqz958szcjb19687v-flang-20.1.8/lib -lFortranRuntime -lFortranDecimal -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtendS.o crtn.o
/nix/store/i839kg98izahkn1iq17sn3wliliic7pm-binutils-2.44/bin/ld: cannot find Scrt1.o: No such file or directory
/nix/store/i839kg98izahkn1iq17sn3wliliic7pm-binutils-2.44/bin/ld: cannot find crti.o: No such file or directory
/nix/store/i839kg98izahkn1iq17sn3wliliic7pm-binutils-2.44/bin/ld: cannot find crtbeginS.o: No such file or directory
flang-20: error: linker command failed with exit code 1 (use -v to see invocation)
Additional context
No response
System metadata
- system:
"x86_64-linux"
- host os:
Linux 6.12.82, NixOS, 25.11 (Xantusia), 25.11.9476.e07580dae397
- multi-user?:
yes
- sandbox:
yes
- version:
nix-env (Nix) 2.31.4
- channels(yannickulrich):
""
- channels(root):
"home-manager-25.11.tar.gz, nixos-25.11, nixos-hardware, nixos-unstable"
- nixpkgs:
/nix/store/k1k2aj8razdy1db8lrdpr9wgq9g2kqi3-nixos-25.11/nixos
Notify maintainers
@Acture
Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)
I assert that this issue is relevant for Nixpkgs
Is this issue important to you?
Add a 👍 reaction to issues you find important.
Nixpkgs version
Describe the bug
When invoking flang to compile and link a fortran program, the linker fails
Steps to reproduce
Take a simple fortran program like
and run
Expected behaviour
Flang correctly identifies & links the runtime. For example,
Additional context
No response
System metadata
"x86_64-linux"Linux 6.12.82, NixOS, 25.11 (Xantusia), 25.11.9476.e07580dae397yesyesnix-env (Nix) 2.31.4"""home-manager-25.11.tar.gz, nixos-25.11, nixos-hardware, nixos-unstable"/nix/store/k1k2aj8razdy1db8lrdpr9wgq9g2kqi3-nixos-25.11/nixosNotify maintainers
@Acture
Note for maintainers: Please tag this issue in your pull request description. (i.e.
Resolves #ISSUE.)I assert that this issue is relevant for Nixpkgs
Is this issue important to you?
Add a 👍 reaction to issues you find important.