[meta-oe] protobuf: fix ptest compilation with hardening flags

Submitted by Mikko Rapeli on July 12, 2019, 11:26 a.m. | Patch ID: 163020

Details

Message ID 1562930807-28919-1-git-send-email-mikko.rapeli@bmw.de
State Accepted
Commit 852f2d9d2630108e7bfe12f0b6e6449c2893f6e9
Headers show

Commit Message

Mikko Rapeli July 12, 2019, 11:26 a.m.
Build fails when conf/local.conf has both hardening and ptests enabled:

require conf/distro/include/security_flags.inc

DISTRO_FEATURES_append = " ptest"

Use CXXFLAGS for examples too to avoid hardening warnings
about using O0 optimization.

Then change linking order to avoid linker failures:

aarch64-poky-linux-g++  -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=form
at-security -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security
--sysroot=/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot
 -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/builder/src/base/build/tmp/work/aar
ch64-poky-linux/protobuf/3.8.0-r0=/usr/src/debug/protobuf/3.8.0-r0                      -fdebug-pre
fix-map=/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0=/usr/src/debug/pr
otobuf/3.8.0-r0                      -fdebug-prefix-map=/home/builder/src/base/build/tmp/work/aarch6
4-poky-linux/protobuf/3.8.0-r0/recipe-sysroot=                      -fdebug-prefix-map=/home/builder/src
/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot-native=  -fvisibility-inlin
es-hidden -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-p
rotector-strong -Wl,-z,relro,-z,now -pthread -I/home/builder/src/base/build/tmp/work/aarch64-poky-linux/p
rotobuf/3.8.0-r0/git/src -L/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r
0/git/src/.libs -L/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/re
cipe-sysroot/usr/lib -lprotobuf ../src/google/protobuf/.libs/timestamp.pb.o add_person.cc addressbook.pb.cc -
o add_person_cpp
/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot-native/usr
/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.1.0/ld: ../src/google/protobuf/.libs/timestamp.pb.o: in function `google::protobuf::Timestamp::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*) const':
/usr/src/debug/protobuf/3.8.0-r0/git/src/google/protobuf/timestamp.pb.cc:279: undefined reference to `google::protobuf::internal::WireFormat::SerializeUnknownFields(google::protobuf::UnknownFieldSet const&, google::protobuf::io::CodedOutputStream*)'

Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
---
 .../0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
index 029abfd..0a2e5e2 100644
--- a/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
+++ b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
@@ -45,12 +45,12 @@  index 4ad605641..31d887639 100644
  add_person_cpp: add_person.cc protoc_middleman
  	pkg-config --cflags protobuf  # fails if protobuf is not installed
 -	c++ add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config --cflags --libs protobuf`
-+	$(CXX) $(LDFLAGS) $(PROTOBUF) ../src/google/protobuf/.libs/timestamp.pb.o add_person.cc addressbook.pb.cc -o add_person_cpp
++	$(CXX) $(CXXFLAGS) $(LDFLAGS) ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) add_person.cc addressbook.pb.cc -o add_person_cpp
  
  list_people_cpp: list_people.cc protoc_middleman
  	pkg-config --cflags protobuf  # fails if protobuf is not installed
 -	c++ list_people.cc addressbook.pb.cc -o list_people_cpp `pkg-config --cflags --libs protobuf`
-+	$(CXX) $(LDFLAGS) $(PROTOBUF) ../src/google/protobuf/.libs/timestamp.pb.o list_people.cc addressbook.pb.cc -o list_people_cpp
++	$(CXX) $(CXXFLAGS) $(LDFLAGS) ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) list_people.cc addressbook.pb.cc -o list_people_cpp
  
  add_person_dart: add_person.dart protoc_middleman_dart
  

Comments

Martin Jansa July 12, 2019, 12:15 p.m.
Doesn't
http://git.openembedded.org/meta-openembedded/commit/?id=a2fac5a0a4848c2486cb3982f930f45f04469860
resolve
the same?

Your change might be better (then we should partially revert mine), because
I'm still seeing some recipes which depend on protobuf failing with similar
errors like protobuf itself did.

On Fri, Jul 12, 2019 at 1:58 PM Mikko Rapeli <mikko.rapeli@bmw.de> wrote:

> Build fails when conf/local.conf has both hardening and ptests enabled:
>
> require conf/distro/include/security_flags.inc
>
> DISTRO_FEATURES_append = " ptest"
>
> Use CXXFLAGS for examples too to avoid hardening warnings
> about using O0 optimization.
>
> Then change linking order to avoid linker failures:
>
> aarch64-poky-linux-g++  -fstack-protector-strong  -D_FORTIFY_SOURCE=2
> -Wformat -Wformat-security -Werror=form
> at-security -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat
> -Wformat-security -Werror=format-security
>
> --sysroot=/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot
>  -O2 -pipe -g -feliminate-unused-debug-types
> -fmacro-prefix-map=/home/builder/src/base/build/tmp/work/aar
> ch64-poky-linux/protobuf/3.8.0-r0=/usr/src/debug/protobuf/3.8.0-r0
>               -fdebug-pre
>
> fix-map=/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0=/usr/src/debug/pr
> otobuf/3.8.0-r0
> -fdebug-prefix-map=/home/builder/src/base/build/tmp/work/aarch6
> 4-poky-linux/protobuf/3.8.0-r0/recipe-sysroot=
> -fdebug-prefix-map=/home/builder/src
> /base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot-native=
> -fvisibility-inlin
> es-hidden -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
> -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-p
> rotector-strong -Wl,-z,relro,-z,now -pthread
> -I/home/builder/src/base/build/tmp/work/aarch64-poky-linux/p
> rotobuf/3.8.0-r0/git/src
> -L/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r
> 0/git/src/.libs
> -L/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/re
> cipe-sysroot/usr/lib -lprotobuf
> ../src/google/protobuf/.libs/timestamp.pb.o add_person.cc
> addressbook.pb.cc -
> o add_person_cpp
>
> /home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot-native/usr
> /bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.1.0/ld:
> ../src/google/protobuf/.libs/timestamp.pb.o: in function
> `google::protobuf::Timestamp::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*)
> const':
> /usr/src/debug/protobuf/3.8.0-r0/git/src/google/protobuf/
> timestamp.pb.cc:279: undefined reference to
> `google::protobuf::internal::WireFormat::SerializeUnknownFields(google::protobuf::UnknownFieldSet
> const&, google::protobuf::io::CodedOutputStream*)'
>
> Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
> ---
>  .../0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch   | 4
> ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git
> a/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> index 029abfd..0a2e5e2 100644
> ---
> a/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> +++
> b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> @@ -45,12 +45,12 @@ index 4ad605641..31d887639 100644
>   add_person_cpp: add_person.cc protoc_middleman
>         pkg-config --cflags protobuf  # fails if protobuf is not installed
>  -      c++ add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config
> --cflags --libs protobuf`
> -+      $(CXX) $(LDFLAGS) $(PROTOBUF)
> ../src/google/protobuf/.libs/timestamp.pb.o add_person.cc
> addressbook.pb.cc -o add_person_cpp
> ++      $(CXX) $(CXXFLAGS) $(LDFLAGS)
> ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) add_person.cc
> addressbook.pb.cc -o add_person_cpp
>
>   list_people_cpp: list_people.cc protoc_middleman
>         pkg-config --cflags protobuf  # fails if protobuf is not installed
>  -      c++ list_people.cc addressbook.pb.cc -o list_people_cpp
> `pkg-config --cflags --libs protobuf`
> -+      $(CXX) $(LDFLAGS) $(PROTOBUF)
> ../src/google/protobuf/.libs/timestamp.pb.o list_people.cc
> addressbook.pb.cc -o list_people_cpp
> ++      $(CXX) $(CXXFLAGS) $(LDFLAGS)
> ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) list_people.cc
> addressbook.pb.cc -o list_people_cpp
>
>   add_person_dart: add_person.dart protoc_middleman_dart
>
> --
> 1.9.1
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
>
Martin Jansa July 12, 2019, 12:17 p.m.
Nevermind, now I see that your changes is based on top of mine.

Will re-test with your change - strange that I wasn't seeing it here, I do
have security-flags as well as ptest enabled as well.

On Fri, Jul 12, 2019 at 2:15 PM Martin Jansa <martin.jansa@gmail.com> wrote:

> Doesn't
> http://git.openembedded.org/meta-openembedded/commit/?id=a2fac5a0a4848c2486cb3982f930f45f04469860 resolve
> the same?
>
> Your change might be better (then we should partially revert mine),
> because I'm still seeing some recipes which depend on protobuf failing with
> similar errors like protobuf itself did.
>
> On Fri, Jul 12, 2019 at 1:58 PM Mikko Rapeli <mikko.rapeli@bmw.de> wrote:
>
>> Build fails when conf/local.conf has both hardening and ptests enabled:
>>
>> require conf/distro/include/security_flags.inc
>>
>> DISTRO_FEATURES_append = " ptest"
>>
>> Use CXXFLAGS for examples too to avoid hardening warnings
>> about using O0 optimization.
>>
>> Then change linking order to avoid linker failures:
>>
>> aarch64-poky-linux-g++  -fstack-protector-strong  -D_FORTIFY_SOURCE=2
>> -Wformat -Wformat-security -Werror=form
>> at-security -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat
>> -Wformat-security -Werror=format-security
>>
>> --sysroot=/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot
>>  -O2 -pipe -g -feliminate-unused-debug-types
>> -fmacro-prefix-map=/home/builder/src/base/build/tmp/work/aar
>> ch64-poky-linux/protobuf/3.8.0-r0=/usr/src/debug/protobuf/3.8.0-r0
>>               -fdebug-pre
>>
>> fix-map=/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0=/usr/src/debug/pr
>> otobuf/3.8.0-r0
>> -fdebug-prefix-map=/home/builder/src/base/build/tmp/work/aarch6
>> 4-poky-linux/protobuf/3.8.0-r0/recipe-sysroot=
>> -fdebug-prefix-map=/home/builder/src
>> /base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot-native=
>> -fvisibility-inlin
>> es-hidden -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
>> -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-p
>> rotector-strong -Wl,-z,relro,-z,now -pthread
>> -I/home/builder/src/base/build/tmp/work/aarch64-poky-linux/p
>> rotobuf/3.8.0-r0/git/src
>> -L/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r
>> 0/git/src/.libs
>> -L/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/re
>> cipe-sysroot/usr/lib -lprotobuf
>> ../src/google/protobuf/.libs/timestamp.pb.o add_person.cc
>> addressbook.pb.cc -
>> o add_person_cpp
>>
>> /home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot-native/usr
>> /bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.1.0/ld:
>> ../src/google/protobuf/.libs/timestamp.pb.o: in function
>> `google::protobuf::Timestamp::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*)
>> const':
>> /usr/src/debug/protobuf/3.8.0-r0/git/src/google/protobuf/
>> timestamp.pb.cc:279: undefined reference to
>> `google::protobuf::internal::WireFormat::SerializeUnknownFields(google::protobuf::UnknownFieldSet
>> const&, google::protobuf::io::CodedOutputStream*)'
>>
>> Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
>> ---
>>  .../0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch   |
>> 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git
>> a/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
>> b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
>> index 029abfd..0a2e5e2 100644
>> ---
>> a/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
>> +++
>> b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
>> @@ -45,12 +45,12 @@ index 4ad605641..31d887639 100644
>>   add_person_cpp: add_person.cc protoc_middleman
>>         pkg-config --cflags protobuf  # fails if protobuf is not installed
>>  -      c++ add_person.cc addressbook.pb.cc -o add_person_cpp
>> `pkg-config --cflags --libs protobuf`
>> -+      $(CXX) $(LDFLAGS) $(PROTOBUF)
>> ../src/google/protobuf/.libs/timestamp.pb.o add_person.cc
>> addressbook.pb.cc -o add_person_cpp
>> ++      $(CXX) $(CXXFLAGS) $(LDFLAGS)
>> ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) add_person.cc
>> addressbook.pb.cc -o add_person_cpp
>>
>>   list_people_cpp: list_people.cc protoc_middleman
>>         pkg-config --cflags protobuf  # fails if protobuf is not installed
>>  -      c++ list_people.cc addressbook.pb.cc -o list_people_cpp
>> `pkg-config --cflags --libs protobuf`
>> -+      $(CXX) $(LDFLAGS) $(PROTOBUF)
>> ../src/google/protobuf/.libs/timestamp.pb.o list_people.cc
>> addressbook.pb.cc -o list_people_cpp
>> ++      $(CXX) $(CXXFLAGS) $(LDFLAGS)
>> ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) list_people.cc
>> addressbook.pb.cc -o list_people_cpp
>>
>>   add_person_dart: add_person.dart protoc_middleman_dart
>>
>> --
>> 1.9.1
>>
>> --
>> _______________________________________________
>> Openembedded-devel mailing list
>> Openembedded-devel@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
>>
>
Mikko Rapeli July 12, 2019, 1:35 p.m.
On Fri, Jul 12, 2019 at 02:17:10PM +0200, Martin Jansa wrote:
> Nevermind, now I see that your changes is based on top of mine.
> 
> Will re-test with your change - strange that I wasn't seeing it here, I do
> have security-flags as well as ptest enabled as well.

Yes, my change is on top of latest master with your changes. I saw it in
a larger project tree but reproduced with hardening flags and ptest support
in plain poky + meta-openembedded upstream build.

-Mikko

> On Fri, Jul 12, 2019 at 2:15 PM Martin Jansa <martin.jansa@gmail.com> wrote:
> 
> > Doesn't
> > http://git.openembedded.org/meta-openembedded/commit/?id=a2fac5a0a4848c2486cb3982f930f45f04469860 resolve
> > the same?
> >
> > Your change might be better (then we should partially revert mine),
> > because I'm still seeing some recipes which depend on protobuf failing with
> > similar errors like protobuf itself did.
> >
> > On Fri, Jul 12, 2019 at 1:58 PM Mikko Rapeli <mikko.rapeli@bmw.de> wrote:
> >
> >> Build fails when conf/local.conf has both hardening and ptests enabled:
> >>
> >> require conf/distro/include/security_flags.inc
> >>
> >> DISTRO_FEATURES_append = " ptest"
> >>
> >> Use CXXFLAGS for examples too to avoid hardening warnings
> >> about using O0 optimization.
> >>
> >> Then change linking order to avoid linker failures:
> >>
> >> aarch64-poky-linux-g++  -fstack-protector-strong  -D_FORTIFY_SOURCE=2
> >> -Wformat -Wformat-security -Werror=form
> >> at-security -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat
> >> -Wformat-security -Werror=format-security
> >>
> >> --sysroot=/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot
> >>  -O2 -pipe -g -feliminate-unused-debug-types
> >> -fmacro-prefix-map=/home/builder/src/base/build/tmp/work/aar
> >> ch64-poky-linux/protobuf/3.8.0-r0=/usr/src/debug/protobuf/3.8.0-r0
> >>               -fdebug-pre
> >>
> >> fix-map=/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0=/usr/src/debug/pr
> >> otobuf/3.8.0-r0
> >> -fdebug-prefix-map=/home/builder/src/base/build/tmp/work/aarch6
> >> 4-poky-linux/protobuf/3.8.0-r0/recipe-sysroot=
> >> -fdebug-prefix-map=/home/builder/src
> >> /base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot-native=
> >> -fvisibility-inlin
> >> es-hidden -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
> >> -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-p
> >> rotector-strong -Wl,-z,relro,-z,now -pthread
> >> -I/home/builder/src/base/build/tmp/work/aarch64-poky-linux/p
> >> rotobuf/3.8.0-r0/git/src
> >> -L/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r
> >> 0/git/src/.libs
> >> -L/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/re
> >> cipe-sysroot/usr/lib -lprotobuf
> >> ../src/google/protobuf/.libs/timestamp.pb.o add_person.cc
> >> addressbook.pb.cc -
> >> o add_person_cpp
> >>
> >> /home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot-native/usr
> >> /bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.1.0/ld:
> >> ../src/google/protobuf/.libs/timestamp.pb.o: in function
> >> `google::protobuf::Timestamp::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*)
> >> const':
> >> /usr/src/debug/protobuf/3.8.0-r0/git/src/google/protobuf/
> >> timestamp.pb.cc:279: undefined reference to
> >> `google::protobuf::internal::WireFormat::SerializeUnknownFields(google::protobuf::UnknownFieldSet
> >> const&, google::protobuf::io::CodedOutputStream*)'
> >>
> >> Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
> >> ---
> >>  .../0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch   |
> >> 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git
> >> a/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> >> b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> >> index 029abfd..0a2e5e2 100644
> >> ---
> >> a/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> >> +++
> >> b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> >> @@ -45,12 +45,12 @@ index 4ad605641..31d887639 100644
> >>   add_person_cpp: add_person.cc protoc_middleman
> >>         pkg-config --cflags protobuf  # fails if protobuf is not installed
> >>  -      c++ add_person.cc addressbook.pb.cc -o add_person_cpp
> >> `pkg-config --cflags --libs protobuf`
> >> -+      $(CXX) $(LDFLAGS) $(PROTOBUF)
> >> ../src/google/protobuf/.libs/timestamp.pb.o add_person.cc
> >> addressbook.pb.cc -o add_person_cpp
> >> ++      $(CXX) $(CXXFLAGS) $(LDFLAGS)
> >> ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) add_person.cc
> >> addressbook.pb.cc -o add_person_cpp
> >>
> >>   list_people_cpp: list_people.cc protoc_middleman
> >>         pkg-config --cflags protobuf  # fails if protobuf is not installed
> >>  -      c++ list_people.cc addressbook.pb.cc -o list_people_cpp
> >> `pkg-config --cflags --libs protobuf`
> >> -+      $(CXX) $(LDFLAGS) $(PROTOBUF)
> >> ../src/google/protobuf/.libs/timestamp.pb.o list_people.cc
> >> addressbook.pb.cc -o list_people_cpp
> >> ++      $(CXX) $(CXXFLAGS) $(LDFLAGS)
> >> ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) list_people.cc
> >> addressbook.pb.cc -o list_people_cpp
> >>
> >>   add_person_dart: add_person.dart protoc_middleman_dart
> >>
> >> --
> >> 1.9.1
> >>
> >> --
> >> _______________________________________________
> >> Openembedded-devel mailing list
> >> Openembedded-devel@lists.openembedded.org
> >> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
> >>
> >
Khem Raj July 12, 2019, 4:40 p.m.
On Fri, Jul 12, 2019 at 5:15 AM Martin Jansa <martin.jansa@gmail.com> wrote:
>
> Doesn't
> http://git.openembedded.org/meta-openembedded/commit/?id=a2fac5a0a4848c2486cb3982f930f45f04469860
> resolve
> the same?

actually I see they regressed see
https://errors.yoctoproject.org/Errors/Details/251505/

>
> Your change might be better (then we should partially revert mine), because
> I'm still seeing some recipes which depend on protobuf failing with similar
> errors like protobuf itself did.

and the above commit is applied, so this change should be made on top
of that if not done already

>
> On Fri, Jul 12, 2019 at 1:58 PM Mikko Rapeli <mikko.rapeli@bmw.de> wrote:
>
> > Build fails when conf/local.conf has both hardening and ptests enabled:
> >
> > require conf/distro/include/security_flags.inc
> >
> > DISTRO_FEATURES_append = " ptest"
> >
> > Use CXXFLAGS for examples too to avoid hardening warnings
> > about using O0 optimization.
> >
> > Then change linking order to avoid linker failures:
> >
> > aarch64-poky-linux-g++  -fstack-protector-strong  -D_FORTIFY_SOURCE=2
> > -Wformat -Wformat-security -Werror=form
> > at-security -fstack-protector-strong  -D_FORTIFY_SOURCE=2 -Wformat
> > -Wformat-security -Werror=format-security
> >
> > --sysroot=/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot
> >  -O2 -pipe -g -feliminate-unused-debug-types
> > -fmacro-prefix-map=/home/builder/src/base/build/tmp/work/aar
> > ch64-poky-linux/protobuf/3.8.0-r0=/usr/src/debug/protobuf/3.8.0-r0
> >               -fdebug-pre
> >
> > fix-map=/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0=/usr/src/debug/pr
> > otobuf/3.8.0-r0
> > -fdebug-prefix-map=/home/builder/src/base/build/tmp/work/aarch6
> > 4-poky-linux/protobuf/3.8.0-r0/recipe-sysroot=
> > -fdebug-prefix-map=/home/builder/src
> > /base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot-native=
> > -fvisibility-inlin
> > es-hidden -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
> > -fstack-protector-strong -Wl,-z,relro,-z,now -fstack-p
> > rotector-strong -Wl,-z,relro,-z,now -pthread
> > -I/home/builder/src/base/build/tmp/work/aarch64-poky-linux/p
> > rotobuf/3.8.0-r0/git/src
> > -L/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r
> > 0/git/src/.libs
> > -L/home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/re
> > cipe-sysroot/usr/lib -lprotobuf
> > ../src/google/protobuf/.libs/timestamp.pb.o add_person.cc
> > addressbook.pb.cc -
> > o add_person_cpp
> >
> > /home/builder/src/base/build/tmp/work/aarch64-poky-linux/protobuf/3.8.0-r0/recipe-sysroot-native/usr
> > /bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/9.1.0/ld:
> > ../src/google/protobuf/.libs/timestamp.pb.o: in function
> > `google::protobuf::Timestamp::SerializeWithCachedSizes(google::protobuf::io::CodedOutputStream*)
> > const':
> > /usr/src/debug/protobuf/3.8.0-r0/git/src/google/protobuf/
> > timestamp.pb.cc:279: undefined reference to
> > `google::protobuf::internal::WireFormat::SerializeUnknownFields(google::protobuf::UnknownFieldSet
> > const&, google::protobuf::io::CodedOutputStream*)'
> >
> > Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
> > ---
> >  .../0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch   | 4
> > ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git
> > a/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> > b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> > index 029abfd..0a2e5e2 100644
> > ---
> > a/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> > +++
> > b/meta-oe/recipes-devtools/protobuf/protobuf/0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch
> > @@ -45,12 +45,12 @@ index 4ad605641..31d887639 100644
> >   add_person_cpp: add_person.cc protoc_middleman
> >         pkg-config --cflags protobuf  # fails if protobuf is not installed
> >  -      c++ add_person.cc addressbook.pb.cc -o add_person_cpp `pkg-config
> > --cflags --libs protobuf`
> > -+      $(CXX) $(LDFLAGS) $(PROTOBUF)
> > ../src/google/protobuf/.libs/timestamp.pb.o add_person.cc
> > addressbook.pb.cc -o add_person_cpp
> > ++      $(CXX) $(CXXFLAGS) $(LDFLAGS)
> > ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) add_person.cc
> > addressbook.pb.cc -o add_person_cpp
> >
> >   list_people_cpp: list_people.cc protoc_middleman
> >         pkg-config --cflags protobuf  # fails if protobuf is not installed
> >  -      c++ list_people.cc addressbook.pb.cc -o list_people_cpp
> > `pkg-config --cflags --libs protobuf`
> > -+      $(CXX) $(LDFLAGS) $(PROTOBUF)
> > ../src/google/protobuf/.libs/timestamp.pb.o list_people.cc
> > addressbook.pb.cc -o list_people_cpp
> > ++      $(CXX) $(CXXFLAGS) $(LDFLAGS)
> > ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) list_people.cc
> > addressbook.pb.cc -o list_people_cpp
> >
> >   add_person_dart: add_person.dart protoc_middleman_dart
> >
> > --
> > 1.9.1
> >
> > --
> > _______________________________________________
> > Openembedded-devel mailing list
> > Openembedded-devel@lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-devel
> >
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel