From dbd986278e94d0b3b296618c554017f9c7f6b628 Mon Sep 17 00:00:00 2001 From: desert-sailor Date: Thu, 16 Feb 2023 16:17:32 +0800 Subject: [PATCH] =?UTF-8?q?fix=20issue:=20I6CF14=20pytorch=20build=20probl?= =?UTF-8?q?em=20in=20openEuler:Mainline=20=E6=8F=90=E4=BA=A4=E8=A1=A5?= =?UTF-8?q?=E4=B8=81=E6=96=87=E4=BB=B6,=20=E6=9B=B4=E6=96=B0SPEC=E6=96=87?= =?UTF-8?q?=E4=BB=B6=20update=200002-Update-gloo-for-gcc11-compile.patch.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 大漠行舟 --- 0002-Update-gloo-for-gcc11-compile.patch | 55 ++++++++++++++++++++++++ pytorch.spec | 6 ++- 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 0002-Update-gloo-for-gcc11-compile.patch diff --git a/0002-Update-gloo-for-gcc11-compile.patch b/0002-Update-gloo-for-gcc11-compile.patch new file mode 100644 index 0000000..55b46a1 --- /dev/null +++ b/0002-Update-gloo-for-gcc11-compile.patch @@ -0,0 +1,55 @@ +diff -Naur a/third_party/gloo/gloo/common/linux.cc b/third_party/gloo/gloo/common/linux.cc +--- a/third_party/gloo/gloo/common/linux.cc 2022-03-11 01:01:52.000000000 +0800 ++++ b/third_party/gloo/gloo/common/linux.cc 2023-02-16 11:09:11.493631531 +0800 +@@ -187,29 +187,28 @@ + static int getInterfaceSpeedGLinkSettings(int sock, struct ifreq* ifr) { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,6,0) + constexpr auto link_mode_data_nwords = 3 * 127; +- struct { +- struct ethtool_link_settings req; +- __u32 link_mode_data[link_mode_data_nwords]; +- } ecmd; ++ constexpr auto bufsize = sizeof(struct ethtool_link_settings) + sizeof(__u32)*link_mode_data_nwords; ++ char buf[bufsize]; ++ struct ethtool_link_settings* ecmd = (struct ethtool_link_settings*)buf; + int rv; + +- ifr->ifr_data = (__caddr_t)&ecmd; +- memset(&ecmd, 0, sizeof(ecmd)); +- ecmd.req.cmd = ETHTOOL_GLINKSETTINGS; ++ ifr->ifr_data = (__caddr_t)buf; ++ memset(buf, 0, bufsize); ++ ecmd->cmd = ETHTOOL_GLINKSETTINGS; + + rv = ioctl(sock, SIOCETHTOOL, ifr); +- if (rv < 0 || ecmd.req.link_mode_masks_nwords >= 0) { ++ if (rv < 0 || ecmd->link_mode_masks_nwords >= 0) { + return SPEED_UNKNOWN; + } + +- ecmd.req.cmd = ETHTOOL_GLINKSETTINGS; +- ecmd.req.link_mode_masks_nwords = -ecmd.req.link_mode_masks_nwords; ++ ecmd->cmd = ETHTOOL_GLINKSETTINGS; ++ ecmd->link_mode_masks_nwords = - (ecmd->link_mode_masks_nwords); + rv = ioctl(sock, SIOCETHTOOL, ifr); + if (rv < 0) { + return SPEED_UNKNOWN; + } + +- return ecmd.req.speed; ++ return ecmd->speed; + #else + (void)sock; + (void)ifr; +diff -Naur a/third_party/gloo/gloo/test/tls_tcp_test.cc b/third_party/gloo/gloo/test/tls_tcp_test.cc +--- a/third_party/gloo/gloo/test/tls_tcp_test.cc 2022-03-11 01:01:52.000000000 +0800 ++++ b/third_party/gloo/gloo/test/tls_tcp_test.cc 2023-02-16 11:12:33.779302224 +0800 +@@ -72,7 +72,7 @@ + } + } catch (::gloo::IoException e) { + exception_thrown = true; +- ASSERT_THAT(e.what(), ::testing::ContainsRegex("unknown ca")); ++ ASSERT_THAT(e.what(), ::testing::ContainsRegex("[unknown ca|Connect timeout|Connection refused]")); + } catch (::gloo::EnforceNotMet e) { + exception_thrown = true; + ASSERT_THAT(e.what(), diff --git a/pytorch.spec b/pytorch.spec index 7f747ee..713a424 100644 --- a/pytorch.spec +++ b/pytorch.spec @@ -1,13 +1,14 @@ %global _empty_manifest_terminate_build 0 Name: pytorch Version: 1.11.0 -Release: 1 +Release: 2 Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration License: BSD-3 URL: https://pytorch.org/ Source0: https://github.com/pytorch/pytorch/releases/download/v%{version}/pytorch-v%{version}.tar.gz Patch0001: 0001-Remove-breakpad-dependency.patch +Patch0002: 0002-Update-gloo-for-gcc11-compile.patch BuildRequires: g++ Requires: python3-future @@ -85,6 +86,9 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Thu Feb 16 2023 Dongxing Wang - 1.11.0-2 +- fixes: error: the CXX 11 compiler error (linux.cc flexible array member not at end of struct) + * Mon Jun 13 2022 Zhipeng Xie - 1.11.0-1 - upgrade to 1.11.0 -- Gitee