This breaks opencv builds with dnn PACKAGECONFIG is enabled.

opencv is using -std=c++11 and now
recipe-sysroot/usr/include/google/protobuf/stubs/common.h
includes absl/strings/string_view.h which fails with
opencv/4.8.0/recipe-sysroot/usr/include/absl/base/policy_checks.h:79:2:
error: #error "C++ versions less than C++14 are not supported."
   79 | #error "C++ versions less than C++14 are not supported."
      |  ^~~~~

as shown in http://errors.yoctoproject.org/Errors/Details/739306/

Passing
-DOPENCV_SKIP_CMAKE_CXX_STANDARD=OFF -DCMAKE_CXX_STANDARD=14
in dnn PACKAGECONFIG:
PACKAGECONFIG[dnn] = "-DBUILD_opencv_dnn=ON -DPROTOBUF_UPDATE_FILES=ON
-DBUILD_PROTOBUF=OFF -DOPENCV_SKIP_CMAKE_CXX_STANDARD=OFF
-DCMAKE_CXX_STANDARD=14,-DBUILD_opencv_dnn=OFF,protobuf protobuf-native,"

helps with this first part, but then it fails to link with absl:
http://errors.yoctoproject.org/Errors/Details/739308/

At least protobuf isn't upgraded in nanbield branch yet, so it still builds
there.

On Wed, Sep 27, 2023 at 10:42 AM Clément Péron <[email protected]> wrote:

> From: Xiangyu Chen <[email protected]>
>
> Signed-off-by: Xiangyu Chen <[email protected]>
> Signed-off-by: Clément Péron <[email protected]>
> ---
>  ...efile-respect-CXX-LDFLAGS-variables-fix-.patch | 15 +++++++++------
>  .../{protobuf_3.21.12.bb => protobuf_4.22.2.bb}   | 11 ++++++++---
>  2 files changed, 17 insertions(+), 9 deletions(-)
>  rename meta-oe/recipes-devtools/protobuf/{protobuf_3.21.12.bb =>
> protobuf_4.22.2.bb} (86%)
>
> 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 36c3c597a..7c4bf260e 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
> @@ -30,7 +30,7 @@ Signed-off-by: Leon Anavi <[email protected]>
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
>  diff --git a/examples/Makefile b/examples/Makefile
> -index 1c7ec8d63..85f591231 100644
> +index ef7a4ef58..7206e14e1 100644
>  --- a/examples/Makefile
>  +++ b/examples/Makefile
>  @@ -2,6 +2,8 @@
> @@ -42,17 +42,20 @@ index 1c7ec8d63..85f591231 100644
>   all: cpp java python
>
>   cpp:    add_person_cpp    list_people_cpp
> -@@ -40,11 +42,11 @@ protoc_middleman_dart: addressbook.proto
> +@@ -41,11 +43,11 @@ protoc_middleman_dart: addressbook.proto
>
>   add_person_cpp: add_person.cc protoc_middleman
>         pkg-config --cflags protobuf  # fails if protobuf is not installed
> --      c++ -std=c++11 add_person.cc addressbook.pb.cc -o add_person_cpp
> `pkg-config --cflags --libs protobuf`
> -+      $(CXX) $(CXXFLAGS) $(LDFLAGS)
> ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) add_person.cc
> addressbook.pb.cc -o add_person_cpp
> +-      c++ -std=c++14 add_person.cc addressbook.pb.cc -o add_person_cpp
> `pkg-config --cflags --libs protobuf`
> ++      $(CXX) $(CXXFLAGS) $(LDFLAGS)
> ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) add_person.cc
> addressbook.pb.cc -o add_person_cpp #$(CXX) -std=c++17 $(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++ -std=c++11 list_people.cc addressbook.pb.cc -o
> list_people_cpp `pkg-config --cflags --libs protobuf`
> -+      $(CXX) $(CXXFLAGS) $(LDFLAGS)
> ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) list_people.cc
> addressbook.pb.cc -o list_people_cpp
> +-      c++ -std=c++14 list_people.cc addressbook.pb.cc -o
> list_people_cpp `pkg-config --cflags --libs protobuf`
> ++      $(CXX) $(CXXFLAGS) $(LDFLAGS)
> ../src/google/protobuf/.libs/timestamp.pb.o $(PROTOBUF) list_people.cc
> addressbook.pb.cc -o list_people_cpp #$(CXX) -std=c++17 $(PROTOBUF)
> list_people.cc addressbook.pb.cc -o list_people_cpp
>
>   add_person_dart: add_person.dart protoc_middleman_dart
>
> +--
> +2.34.1
> +
> diff --git a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb
> b/meta-oe/recipes-devtools/protobuf/protobuf_4.22.2.bb
> similarity index 86%
> rename from meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb
> rename to meta-oe/recipes-devtools/protobuf/protobuf_4.22.2.bb
> index d95e1c20f..b97da6ea6 100644
> --- a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb
> +++ b/meta-oe/recipes-devtools/protobuf/protobuf_4.22.2.bb
> @@ -7,12 +7,12 @@ SECTION = "console/tools"
>  LICENSE = "BSD-3-Clause"
>  LIC_FILES_CHKSUM = "file://LICENSE;md5=37b5762e07f0af8c74ce80a8bda4266b"
>
> -DEPENDS = "zlib"
> +DEPENDS = "zlib abseil-cpp"
>  DEPENDS:append:class-target = " protobuf-native"
>
> -SRCREV = "f0dc78d7e6e331b8c6bb2d5283e06aa26883ca7c"
> +SRCREV = "81f89d509d6771dcccb619cbe26ac86cec472582"
>
> -SRC_URI = "git://
> github.com/protocolbuffers/protobuf.git;branch=21.x;protocol=https \
> +SRC_URI = "gitsm://
> github.com/protocolbuffers/protobuf.git;branch=22.x;protocol=https \
>             file://run-ptest \
>
> file://0001-examples-Makefile-respect-CXX-LDFLAGS-variables-fix-.patch \
>             file://0001-Fix-linking-error-with-ld-gold.patch \
> @@ -35,6 +35,7 @@ EXTRA_OECMAKE += "\
>      -Dprotobuf_BUILD_LIBPROTOC=ON \
>      -Dprotobuf_BUILD_TESTS=OFF \
>      -Dprotobuf_BUILD_EXAMPLES=OFF \
> +    -Dprotobuf_ABSL_PROVIDER="package" \
>  "
>
>  TEST_SRC_DIR = "examples"
> @@ -52,7 +53,11 @@ do_compile_ptest() {
>         cp ${S}/${TEST_SRC_DIR}/Makefile "${B}/${TEST_SRC_DIR}/"
>         sed -e 's|libdir=|libdir=${PKG_CONFIG_SYSROOT_DIR}|' -i
> "${B}/${TEST_SRC_DIR}/protobuf.pc"
>         sed -e 's|Cflags:|Cflags: -I${S}/src|' -i
> "${B}/${TEST_SRC_DIR}/protobuf.pc"
> +       sed -e 's|Cflags:|Cflags: -I${WORKDIR}/recipe-sysroot{includedir}
> |' -i "${B}/${TEST_SRC_DIR}/protobuf.pc"
>         sed -e 's|Libs:|Libs: -L${B}|' -i
> "${B}/${TEST_SRC_DIR}/protobuf.pc"
> +       sed -e 's|Libs:|Libs: -L${WORKDIR}/recipe-sysroot/usr/lib|' -i
> "${B}/${TEST_SRC_DIR}/protobuf.pc"
> +       sed -e 's|Libs:|Libs: -labsl_log_internal_check_op |' -i
> "${B}/${TEST_SRC_DIR}/protobuf.pc"
> +       sed -e 's|Libs:|Libs: -labsl_log_internal_message |' -i
> "${B}/${TEST_SRC_DIR}/protobuf.pc"
>         # Until out-of-tree build of examples is supported, we have to use
> this approach
>         sed -e
> 's|../src/google/protobuf/.libs/timestamp.pb.o|${B}/CMakeFiles/libprotobuf.dir/src/google/protobuf/timestamp.pb.cc.o|'
> -i "${B}/${TEST_SRC_DIR}/Makefile"
>         export PKG_CONFIG_PATH="${B}/${TEST_SRC_DIR}"
> --
> 2.34.1
>
>
> 
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#105355): 
https://lists.openembedded.org/g/openembedded-devel/message/105355
Mute This Topic: https://lists.openembedded.org/mt/101613793/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to