summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Tupone <tupone@gentoo.org>2023-01-12 13:05:46 +0100
committerAlfredo Tupone <tupone@gentoo.org>2023-01-12 13:08:10 +0100
commit05b4eaf3a0b650d61c1ae0adbcc52a1717aa36d4 (patch)
treed1d588b71e875d3a7ce06f76377088f5ae0fc24b /sci-libs
parentlicenses: Remove unused (diff)
downloadgentoo-05b4eaf3a0b650d61c1ae0adbcc52a1717aa36d4.tar.gz
gentoo-05b4eaf3a0b650d61c1ae0adbcc52a1717aa36d4.tar.bz2
gentoo-05b4eaf3a0b650d61c1ae0adbcc52a1717aa36d4.zip
sci-libs/caffe2: fix build with clang
Closes: https://bugs.gentoo.org/886273 Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
Diffstat (limited to 'sci-libs')
-rw-r--r--sci-libs/caffe2/caffe2-1.12.0-r1.ebuild2
-rw-r--r--sci-libs/caffe2/files/caffe2-1.12.0-clang.patch42
2 files changed, 44 insertions, 0 deletions
diff --git a/sci-libs/caffe2/caffe2-1.12.0-r1.ebuild b/sci-libs/caffe2/caffe2-1.12.0-r1.ebuild
index 8f6e1f87386f..3ed8c6670b1d 100644
--- a/sci-libs/caffe2/caffe2-1.12.0-r1.ebuild
+++ b/sci-libs/caffe2/caffe2-1.12.0-r1.ebuild
@@ -71,6 +71,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-1.11.0-gentoo.patch
"${FILESDIR}"/${PN}-1.12.0-install-dirs.patch
"${FILESDIR}"/${P}-glog-0.6.0.patch
+ "${FILESDIR}"/${P}-clang.patch
)
src_prepare() {
@@ -134,6 +135,7 @@ src_configure() {
-DUSE_SYSTEM_PTHREADPOOL=ON
-DUSE_SYSTEM_FXDIV=ON
-DUSE_SYSTEM_FP16=ON
+ -DUSE_SYSTEM_GLOO=ON
-DUSE_SYSTEM_ONNX=ON
-DUSE_SYSTEM_SLEEF=ON
-DUSE_TENSORPIPE=OFF
diff --git a/sci-libs/caffe2/files/caffe2-1.12.0-clang.patch b/sci-libs/caffe2/files/caffe2-1.12.0-clang.patch
new file mode 100644
index 000000000000..dd43b06a97a1
--- /dev/null
+++ b/sci-libs/caffe2/files/caffe2-1.12.0-clang.patch
@@ -0,0 +1,42 @@
+From bfdc0358dc37c55af6118fe5d8b6ccd898e003fd Mon Sep 17 00:00:00 2001
+From: Kazuki Sakamoto <kaz@meta.com>
+Date: Wed, 21 Dec 2022 11:19:58 +0000
+Subject: [PATCH] Compile fix for Clang + libc++ (#91212)
+
+Summary:
+LLVM 15 has a compile issue with the deprecated __has_trivial_copy. Update the GCC ifdef logic to exclude Clang + libc++.
+
+```
+caffe2/c10/util/Optional.h:536:13: error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
+ C10_IS_TRIVIALLY_COPYABLE(T) &&
+ ^
+caffe2/c10/macros/Macros.h:438:38: note: expanded from macro 'C10_IS_TRIVIALLY_COPYABLE'
+#define C10_IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T)
+```
+
+Test Plan: CI
+
+Reviewed By: kit1980
+
+Differential Revision: D42180203
+
+Pull Request resolved: https://github.com/pytorch/pytorch/pull/91212
+Approved by: https://github.com/kit1980, https://github.com/soumith
+---
+ c10/macros/Macros.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/c10/macros/Macros.h b/c10/macros/Macros.h
+index 9098a294228f4..09e57ca0a4d6a 100644
+--- a/c10/macros/Macros.h
++++ b/c10/macros/Macros.h
+@@ -434,7 +434,8 @@ __device__ __attribute__((noinline)) __attribute__((weak)) void __assert_fail(
+ // Warning: __has_trivial_copy for GCC may not always detect the non-POD
+ // correctly. For example, T = std::unique_ptr may evaluate to true and be
+ // treated as POD. This can cause unexpected behavior.
+-#if defined(__GNUG__) && __GNUC__ < 5
++#if defined(__GNUG__) && __GNUC__ < 5 && \
++ !(defined(__clang__) && defined(_LIBCPP_VERSION))
+ #define C10_IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T)
+ #else
+ #define C10_IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable<T>::value