Compiling packages with C++ code using the default r-base-dev configuration on debian:sid shows a lot of: cc1plus: warning: '-Werror=' argument '-Werror=implicit-function-declaration' is not valid for C++ Can this flag be removed from R CMD config CXXFLAGS?
Default CXXFLAGS
6 messages · Jeroen Ooms, Dirk Eddelbuettel, Kurt Hornik +1 more
On 21 May 2024 at 13:01, Jeroen Ooms wrote:
| Compiling packages with C++ code using the default r-base-dev | configuration on debian:sid shows a lot of: | | cc1plus: warning: '-Werror=' argument | '-Werror=implicit-function-declaration' is not valid for C++ | | Can this flag be removed from R CMD config CXXFLAGS? "No." That was quoting Simon Urbanek from a few years ago. You cannot undo what it is in R's own /etc/R/Makeconf via a programmatic way via some sort of option or alike. It is fixed. You and I know that you can add to the right-hand side via ~/.R/Makeconf and that is about it AFAIK. Of course you can also call `sed` and alike to modify it (in a container, say). Maybe that is what you really want to do. Actually, it is also a 'conffile' as far as `apt` and friends are concerned. So you can always do `sudo vi ...` it and call it a day. The changes should persist in the way changes you the admin made to your config files persist. I am afraid that is all we have here. Dirk
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
On Tue, 21 May 2024 07:08:02 -0500
Dirk Eddelbuettel <edd at debian.org> wrote:
You cannot undo what it is in R's own /etc/R/Makeconf via a programmatic way via some sort of option or alike.
I think this is about the following line in debian/rules: optimflags = `DEB_BUILD_MAINT_OPTIONS=optimize=-lto dpkg-buildflags --get CFLAGS` https://sources.debian.org/src/r-base/4.4.0-2/debian/rules/#L101 ...which later propagares to cxxflags = $(optimflags) and eventually CXXFLAGS="$(cxxflags)" ... ./configure. On Sid, dpkg-buildflags --get CFLAGS includes -Werror=implicit-function-declaration, which g++ doesn't like: root at 020af1fe3ba2:/# g++ -Werror=implicit-function-declaration -c ex.cpp cc1plus: warning: '-Werror=' argument '-Werror=implicit-function-declaration' is not valid for C++
Best regards, Ivan
Ivan Krylov writes:
On Tue, 21 May 2024 07:08:02 -0500 Dirk Eddelbuettel <edd at debian.org> wrote:
You cannot undo what it is in R's own /etc/R/Makeconf via a programmatic way via some sort of option or alike.
I think this is about the following line in debian/rules:
Without having looked in much detail, I guess foer the CXXFLAGS we want dpkg-buildflags --get CXXFLAGS? Best -k
optimflags = `DEB_BUILD_MAINT_OPTIONS=optimize=-lto dpkg-buildflags --get CFLAGS`
...which later propagares to cxxflags = $(optimflags) and eventually CXXFLAGS="$(cxxflags)" ... ./configure.
On Sid, dpkg-buildflags --get CFLAGS includes -Werror=implicit-function-declaration, which g++ doesn't like:
root at 020af1fe3ba2:/# g++ -Werror=implicit-function-declaration -c ex.cpp cc1plus: warning: '-Werror=' argument '-Werror=implicit-function-declaration' is not valid for C++
-- Best regards, Ivan
_______________________________________________ R-SIG-Debian mailing list R-SIG-Debian at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-debian
On Tue, 21 May 2024 14:48:48 +0200
Kurt Hornik <Kurt.Hornik at wu.ac.at> wrote:
I guess foer the CXXFLAGS we want dpkg-buildflags --get CXXFLAGS?
It must be the case. It's both the documented option [1] and it currently differs from CFLAGS in the offending flag: root at 93e09ba5b6fb:/# diff -u <(dpkg-buildflags --get CFLAGS | sed 's/ /\n/g') <(dpkg-buildflags --get CXXFLAGS | sed 's/ /\n/g') --- /dev/fd/63 2024-05-21 12:54:12.275778573 +0000 +++ /dev/fd/62 2024-05-21 12:54:12.275778573 +0000 @@ -1,6 +1,5 @@ -g -O2 --Werror=implicit-function-declaration -ffile-prefix-map=/=. -fstack-protector-strong -fstack-clash-protection
Best regards, Ivan [1] https://manpages.debian.org/bookworm/dpkg-dev/dpkg-buildflags.1.en.html#CXXFLAGS
On 21 May 2024 at 15:59, Ivan Krylov wrote:
| On Tue, 21 May 2024 14:48:48 +0200
| Kurt Hornik <Kurt.Hornik at wu.ac.at> wrote:
| | > I guess foer the CXXFLAGS we want dpkg-buildflags --get CXXFLAGS? Good catch, and expansion, by both of you. | It must be the case. It's both the documented option [1] and it | currently differs from CFLAGS in the offending flag: | | root at 93e09ba5b6fb:/# diff -u <(dpkg-buildflags --get CFLAGS | sed 's/ /\n/g') <(dpkg-buildflags --get CXXFLAGS | sed 's/ /\n/g') | --- /dev/fd/63 2024-05-21 12:54:12.275778573 +0000 | +++ /dev/fd/62 2024-05-21 12:54:12.275778573 +0000 | @@ -1,6 +1,5 @@ | -g | -O2 | --Werror=implicit-function-declaration | -ffile-prefix-map=/=. | -fstack-protector-strong | -fstack-clash-protection Differently put using a Docker invocation away from my Ubuntu host to a Debian setting: $ docker run --rm -ti rocker/r-base dpkg-buildflags | egrep '^(CXXFLAGS|CFLAGS)' CFLAGS=-g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection CFLAGS_FOR_BUILD=-g -O2 CXXFLAGS=-g -O2 -ffile-prefix-map=/=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection CXXFLAGS_FOR_BUILD=-g -O2 $ So it looks like picking the CXXFLAGS will remove the unwanted -Werror=... Thanks all -- I will make that change. Dirk PS Kurt, it would still be nice if you could let us 'sed-filter' or alike the defaults...
dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org