summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2021-09-21 07:55:42 +0100
committerSam James <sam@gentoo.org>2021-09-21 23:27:01 +0100
commit7fb980be2673097805afdd00aeeb2babd46753d7 (patch)
treeff18e3740d5cc6f68b9c21e0ed7b001aa340f832 /sci-libs
parentsys-power/nut: keyword 2.7.4-r8 for ~riscv (diff)
downloadgentoo-7fb980be2673097805afdd00aeeb2babd46753d7.tar.gz
gentoo-7fb980be2673097805afdd00aeeb2babd46753d7.tar.bz2
gentoo-7fb980be2673097805afdd00aeeb2babd46753d7.zip
sci-libs/tensorflow: build with -std=c++14 in 2.5.0-r1
TensorFlow is not yet compatible with the C++17 dialect. Allow it to build with gcc:11 by appending -std=c++14 to CXXFLAGS, prior to composing bazelrc. The flag doesn't encompass the building of the ruy library, so this is accompanied by a patch to include the <limits> header in the one place that ruy needs it. Filter out the -fvtable-verify=@(std|preinit) flag, if present. While ostensibly useful for hardening, it prevents TensorFlow from building successfully. Note that, while the pattern is in the form of an extglob, the accompanying shopt does _not_ need to be enabled. Have src_install localise "l", rather than "j", because the function in question never employs the latter. Closes: https://bugs.gentoo.org/787938 Signed-off-by: Kerin Millar <kfm@plushkava.net> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sci-libs')
-rw-r--r--sci-libs/tensorflow/files/0008-patch-ruy-for-gcc-11.patch37
-rw-r--r--sci-libs/tensorflow/tensorflow-2.5.0-r1.ebuild7
2 files changed, 43 insertions, 1 deletions
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
new file mode 100644
index 000000000000..3bb2cf2e1cbe
--- /dev/null
+++ b/sci-libs/tensorflow/files/0008-patch-ruy-for-gcc-11.patch
@@ -0,0 +1,37 @@
+diff --git a/third_party/ruy/commit-3c93cda.patch b/third_party/ruy/commit-3c93cda.patch
+new file mode 100644
+index 00000000000..e530a842717
+--- /dev/null
++++ b/third_party/ruy/commit-3c93cda.patch
+@@ -0,0 +1,21 @@
++From 3c93cda8211efa01128d48950f0d6ee5233c5b9b Mon Sep 17 00:00:00 2001
++From: stha09 <51720730+stha09@users.noreply.github.com>
++Date: Thu, 6 May 2021 18:31:30 +0200
++Subject: [PATCH] IWYU: include limits for std::numeric_limits (#253)
++
++---
++ ruy/block_map.cc | 1 +
++ 1 file changed, 1 insertion(+)
++
++diff --git a/ruy/block_map.cc b/ruy/block_map.cc
++index 6c01e52a02..e04e7aff4a 100644
++--- a/ruy/block_map.cc
+++++ b/ruy/block_map.cc
++@@ -17,6 +17,7 @@ limitations under the License.
++
++ #include <algorithm>
++ #include <cstdint>
+++#include <limits>
++
++ #ifdef RUY_MAKEBLOCKMAP_DEBUG
++ #include <cstdio>
+diff --git a/third_party/ruy/workspace.bzl b/third_party/ruy/workspace.bzl
+index 50769621770..7e91d640469 100644
+--- a/third_party/ruy/workspace.bzl
++++ b/third_party/ruy/workspace.bzl
+@@ -12,4 +12,5 @@ def repo():
+ "https://github.com/google/ruy/archive/54774a7a2cf85963777289193629d4bd42de4a59.zip",
+ ],
+ build_file = "//third_party/ruy:BUILD",
++ patch_file = "//third_party/ruy:commit-3c93cda.patch"
+ )
diff --git a/sci-libs/tensorflow/tensorflow-2.5.0-r1.ebuild b/sci-libs/tensorflow/tensorflow-2.5.0-r1.ebuild
index 1a9cf3d0793b..642c413aa74d 100644
--- a/sci-libs/tensorflow/tensorflow-2.5.0-r1.ebuild
+++ b/sci-libs/tensorflow/tensorflow-2.5.0-r1.ebuild
@@ -145,6 +145,9 @@ REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
S="${WORKDIR}/${MY_P}"
+PATCHES=(
+ "${FILESDIR}/0008-patch-ruy-for-gcc-11.patch"
+)
DOCS=( AUTHORS CONTRIBUTING.md ISSUE_TEMPLATE.md README.md RELEASE.md )
CHECKREQS_MEMORY="5G"
CHECKREQS_DISK_BUILD="10G"
@@ -187,6 +190,8 @@ src_prepare() {
export JAVA_HOME=$(java-config --jre-home) # so keepwork works
append-flags $(get-cpu-flags)
+ append-cxxflags -std=c++14 # bug 787938
+ filter-flags '-fvtable-verify=@(std|preinit)'
bazel_setup_bazelrc
eapply "${WORKDIR}"/patches/*.patch
@@ -356,7 +361,7 @@ src_compile() {
}
src_install() {
- local i j
+ local i l
export JAVA_HOME=$(java-config --jre-home) # so keepwork works
export KERAS_HOME="${T}/.keras" # otherwise sandbox violation writing ~/.keras