[meta-oe] rocksdb: Fix build failure due to GCC9 deprecated-copy pessimizing-move

Submitted by zhe.he@windriver.com on May 31, 2019, 2:52 a.m. | Patch ID: 161810

Details

Message ID 1559271137-240663-1-git-send-email-zhe.he@windriver.com
State Superseded
Commit 2ea48784bc3e18b208520bd2fb32f68a2608028b
Headers show

Commit Message

zhe.he@windriver.com May 31, 2019, 2:52 a.m.
From: He Zhe <zhe.he@windriver.com>

GCC9 introduce more stricter checks deprecated-copy and pessimizing-move, while
rocksdb uses -Werror and causes the following build error.

db/version_edit.h:178:33: error: implicitly-declared 'constexpr rocksdb::FileDescriptor::FileDescriptor(const rocksdb::FileDescriptor&)' is deprecated [-Werror=deprecated-copy]

utilities/persistent_cache/persistent_cache_util.h:51:23: error: moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
 meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
index 8d84619..bbd8e4f 100644
--- a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
+++ b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
@@ -31,6 +31,9 @@  EXTRA_OECMAKE = "\
     -DWITH_TESTS=OFF \
     -DWITH_TOOLS=OFF \
 "
+do_compile_prepend() {
+    sed -i 's/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=shadow")/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=shadow -Wno-error=deprecated-copy -Wno-error=pessimizing-move")/' ${S}/CMakeLists.txt
+}
 
 do_install_append() {
     # fix for qa check buildpaths

Comments

Adrian Bunk May 31, 2019, 8:44 a.m.
On Fri, May 31, 2019 at 10:52:17AM +0800, zhe.he@windriver.com wrote:
> From: He Zhe <zhe.he@windriver.com>
> 
> GCC9 introduce more stricter checks deprecated-copy and pessimizing-move, while
> rocksdb uses -Werror and causes the following build error.
> 
> db/version_edit.h:178:33: error: implicitly-declared 'constexpr rocksdb::FileDescriptor::FileDescriptor(const rocksdb::FileDescriptor&)' is deprecated [-Werror=deprecated-copy]
> 
> utilities/persistent_cache/persistent_cache_util.h:51:23: error: moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]
> 
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
>  meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> index 8d84619..bbd8e4f 100644
> --- a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> +++ b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> @@ -31,6 +31,9 @@ EXTRA_OECMAKE = "\
>      -DWITH_TESTS=OFF \
>      -DWITH_TOOLS=OFF \
>  "
> +do_compile_prepend() {
> +    sed -i 's/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=shadow")/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=shadow -Wno-error=deprecated-copy -Wno-error=pessimizing-move")/' ${S}/CMakeLists.txt
> +}
>...

It would be more elegant to add -DFAIL_ON_WARNINGS=OFF to EXTRA_OECMAKE 
instead.

This is also correct in general, since the few packages using -Werror 
are frequently causing this kind of problem for distributions.

cu
Adrian
Khem Raj June 14, 2019, 7:25 p.m.
On Fri, May 31, 2019 at 1:45 AM Adrian Bunk <bunk@stusta.de> wrote:
>
> On Fri, May 31, 2019 at 10:52:17AM +0800, zhe.he@windriver.com wrote:
> > From: He Zhe <zhe.he@windriver.com>
> >
> > GCC9 introduce more stricter checks deprecated-copy and pessimizing-move, while
> > rocksdb uses -Werror and causes the following build error.
> >
> > db/version_edit.h:178:33: error: implicitly-declared 'constexpr rocksdb::FileDescriptor::FileDescriptor(const rocksdb::FileDescriptor&)' is deprecated [-Werror=deprecated-copy]
> >
> > utilities/persistent_cache/persistent_cache_util.h:51:23: error: moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]
> >
> > Signed-off-by: He Zhe <zhe.he@windriver.com>
> > ---
> >  meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> > index 8d84619..bbd8e4f 100644
> > --- a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> > +++ b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> > @@ -31,6 +31,9 @@ EXTRA_OECMAKE = "\
> >      -DWITH_TESTS=OFF \
> >      -DWITH_TOOLS=OFF \
> >  "
> > +do_compile_prepend() {
> > +    sed -i 's/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=shadow")/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=shadow -Wno-error=deprecated-copy -Wno-error=pessimizing-move")/' ${S}/CMakeLists.txt
> > +}
> >...
>
> It would be more elegant to add -DFAIL_ON_WARNINGS=OFF to EXTRA_OECMAKE
> instead.
>
> This is also correct in general, since the few packages using -Werror
> are frequently causing this kind of problem for distributions.
>

we also have a patch for new 6.x version, I am inclined to take that,
so please check if this patch is still needed or not on that version
secondly I see that deprecate-copy is gcc specific option, so mark it
with toolchain-gcc override so if needed

> cu
> Adrian
>
> --
>
>        "Is there not promise of rain?" Ling Tan asked suddenly out
>         of the darkness. There had been need of rain for many days.
>        "Only a promise," Lao Er said.
>                                        Pearl S. Buck - Dragon Seed
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
Adrian Bunk June 14, 2019, 11:29 p.m.
On Fri, Jun 14, 2019 at 12:25:11PM -0700, Khem Raj wrote:
> On Fri, May 31, 2019 at 1:45 AM Adrian Bunk <bunk@stusta.de> wrote:
> >
> > On Fri, May 31, 2019 at 10:52:17AM +0800, zhe.he@windriver.com wrote:
> > > From: He Zhe <zhe.he@windriver.com>
> > >
> > > GCC9 introduce more stricter checks deprecated-copy and pessimizing-move, while
> > > rocksdb uses -Werror and causes the following build error.
> > >
> > > db/version_edit.h:178:33: error: implicitly-declared 'constexpr rocksdb::FileDescriptor::FileDescriptor(const rocksdb::FileDescriptor&)' is deprecated [-Werror=deprecated-copy]
> > >
> > > utilities/persistent_cache/persistent_cache_util.h:51:23: error: moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]
> > >
> > > Signed-off-by: He Zhe <zhe.he@windriver.com>
> > > ---
> > >  meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> > > index 8d84619..bbd8e4f 100644
> > > --- a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> > > +++ b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> > > @@ -31,6 +31,9 @@ EXTRA_OECMAKE = "\
> > >      -DWITH_TESTS=OFF \
> > >      -DWITH_TOOLS=OFF \
> > >  "
> > > +do_compile_prepend() {
> > > +    sed -i 's/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=shadow")/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=shadow -Wno-error=deprecated-copy -Wno-error=pessimizing-move")/' ${S}/CMakeLists.txt
> > > +}
> > >...
> >
> > It would be more elegant to add -DFAIL_ON_WARNINGS=OFF to EXTRA_OECMAKE
> > instead.
> >
> > This is also correct in general, since the few packages using -Werror
> > are frequently causing this kind of problem for distributions.
> >
> 
> we also have a patch for new 6.x version, I am inclined to take that,
> so please check if this patch is still needed or not on that version
>...

The 6.0.2 patch adds a fix for this on top of 6.0.2:
    This also includes a patch that fixes GCC9 compatibility, it's currently submitted
    upstream but not yet accepted due to style issues.


cu
Adrian
Khem Raj June 14, 2019, 11:45 p.m.
On Fri, Jun 14, 2019 at 4:29 PM Adrian Bunk <bunk@stusta.de> wrote:
>
> On Fri, Jun 14, 2019 at 12:25:11PM -0700, Khem Raj wrote:
> > On Fri, May 31, 2019 at 1:45 AM Adrian Bunk <bunk@stusta.de> wrote:
> > >
> > > On Fri, May 31, 2019 at 10:52:17AM +0800, zhe.he@windriver.com wrote:
> > > > From: He Zhe <zhe.he@windriver.com>
> > > >
> > > > GCC9 introduce more stricter checks deprecated-copy and pessimizing-move, while
> > > > rocksdb uses -Werror and causes the following build error.
> > > >
> > > > db/version_edit.h:178:33: error: implicitly-declared 'constexpr rocksdb::FileDescriptor::FileDescriptor(const rocksdb::FileDescriptor&)' is deprecated [-Werror=deprecated-copy]
> > > >
> > > > utilities/persistent_cache/persistent_cache_util.h:51:23: error: moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]
> > > >
> > > > Signed-off-by: He Zhe <zhe.he@windriver.com>
> > > > ---
> > > >  meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> > > > index 8d84619..bbd8e4f 100644
> > > > --- a/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> > > > +++ b/meta-oe/recipes-dbs/rocksdb/rocksdb_git.bb
> > > > @@ -31,6 +31,9 @@ EXTRA_OECMAKE = "\
> > > >      -DWITH_TESTS=OFF \
> > > >      -DWITH_TOOLS=OFF \
> > > >  "
> > > > +do_compile_prepend() {
> > > > +    sed -i 's/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=shadow")/set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=shadow -Wno-error=deprecated-copy -Wno-error=pessimizing-move")/' ${S}/CMakeLists.txt
> > > > +}
> > > >...
> > >
> > > It would be more elegant to add -DFAIL_ON_WARNINGS=OFF to EXTRA_OECMAKE
> > > instead.
> > >
> > > This is also correct in general, since the few packages using -Werror
> > > are frequently causing this kind of problem for distributions.
> > >
> >
> > we also have a patch for new 6.x version, I am inclined to take that,
> > so please check if this patch is still needed or not on that version
> >...
>
> The 6.0.2 patch adds a fix for this on top of 6.0.2:
>     This also includes a patch that fixes GCC9 compatibility, it's currently submitted
>     upstream but not yet accepted due to style issues.

yeah I think the patch is quite gcc specific, not upstream worthy IMO

>
>
> cu
> Adrian
>
> --
>
>        "Is there not promise of rain?" Ling Tan asked suddenly out
>         of the darkness. There had been need of rain for many days.
>        "Only a promise," Lao Er said.
>                                        Pearl S. Buck - Dragon Seed
>