Public bug reported:

dh-fortran builds packages with each available Fortran compiler
(gfortran, flang-22, lfortran). For flang and lfortran it strips GCC-
only options from the dpkg-buildflags (flags_changes in
dhfortran/compilers.py), but only the ones Debian's dpkg sets. Ubuntu's
dpkg-buildflags adds more GCC-only options, which flang-22 and lfortran
reject:

 * -mno-omit-leaf-frame-pointer and -fdebug-prefix-map=...:
     flang-22: error: unknown argument: '-mno-omit-leaf-frame-pointer'
     flang-22: error: unknown argument: '-fdebug-prefix-map=...'
     lfortran: The following argument was not expected: 
-mno-omit-leaf-frame-pointer
 * -fno-omit-frame-pointer:
     lfortran: The flag `-fno-omit-frame-pointer` is not supported
 * -flto=auto / -ffat-lto-objects in FCFLAGS and LDFLAGS, which makes clang's 
linker driver load the gold plugin:
     ld.bfd: /usr/lib/llvm-22/bin/../lib/LLVMgold.so: error loading plugin ... 
flang-22: error: linker command failed

So in Ubuntu every flang and lfortran build of a dh-fortran package fails. The 
packaging tolerates those failures, but the libraries Debian ships for those 
compilers are then missing. For fortran-toml 0.5.2-1 that breaks the build 
entirely: its libfortran-toml-0 only contains the flang and lfortran shared 
libraries (upstream's gfortran shared library fails to link without -fPIC, in 
Debian as well), so libfortran-toml-0 ends up empty and "chrpath -d 
debian/libfortran-toml-0/usr/lib/*/*" fails:
  open: No such file or directory / elf_open: Invalid argument

Workaround tested in a stonking container: add "-fdebug-prefix-map%",
"-mno-omit-leaf-frame-pointer", "-fno-omit-frame-pointer", "-flto%",
"-ffat-lto-objects" to the FCFLAGS strip lists of the flang* and
lfortran entries, and "-flto%", "-ffat-lto-objects" to their LDFLAGS
strip lists (lfortran had no LDFLAGS entry). With that, fortran-toml
0.5.2-1 builds and ships libtoml-f-flang.so.0 and libtoml-f-lcc.so.0,
like in Debian.

Related, but separate issues:
 * LP: #2169224, FC_DEFAULT=gfortran resolving to gfortran-16 (fixed in 
0.85ubuntu2)
 * LP: #2169677, dh_strip/debugedit corrupting the libraries patched by 
dh_fortran_lib

** Affects: dh-fortran (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: fortran-toml (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: ftbfs update-excuse

** Tags added: update-excuse

** Tags added: ftbfs

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2169678

Title:
  dh-fortran does not strip Ubuntu-specific default build flags for
  flang and lfortran (frame pointers, -fdebug-prefix-map, LTO); their
  builds fail, fortran-toml FTBFS

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dh-fortran/+bug/2169678/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to