Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 936276 - dev-lang/R-4.3.1-r1 fails to compile with clang-17 if USE="lto" is enabled
Summary: dev-lang/R-4.3.1-r1 fails to compile with clang-17 if USE="lto" is enabled
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Science Mathematics related packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: lto LD-is-lld, systemwide-lld 912821
  Show dependency tree
 
Reported: 2024-07-19 05:46 UTC by ppw0
Modified: 2024-11-12 21:24 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (dev-lang:R-4.3.1-r1:20240719-052345.log,101.85 KB, text/x-log)
2024-07-19 05:46 UTC, ppw0
Details
emerge --info (emerge_info.log,6.88 KB, text/x-log)
2024-07-19 05:48 UTC, ppw0
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ppw0 2024-07-19 05:46:28 UTC
Created attachment 897956 [details]
build log

In an environment that uses clang-17 as the default compiler toolchain, dev-lang/R-4.3.1-r1 will fail to build with the "lto" USE flag enabled, with the following error:

```
/var/tmp/portage/dev-lang/R-4.3.1-r1/work/R-4.3.1/bin/exec/R: symbol lookup error: /var/tmp/portage/dev-lang/R-4.3.1-r1/work/R-4.3.1/lib/libR.so: undefined symbol: dqrcf_
make[4]: *** [../../../share/make/basepkg.mk:151: sysdata] Error 127
make[4]: Leaving directory '/var/tmp/portage/dev-lang/R-4.3.1-r1/work/R-4.3.1/src/library/tools'
make[3]: *** [Makefile:36: all] Error 2
make[3]: Leaving directory '/var/tmp/portage/dev-lang/R-4.3.1-r1/work/R-4.3.1/src/library/tools'
make[2]: *** [Makefile:37: R] Error 1
make[2]: Leaving directory '/var/tmp/portage/dev-lang/R-4.3.1-r1/work/R-4.3.1/src/library'
make[1]: *** [Makefile:28: R] Error 1
make[1]: Leaving directory '/var/tmp/portage/dev-lang/R-4.3.1-r1/work/R-4.3.1/src'
make: *** [Makefile:62: R] Error 1
```

Also tested with dev-lang/R-4.3.2-r1 and 4.4.1, with the same errors.

Attaching logs.
Comment 1 ppw0 2024-07-19 05:48:25 UTC
Created attachment 897957 [details]
emerge --info
Comment 2 gto7052 2024-11-12 21:24:59 UTC
Comment on attachment 897956 [details]
build log

I can confirm this problem persists with R-4.4.1 and add that the problem is related to the fact that the gcc x86_64-pc-linux-gnu-gfortran still has to be used instead of the LLVM-based Flang compiler.

I tried this and that and finally found the shell variable "LTO_FC" in config.site to be useful. The variable is intended to set some special flags to get LTO working in arcane environments. Is seems to be the only user controllable path to disable or finally neutralize a preceding -flto request to the Fortran compiler selectively.

Therefore, setting LTO_FC="-fno-lto" within /etc/portage/env/compiler-clang or the dev-lang/R ebuild may serve as a workaround until eitehr Flang becomes production ready (https://releases.llvm.org/19.1.0/tools/flang/docs/index.html) or ld finds the plugin it reportedly needs to link the gfortran lto objects  properly (as ld said  when trying to link R-4.4.1 with lto and fortran use flags both enabled).