1 |
commit: 7fb980be2673097805afdd00aeeb2babd46753d7 |
2 |
Author: Kerin Millar <kfm <AT> plushkava <DOT> net> |
3 |
AuthorDate: Tue Sep 21 06:55:42 2021 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 21 22:27:01 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7fb980be |
7 |
|
8 |
sci-libs/tensorflow: build with -std=c++14 in 2.5.0-r1 |
9 |
|
10 |
TensorFlow is not yet compatible with the C++17 dialect. Allow it to |
11 |
build with gcc:11 by appending -std=c++14 to CXXFLAGS, prior to composing |
12 |
bazelrc. The flag doesn't encompass the building of the ruy library, so |
13 |
this is accompanied by a patch to include the <limits> header in the one |
14 |
place that ruy needs it. |
15 |
|
16 |
Filter out the -fvtable-verify=@(std|preinit) flag, if present. While |
17 |
ostensibly useful for hardening, it prevents TensorFlow from building |
18 |
successfully. Note that, while the pattern is in the form of an |
19 |
extglob, the accompanying shopt does _not_ need to be enabled. |
20 |
|
21 |
Have src_install localise "l", rather than "j", because the function in |
22 |
question never employs the latter. |
23 |
|
24 |
Closes: https://bugs.gentoo.org/787938 |
25 |
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net> |
26 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
27 |
|
28 |
.../files/0008-patch-ruy-for-gcc-11.patch | 37 ++++++++++++++++++++++ |
29 |
sci-libs/tensorflow/tensorflow-2.5.0-r1.ebuild | 7 +++- |
30 |
2 files changed, 43 insertions(+), 1 deletion(-) |
31 |
|
32 |
diff --git a/sci-libs/tensorflow/files/0008-patch-ruy-for-gcc-11.patch b/sci-libs/tensorflow/files/0008-patch-ruy-for-gcc-11.patch |
33 |
new file mode 100644 |
34 |
index 00000000000..3bb2cf2e1cb |
35 |
--- /dev/null |
36 |
+++ b/sci-libs/tensorflow/files/0008-patch-ruy-for-gcc-11.patch |
37 |
@@ -0,0 +1,37 @@ |
38 |
+diff --git a/third_party/ruy/commit-3c93cda.patch b/third_party/ruy/commit-3c93cda.patch |
39 |
+new file mode 100644 |
40 |
+index 00000000000..e530a842717 |
41 |
+--- /dev/null |
42 |
++++ b/third_party/ruy/commit-3c93cda.patch |
43 |
+@@ -0,0 +1,21 @@ |
44 |
++From 3c93cda8211efa01128d48950f0d6ee5233c5b9b Mon Sep 17 00:00:00 2001 |
45 |
++From: stha09 <51720730+stha09@××××××××××××××××××××.com> |
46 |
++Date: Thu, 6 May 2021 18:31:30 +0200 |
47 |
++Subject: [PATCH] IWYU: include limits for std::numeric_limits (#253) |
48 |
++ |
49 |
++--- |
50 |
++ ruy/block_map.cc | 1 + |
51 |
++ 1 file changed, 1 insertion(+) |
52 |
++ |
53 |
++diff --git a/ruy/block_map.cc b/ruy/block_map.cc |
54 |
++index 6c01e52a02..e04e7aff4a 100644 |
55 |
++--- a/ruy/block_map.cc |
56 |
+++++ b/ruy/block_map.cc |
57 |
++@@ -17,6 +17,7 @@ limitations under the License. |
58 |
++ |
59 |
++ #include <algorithm> |
60 |
++ #include <cstdint> |
61 |
+++#include <limits> |
62 |
++ |
63 |
++ #ifdef RUY_MAKEBLOCKMAP_DEBUG |
64 |
++ #include <cstdio> |
65 |
+diff --git a/third_party/ruy/workspace.bzl b/third_party/ruy/workspace.bzl |
66 |
+index 50769621770..7e91d640469 100644 |
67 |
+--- a/third_party/ruy/workspace.bzl |
68 |
++++ b/third_party/ruy/workspace.bzl |
69 |
+@@ -12,4 +12,5 @@ def repo(): |
70 |
+ "https://github.com/google/ruy/archive/54774a7a2cf85963777289193629d4bd42de4a59.zip", |
71 |
+ ], |
72 |
+ build_file = "//third_party/ruy:BUILD", |
73 |
++ patch_file = "//third_party/ruy:commit-3c93cda.patch" |
74 |
+ ) |
75 |
|
76 |
diff --git a/sci-libs/tensorflow/tensorflow-2.5.0-r1.ebuild b/sci-libs/tensorflow/tensorflow-2.5.0-r1.ebuild |
77 |
index 1a9cf3d0793..642c413aa74 100644 |
78 |
--- a/sci-libs/tensorflow/tensorflow-2.5.0-r1.ebuild |
79 |
+++ b/sci-libs/tensorflow/tensorflow-2.5.0-r1.ebuild |
80 |
@@ -145,6 +145,9 @@ REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
81 |
|
82 |
S="${WORKDIR}/${MY_P}" |
83 |
|
84 |
+PATCHES=( |
85 |
+ "${FILESDIR}/0008-patch-ruy-for-gcc-11.patch" |
86 |
+) |
87 |
DOCS=( AUTHORS CONTRIBUTING.md ISSUE_TEMPLATE.md README.md RELEASE.md ) |
88 |
CHECKREQS_MEMORY="5G" |
89 |
CHECKREQS_DISK_BUILD="10G" |
90 |
@@ -187,6 +190,8 @@ src_prepare() { |
91 |
export JAVA_HOME=$(java-config --jre-home) # so keepwork works |
92 |
|
93 |
append-flags $(get-cpu-flags) |
94 |
+ append-cxxflags -std=c++14 # bug 787938 |
95 |
+ filter-flags '-fvtable-verify=@(std|preinit)' |
96 |
bazel_setup_bazelrc |
97 |
|
98 |
eapply "${WORKDIR}"/patches/*.patch |
99 |
@@ -356,7 +361,7 @@ src_compile() { |
100 |
} |
101 |
|
102 |
src_install() { |
103 |
- local i j |
104 |
+ local i l |
105 |
export JAVA_HOME=$(java-config --jre-home) # so keepwork works |
106 |
export KERAS_HOME="${T}/.keras" # otherwise sandbox violation writing ~/.keras |