Karl Dunkle Werner
2021-Jun-01 22:22 UTC
[R-sig-Debian] LTO flags in 4.1.0 Ubuntu 21.04 Makeconf
Hello, 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) 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, but also does not work with LTO. Setting "UseLTO: false" in the package description doesn't seem to work. Would it be possible to remove the flags -flto=auto and -ffat-lto-objects? See https://issues.apache.org/jira/browse/ARROW-12853 for a discussion of installation with these flags and https://issues.apache.org/jira/browse/ARROW-9616 for a broader discussion of LTO in Arrow. My apologies if this is the wrong place to report this kind of issue. The entire Makeconf file is attached to the first of those Arrow issues: https://issues.apache.org/jira/secure/attachment/13025950/Makeconf_local The file appears in the package https://cloud.r-project.org/bin/linux/ubuntu/hirsute-cran40/r-base-core_4.1.0-1.2104.0_amd64.deb. These flags are not set in the Debian Bullseye version ( https://cloud.r-project.org/bin/linux/debian/bullseye-cran40/r-base-core_4.1.0-1~bullseyecran.0_amd64.deb) or the Ubuntu 20.10 version ( https://cloud.r-project.org/bin/linux/ubuntu/groovy-cran40/r-base-core_4.1.0-1.2010.0_amd64.deb ). (For anyone who is unfamiliar, as I was, the Makeconf file is in data/etc/R/, after extracting both the deb package and the data.tar.xz directory.) Thank you, Karl [[alternative HTML version deleted]]
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