diff mbox series

[meta-tensorflow] bazel-native: fix build with gcc14

Message ID 20240614050305.246809-1-anuj.mittal@intel.com
State New
Headers show
Series [meta-tensorflow] bazel-native: fix build with gcc14 | expand

Commit Message

Anuj Mittal June 14, 2024, 5:03 a.m. UTC
Backport patch to fix errors while building zlib. Fixes:

| external/bazel_tools/third_party/zlib/gzwrite.c: In function 'gz_comp':
| external/bazel_tools/third_party/zlib/gzwrite.c:89:20: error: implicit declaration of function 'write'; did you mean 'fwrite'? [-Wimplicit-function-declaration]
|    89 |             writ = write(state->fd, strm->next_in, put);
|       |                    ^~~~~
|       |                    fwrite
| external/bazel_tools/third_party/zlib/gzwrite.c: In function 'gzclose_w':
| external/bazel_tools/third_party/zlib/gzwrite.c:673:9: error: implicit declaration of function 'close'; did you mean 'pclose'? [-Wimplicit-function-declaration]
|   673 |     if (close(state->fd) == -1)
|       |         ^~~~~
|       |         pclose

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
---
 recipes-devtools/bazel/bazel-native_6.0.0.bb  |  1 +
 ...3ed4ac717b814d02a0d125f160ddabe78003.patch | 57 +++++++++++++++++++
 2 files changed, 58 insertions(+)
 create mode 100644 recipes-devtools/bazel/files/1f2b3ed4ac717b814d02a0d125f160ddabe78003.patch
diff mbox series

Patch

diff --git a/recipes-devtools/bazel/bazel-native_6.0.0.bb b/recipes-devtools/bazel/bazel-native_6.0.0.bb
index c930054..29abd0e 100644
--- a/recipes-devtools/bazel/bazel-native_6.0.0.bb
+++ b/recipes-devtools/bazel/bazel-native_6.0.0.bb
@@ -11,6 +11,7 @@  SRC_URI = "https://github.com/bazelbuild/bazel/releases/download/${PV}/bazel-${P
            file://0001-add-Yocto-native-sysroot-dir-to-the-default-Bazel-to.patch \
            file://0001-cutsomize-native-toolchains-for-Yocto.patch \
            file://0001-fix-compile-failure-on-gcc-13.patch \
+           file://1f2b3ed4ac717b814d02a0d125f160ddabe78003.patch \
 "
 
 inherit python3native
diff --git a/recipes-devtools/bazel/files/1f2b3ed4ac717b814d02a0d125f160ddabe78003.patch b/recipes-devtools/bazel/files/1f2b3ed4ac717b814d02a0d125f160ddabe78003.patch
new file mode 100644
index 0000000..abacf87
--- /dev/null
+++ b/recipes-devtools/bazel/files/1f2b3ed4ac717b814d02a0d125f160ddabe78003.patch
@@ -0,0 +1,57 @@ 
+From 1f2b3ed4ac717b814d02a0d125f160ddabe78003 Mon Sep 17 00:00:00 2001
+From: Yun Peng <pcloudy@google.com>
+Date: Wed, 5 Apr 2023 15:13:26 +0200
+Subject: [PATCH] Patch zlib to fix compatibility with latest Xcode
+
+Fixes https://github.com/bazelbuild/bazel/issues/17956
+
+Partial commit for third_party/*, see #17987.
+
+Closes #17987
+
+Signed-off-by: Yun Peng <pcloudy@google.com>
+
+Upstream-Status: Backport [https://github.com/bazelbuild/bazel/commit/1f2b3ed4ac717b814d02a0d125f160ddabe78003]
+Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
+---
+ third_party/zlib/gzguts.h   |  4 ++++
+ third_party/zlib/zlib.patch | 15 +++++++++++++++
+ 2 files changed, 19 insertions(+)
+ create mode 100644 third_party/zlib/zlib.patch
+
+diff --git a/third_party/zlib/gzguts.h b/third_party/zlib/gzguts.h
+index 57faf37165a354..54f668fcb20536 100644
+--- a/third_party/zlib/gzguts.h
++++ b/third_party/zlib/gzguts.h
+@@ -3,6 +3,10 @@
+  * For conditions of distribution and use, see copyright notice in zlib.h
+  */
+ 
++#ifndef _WIN32
++  #include <unistd.h>
++#endif
++
+ #ifdef _LARGEFILE64_SOURCE
+ #  ifndef _LARGEFILE_SOURCE
+ #    define _LARGEFILE_SOURCE 1
+diff --git a/third_party/zlib/zlib.patch b/third_party/zlib/zlib.patch
+new file mode 100644
+index 00000000000000..7181d44aa9f9b1
+--- /dev/null
++++ b/third_party/zlib/zlib.patch
+@@ -0,0 +1,15 @@
++diff --git a/third_party/zlib/gzguts.h b/third_party/zlib/gzguts.h
++index 57faf37165..54f668fcb2 100644
++--- a/third_party/zlib/gzguts.h
+++++ b/third_party/zlib/gzguts.h
++@@ -3,6 +3,10 @@
++  * For conditions of distribution and use, see copyright notice in zlib.h
++  */
++ 
+++#ifndef _WIN32
+++  #include <unistd.h>
+++#endif
+++
++ #ifdef _LARGEFILE64_SOURCE
++ #  ifndef _LARGEFILE_SOURCE
++ #    define _LARGEFILE_SOURCE 1