Dirk Eddelbuettel
2021-Jun-01 22:40 UTC
[R-sig-Debian] LTO flags in 4.1.0 Ubuntu 21.04 Makeconf
Hi Karl, On 1 June 2021 at 22:22, Karl Dunkle Werner wrote: | I noticed the Makeconf file that comes with the Ubuntu version of R 4.1.0 | has link-time optimization (LTO) flags enabled. For instance: | CXX11FLAGS = -g -O2 -ffile-prefix-map=/build/r-base-aXXzqd/r-base-4.1.0=. | -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat | -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g $(LTO) Upstream decision by R Core, see the NEWS entry: LINK-TIME OPTIMIZATION on a UNIX-ALIKE: * Configuring with flag --enable-lto=R now also uses LTO when installing the recommended packages. * R CMD INSTALL and R CMD SHLIB have a new flag --use-LTO to use LTO when compiling code, for use with R configured with --enable-lto=R. For R configured with --enable-lto, they have the new flag --no-use-LTO. Packages can opt in or out of LTO compilation _via_ a UseLTO field in the DESCRIPTION file. (As usual this can be overridden by the command-line flags.) | If I understand things correctly, these flags cause a bit of a problem | trying to install the arrow package, since that package does not want to | override the CXX11FLAGS, I doubt that, based on a wee bit of experience with C++, C++11, and all that based coming up on 15 years with Rcpp, RInside and all that jazz. | but also does not work with LTO. Setting "UseLTO: | false" in the package description doesn't seem to work. That is something you may need to discuss with either R Core upstream (for the Makeconf), or maybe with the Arrow team for how they build the package. And there could of course be a bug but I remind you that Arrow itself is on CRAN. | Would it be possible to remove the flags -flto=auto and -ffat-lto-objects? Not likely for the package I ship. I tend to not second guess upstream, and have followed R Core pretty much without changes to the program for 20 years. If you think you need a locally modified version I may be able to help you build one. Hope this helps, Dirk PS As for my experiences with Arrow, well. I will try to remain brief: - while I have 25-ish years of experience building for Debian I _could never_ build Arrow even as shipped for R; I did file (GitHub) bug reports but they went nowhere (and I had no time for signing up for Jira, sorry) - this included failure on the "rather unusual" second installation as the Arrow build appears to not be entirely truthful by installing ... and then not working telling you to reinstall - that was generally on Ubuntu 'current at the time', but also on the Debian testing machine I use for Rcpp reverse depends (and where I build well over 2000 CRAN packages, yet Arrow remains "special") - as of Arrow 4.0.0 I can at least succeed at the second stage but I would be interested to hear how others fared on Debian or Ubuntu systems. -- https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
Dirk Eddelbuettel
2021-Jun-01 22:50 UTC
[R-sig-Debian] LTO flags in 4.1.0 Ubuntu 21.04 Makeconf
Two more follow-ups if I may: - the Debian and hence derived Ubuntu package of R 4.1.0 does *not* enable LTO yet, in other words I have not yet add --enable-lto to the configure call and we use to default of 'nope' - my dev box is still 20.10; I only run 21.04 on one small machine where I have not tried to build arrow; but under 20.10 + R 4.1.0 + arrow 4.0.? the two step dance that they force on us works Dirk -- https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org