Skip to content

Commit

Permalink
[tools/depends][target] zlib patch fix android NDK 26+failure
Browse files Browse the repository at this point in the history
Patch proposed upstream to fix the following issue
  ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

Upstream issue: madler/zlib#856
Upstream patch: madler/zlib#865
  • Loading branch information
fuzzard committed Dec 24, 2023
1 parent 5892a29 commit b13aff9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tools/depends/target/zlib/03-android-fix_gz_intmax.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- a/gzlib.c
+++ b/gzlib.c
@@ -579,4 +579,9 @@ unsigned ZLIB_INTERNAL gz_intmax(void) {
} while (p > q);
return q >> 1;
}
+#else
+unsigned ZLIB_INTERNAL gz_intmax()
+{
+ return INT_MAX;
+}
#endif
6 changes: 5 additions & 1 deletion tools/depends/target/zlib/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
include ../../Makefile.include ZLIB-VERSION ../../download-files.include
DEPS = ../../Makefile.include Makefile ZLIB-VERSION ../../download-files.include \
01-all-disable_tests.patch \
02-all-static_only.patch
02-all-static_only.patch \
03-android-fix_gz_intmax.patch

# configuration settings
CMAKE_OPTIONS=-DCMAKE_INSTALL_PREFIX=$(PREFIX) \
Expand All @@ -16,6 +17,9 @@ $(PLATFORM): $(DEPS) | $(TARBALLS_LOCATION)/$(ARCHIVE).$(HASH_TYPE)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
cd $(PLATFORM); patch -p1 -i ../01-all-disable_tests.patch
cd $(PLATFORM); patch -p1 -i ../02-all-static_only.patch
ifeq ($(OS),android)
cd $(PLATFORM); patch -p1 -i ../03-android-fix_gz_intmax.patch
endif
cd $(PLATFORM)/build; $(CMAKE) $(CMAKE_OPTIONS) ..

$(LIBDYLIB): $(PLATFORM)
Expand Down

0 comments on commit b13aff9

Please sign in to comment.