Skip to contentSkip to conversation

abseil-cpp: add recipe for git version

PATCH Superseded Sinan Kaya 3 participants 7 messages Feb 10, 2020 – Feb 11, 2020

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Sinan Kaya

author
#0 lore raw

PATCH v2 1/1 abseil-cpp: add recipe for git version

The repository contains the Abseil C++ library code. Abseil is an open-source collection of C++ code (compliant to C++11) designed to augment the C++ standard library.

https://github.com/abseil/abseil-cpp

---
 ...e-maes-option-from-cross-compilation.patch | 53 +++++++++++++++++++
 .../abseil-cpp/abseil-cpp_git.bb              | 42 +++++++++++++++
 2 files changed, 95 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-Remove-maes-option-from-cross-compilation.patch
 create mode 100644 meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb
meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-Remove-maes-option-from-cross-compilation.patch new file +53 -0
new file mode 100644
index 0000000000..4c41cd8902
@@ -0,0 +1,53 @@
+From 70926666f7c5c35add363e3bcade6eaabace7206 Mon Sep 17 00:00:00 2001
+From: Sinan Kaya <[email protected]>
+Date: Mon, 3 Feb 2020 03:25:57 +0000
+Subject: [PATCH] Remove maes option from cross-compilation
+
+---
+ absl/copts/GENERATED_AbseilCopts.cmake | 4 ----
+ absl/copts/GENERATED_copts.bzl         | 4 ----
+ absl/copts/copts.py                    | 4 ----
+ 3 files changed, 12 deletions(-)
+
+diff --git a/absl/copts/GENERATED_AbseilCopts.cmake b/absl/copts/GENERATED_AbseilCopts.cmake
+index 01bd40b..af99694 100644
+--- a/absl/copts/GENERATED_AbseilCopts.cmake
++++ b/absl/copts/GENERATED_AbseilCopts.cmake
+@@ -230,7 +230,3 @@ list(APPEND ABSL_RANDOM_HWAES_MSVC_X64_FLAGS
+     "/Ob2"
+ )
+ 
+-list(APPEND ABSL_RANDOM_HWAES_X64_FLAGS
+-    "-maes"
+-    "-msse4.1"
+-)
+diff --git a/absl/copts/GENERATED_copts.bzl b/absl/copts/GENERATED_copts.bzl
+index 82f332f..9a548d1 100644
+--- a/absl/copts/GENERATED_copts.bzl
++++ b/absl/copts/GENERATED_copts.bzl
+@@ -231,7 +231,3 @@ ABSL_RANDOM_HWAES_MSVC_X64_FLAGS = [
+     "/Ob2",
+ ]
+ 
+-ABSL_RANDOM_HWAES_X64_FLAGS = [
+-    "-maes",
+-    "-msse4.1",
+-]
+diff --git a/absl/copts/copts.py b/absl/copts/copts.py
+index 068abce..c2f70fb 100644
+--- a/absl/copts/copts.py
++++ b/absl/copts/copts.py
+@@ -203,10 +203,6 @@ COPT_VARS = {
+     # to improve performance of some random bit generators.
+     "ABSL_RANDOM_HWAES_ARM64_FLAGS": ["-march=armv8-a+crypto"],
+     "ABSL_RANDOM_HWAES_ARM32_FLAGS": ["-mfpu=neon"],
+-    "ABSL_RANDOM_HWAES_X64_FLAGS": [
+-        "-maes",
+-        "-msse4.1",
+-    ],
+     "ABSL_RANDOM_HWAES_MSVC_X64_FLAGS": [
+         "/O2",  # Maximize speed
+         "/Ob2",  # Aggressive inlining
+-- 
+2.23.0
+
meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.23.0
#1 lore raw
Quoted 89 lines · Sinan Kaya

The repository contains the Abseil C++ library code. Abseil is an open-source collection of C++ code (compliant to C++11) designed to augment the C++ standard library.

https://github.com/abseil/abseil-cpp

---
 ...e-maes-option-from-cross-compilation.patch | 53 +++++++++++++++++++
 .../abseil-cpp/abseil-cpp_git.bb              | 42 +++++++++++++++
 2 files changed, 95 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-Remove-maes-option-from-cross-compilation.patch
 create mode 100644 meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb
meta-oe/recipes-devtools/abseil-cpp/abseil-cpp/0001-Remove-maes-option-from-cross-compilation.patch new file +53 -0
new file mode 100644
index 0000000000..4c41cd8902
@@ -0,0 +1,53 @@
+From 70926666f7c5c35add363e3bcade6eaabace7206 Mon Sep 17 00:00:00 2001
+From: Sinan Kaya <[email protected]>
+Date: Mon, 3 Feb 2020 03:25:57 +0000
+Subject: [PATCH] Remove maes option from cross-compilation
+
+---
+ absl/copts/GENERATED_AbseilCopts.cmake | 4 ----
+ absl/copts/GENERATED_copts.bzl         | 4 ----
+ absl/copts/copts.py                    | 4 ----
+ 3 files changed, 12 deletions(-)
+
+diff --git a/absl/copts/GENERATED_AbseilCopts.cmake b/absl/copts/GENERATED_AbseilCopts.cmake
+index 01bd40b..af99694 100644
+--- a/absl/copts/GENERATED_AbseilCopts.cmake
++++ b/absl/copts/GENERATED_AbseilCopts.cmake
+@@ -230,7 +230,3 @@ list(APPEND ABSL_RANDOM_HWAES_MSVC_X64_FLAGS
+     "/Ob2"
+ )
+
+-list(APPEND ABSL_RANDOM_HWAES_X64_FLAGS
+-    "-maes"
+-    "-msse4.1"
+-)
+diff --git a/absl/copts/GENERATED_copts.bzl b/absl/copts/GENERATED_copts.bzl
+index 82f332f..9a548d1 100644
+--- a/absl/copts/GENERATED_copts.bzl
++++ b/absl/copts/GENERATED_copts.bzl
+@@ -231,7 +231,3 @@ ABSL_RANDOM_HWAES_MSVC_X64_FLAGS = [
+     "/Ob2",
+ ]
+
+-ABSL_RANDOM_HWAES_X64_FLAGS = [
+-    "-maes",
+-    "-msse4.1",
+-]
+diff --git a/absl/copts/copts.py b/absl/copts/copts.py
+index 068abce..c2f70fb 100644
+--- a/absl/copts/copts.py
++++ b/absl/copts/copts.py
+@@ -203,10 +203,6 @@ COPT_VARS = {
+     # to improve performance of some random bit generators.
+     "ABSL_RANDOM_HWAES_ARM64_FLAGS": ["-march=armv8-a+crypto"],
+     "ABSL_RANDOM_HWAES_ARM32_FLAGS": ["-mfpu=neon"],
+-    "ABSL_RANDOM_HWAES_X64_FLAGS": [
+-        "-maes",
+-        "-msse4.1",
+-    ],
+     "ABSL_RANDOM_HWAES_MSVC_X64_FLAGS": [
+         "/O2",  # Maximize speed
+         "/Ob2",  # Aggressive inlining
+--
+2.23.0
+
meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb new file +8 -0
new file mode 100644
index 0000000000..5090dc9fae
@@ -0,0 +1,42 @@
+SUMMARY = "Abseil is a cpp library like STL"
+DESCRIPTION = "Abseil provides pieces missing from the C++ standard. Contains \
+additional useful libraries like algorithm, container, debugging, hash, memory, \
+meta, numeric, strings, synchronization, time, types and utility"
+HOMEPAGE = "https://abseil.io/"
+SECTION = "libs"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=df52c6edb7adc22e533b2bacc3bd3915"

meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb line 18

Quoted 10 lines
meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb new file +10 -0
+
+SRCREV = "aa844899c937bde5d2b24f276b59997e5b668bde"
+BRANCH = "lts_2019_08_08"
+SRC_URI = "git://github.com/abseil/abseil-cpp;branch=${BRANCH}         \
+           file://0001-Remove-maes-option-from-cross-compilation.patch \
+          "
+
+S = "${WORKDIR}/git"
+
+TARGET_CXXFLAGS += "${@bb.utils.contains('TARGET_ARCH', 'aarch64', ' -march=armv8-a+crypto', '', d)}"

This cannot be enforced, as it would break those AArch64 derivatives, which does not have Crypto extension. See my comment above, where I extracted 2 sets of tune features for Cortex-A53. That means that there are SoCs there from different vendors, and some vendors decided to license Crypto extensions from ARM to include it in their RTL, but some opted out to save either space on a die or cost of the processor.

If you would base your build with '+crypto' unconditionally, then the binary would segfault on those SoCs which has Crypto opted out.

Moreover, enabling crypto extension in GCC automatically enables inlined NEON and VFP opcodes (see [1]), and there are more side effects to be expected on those SOCs which does not have those integrated.

Quoted 27 lines
meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_git.bb new file +24 -1
+TARGET_CXXFLAGS += "${@bb.utils.contains('TARGET_ARCH', 'x64', ' -maes -msse4.1', '', d)}"
+
+CXXFLAGS_append = " -fPIC"
+ASNEEDED_class-native = ""
+ASNEEDED_class-nativesdk = ""
+
+inherit cmake
+
+BBCLASSEXTEND = "native nativesdk"
+ALLOW_EMPTY_${PN} = "1"
+
+python () {
+    arch = d.getVar("TARGET_ARCH")
+
+    if arch == "aarch64":
+        tunes = d.getVar("TUNE_FEATURES")
+        if not tunes:
+            return
+        pkgn = d.getVar("PN")
+        pkgv = d.getVar("PV")
+        if "crypto" not in tunes:
+            raise bb.parse.SkipPackage("%s-%s Needs support for crypto on armv8" % (pkgn, pkgv))
+}
+
--

2.23.0

Quoted 5 lines

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

[1]: https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html#aarch64-feature-modifiers

Signature · 2 lines
Regards,
Andrey.
author
#2 lore raw
Quoted 9 lines · Andrey Zhizhikin

Review

Quoted 2 lines
(quoted diff) +1 -1
+TARGET_CXXFLAGS += "${@bb.utils.contains('TARGET_ARCH', 'aarch64', '
-march=armv8-a+crypto', '', d)}"

This cannot be enforced, as it would break those AArch64 derivatives, which does not have Crypto extension. See my comment above, where I extracted 2 sets of tune features for Cortex-A53. That means that there are SoCs there from different vendors, and some vendors decided to license Crypto extensions from ARM to include it in their RTL, but some opted out to save either space on a die or cost of the processor.

Quoted 8 lines

If you would base your build with '+crypto' unconditionally, then the binary would segfault on those SoCs which has Crypto opted out.

Moreover, enabling crypto extension in GCC automatically enables inlined NEON and VFP opcodes (see [1]), and there are more side effects to be expected on those SOCs which does not have those integrated.

I agree. I dropped this line on v3.

I was curious about

TARGET_CXXFLAGS += "${@bb.utils.contains('TARGET_ARCH', 'x64', ' -maes -msse4.1', '', d)}"

do we have a feature flag for this too?

Code doesn't compile without arch crypt support.

#3 lore raw
Quoted 20 lines · Sinan Kaya
Quoted 9 lines · Andrey Zhizhikin

Review

Quoted 2 lines
(quoted diff) +1 -1
+TARGET_CXXFLAGS += "${@bb.utils.contains('TARGET_ARCH', 'aarch64', '
-march=armv8-a+crypto', '', d)}"

This cannot be enforced, as it would break those AArch64 derivatives, which does not have Crypto extension. See my comment above, where I extracted 2 sets of tune features for Cortex-A53. That means that there are SoCs there from different vendors, and some vendors decided to license Crypto extensions from ARM to include it in their RTL, but some opted out to save either space on a die or cost of the processor.

Quoted 8 lines

If you would base your build with '+crypto' unconditionally, then the binary would segfault on those SoCs which has Crypto opted out.

Moreover, enabling crypto extension in GCC automatically enables inlined NEON and VFP opcodes (see [1]), and there are more side effects to be expected on those SOCs which does not have those integrated.

Quoted 9 lines

I agree. I dropped this line on v3.

I was curious about

TARGET_CXXFLAGS += "${@bb.utils.contains('TARGET_ARCH', 'x64', ' -maes -msse4.1', '', d)}"

do we have a feature flag for this too?

perhaps look for corei7 in TUNE_FEATURES

Quoted 6 lines

Code doesn't compile without arch crypt support.
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#4 lore raw

also fails on x86/musl

http://errors.yoctoproject.org/Errors/Details/390565/

Quoted 40 lines · Khem Raj
Quoted 20 lines · Sinan Kaya
Quoted 9 lines · Andrey Zhizhikin

Review

Quoted 2 lines
(quoted diff) +1 -1
+TARGET_CXXFLAGS += "${@bb.utils.contains('TARGET_ARCH', 'aarch64', '
-march=armv8-a+crypto', '', d)}"

This cannot be enforced, as it would break those AArch64 derivatives, which does not have Crypto extension. See my comment above, where I extracted 2 sets of tune features for Cortex-A53. That means that there are SoCs there from different vendors, and some vendors decided to license Crypto extensions from ARM to include it in their RTL, but some opted out to save either space on a die or cost of the processor.

Quoted 8 lines

If you would base your build with '+crypto' unconditionally, then the binary would segfault on those SoCs which has Crypto opted out.

Moreover, enabling crypto extension in GCC automatically enables inlined NEON and VFP opcodes (see [1]), and there are more side effects to be expected on those SOCs which does not have those integrated.

Quoted 9 lines

I agree. I dropped this line on v3.

I was curious about

TARGET_CXXFLAGS += "${@bb.utils.contains('TARGET_ARCH', 'x64', ' -maes -msse4.1', '', d)}"

do we have a feature flag for this too?

perhaps look for corei7 in TUNE_FEATURES

Quoted 6 lines

Code doesn't compile without arch crypt support.
--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

author
#6 lore raw
In reply to Khem Raj
Quoted 4 lines · Khem Raj
Quoted 2 lines

do we have a feature flag for this too?

perhaps look for corei7 in TUNE_FEATURES

done