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.
Created attachment 897957 [details] emerge --info
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).