Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zig: upgrade to 0.12.0-dev.2043+6ebeb85ab #140

Merged
merged 3 commits into from
Jan 8, 2024
Merged

Conversation

ghost
Copy link

@ghost ghost commented Jan 3, 2024

Notable changes:

  • bump glibc support from 2.34 to 2.38
  • fix integration with some glibc symbols: Fix libc_nonshared.a ziglang/zig#17702
  • mitigat error: AccessDenied, which, according to Noah Santschi-Cooney, also mitigates/fixes the dreaded error: FileNotFound which we sometimes see when setting up Bazel worksace. Relevant commit in Zig: ziglang/zig@6b27096

Fixes #133

Fix the following errors when compiling to 0.12.0-dev.1879+e19219fa0:

    zig-wrapper.zig:431:13: error: local variable is never mutated
    zig-wrapper.zig:431:13: note: consider using 'const'
    zig-wrapper.zig:331:9: error: local variable is never mutated
    zig-wrapper.zig:331:9: note: consider using 'const'

Otherwise version upgrade will come soon (tm).
@motiejus motiejus changed the title zig-wrapper: compat with 0.12.0-dev.1879+e19219fa0 zig: upgrade from 0.11 to 0.12.0-dev.2036+fc79b22a9 Jan 5, 2024
@motiejus motiejus changed the title zig: upgrade from 0.11 to 0.12.0-dev.2036+fc79b22a9 zig: upgrade to 0.12.0-dev.2036+fc79b22a9 Jan 5, 2024
@motiejus
Copy link
Collaborator

motiejus commented Jan 5, 2024

bazelbuild/bazel#20751

@ghost ghost force-pushed the motiejus-zig-version branch from 88713d4 to e5effb4 Compare January 8, 2024 08:18
Notable changes:
- bump glibc support from 2.34 to 2.38
- fix integration with some glibc symbols:
  ziglang/zig#17702
- mitigat `error: AccessDenied`, which, according to Noah
  Santschi-Cooney, also mitigates/fixes the dreaded `error:
  FileNotFound` which we sometimes see when setting up Bazel worksace.
  Relevant commit in Zig:
  ziglang/zig@6b27096

Fixes #133
@ghost ghost force-pushed the motiejus-zig-version branch from e5effb4 to 13b6062 Compare January 8, 2024 08:29
@ghost ghost changed the title zig: upgrade to 0.12.0-dev.2036+fc79b22a9 zig: upgrade to 0.12.0-dev.2043+6ebeb85ab Jan 8, 2024
@linzhp
Copy link
Contributor

linzhp commented Jan 8, 2024

This PR breaks [email protected] built on Linux with rules_foreign_cc@2ee029a7448d578da178f232bbb14d9191a32701.

The failing target is:

load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")

filegroup(
    name = "all_srcs",
    srcs = glob(
        include = ["**"],
        exclude = ["*.bazel"],
    ),
)

cmake(
    name = "zlib-static-lib",
    cache_entries = select({
        "@platforms//os:linux": {
            "CMAKE_C_FLAGS": "${CMAKE_C_FLAGS:-} -fPIC",
        },
        "//conditions:default": {},
    }),
    generate_args = [],
    lib_source = "all_srcs",
    out_static_libs = ["libz.a"],
)

Error log:

ERROR: /home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/external/zlib/BUILD.bazel:14:6: Foreign Cc - CMake: Building zlib-static-lib failed: (Exit 2): bash failed: error executing command (from target @zlib//:zlib-static-lib) /bin/bash -c bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib_foreign_cc/wrapper_build_script.sh

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
rules_foreign_cc: Build failed!
rules_foreign_cc: Keeping temp build directory and dependencies directory for debug.
rules_foreign_cc: Please note that the directories inside a sandbox are still cleaned unless you specify --sandbox_debug Bazel command line flag.
rules_foreign_cc: Printing build logs:
_____ BEGIN BUILD LOGS _____

Bazel external C/C++ Rules. Building library zlib-static-lib

Environment:______________
BUILD_SCRIPT=bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib_foreign_cc/build_script.sh
EXT_BUILD_ROOT=/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__
BUILD_LOG=bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib_foreign_cc/CMake.log
PWD=/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__
BUILD_WRAPPER_SCRIPT=bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib_foreign_cc/wrapper_build_script.sh
TMPDIR=/tmp
EXT_BUILD_DEPS=/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib.ext_build_deps
BUILD_TMPDIR=/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib.build_tmpdir
SHLVL=2
INSTALLDIR=/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib
PATH=/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__:/bin:/usr/bin:/usr/local/bin
_=/usr/bin/env
__________________________
+ /home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/cmake-3.23.2-linux-x86_64/bin/cmake -DCMAKE_TOOLCHAIN_FILE=/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib.build_tmpdir/crosstool_bazel.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib -DCMAKE_PREFIX_PATH=/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib.ext_build_deps -DCMAKE_RANLIB= -DCMAKE_MAKE_PROGRAM=/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/bazel-out/k8-opt-exec-2B5CBBC6-ST-8eddb46b6df4/bin/external/rules_foreign_cc/toolchains/make/bin/make -G 'Unix Makefiles' /home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is Clang 17.0.3
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zig_sdk/tools/x86_64-linux-gnu.2.19/c++ - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Renaming
--     /home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/zconf.h
-- to 'zconf.h.included' because this file is included with zlib
-- but CMake generates it automatically in the build directory.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib.build_tmpdir
+ /home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/cmake-3.23.2-linux-x86_64/bin/cmake --build . --config Release
[  2%] Building C object CMakeFiles/zlib.dir/adler32.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/adler32.c:63:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   63 | uLong ZEXPORT adler32_z(adler, buf, len)
      |               ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/adler32.c:134:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  134 | uLong ZEXPORT adler32(adler, buf, len)
      |               ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/adler32.c:143:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  143 | local uLong adler32_combine_(adler1, adler2, len2)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/adler32.c:172:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  172 | uLong ZEXPORT adler32_combine(adler1, adler2, len2)
      |               ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/adler32.c:180:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  180 | uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
      |               ^
5 warnings generated.
[  5%] Building C object CMakeFiles/zlib.dir/compress.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/compress.c:22:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   22 | int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/compress.c:68:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   68 | int ZEXPORT compress(dest, destLen, source, sourceLen)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/compress.c:81:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   81 | uLong ZEXPORT compressBound(sourceLen)
      |               ^
3 warnings generated.
[  7%] Building C object CMakeFiles/zlib.dir/crc32.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:126:16: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  126 | local z_word_t byte_swap(word)
      |                ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:551:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  551 | local z_crc_t multmodp(a, b)
      |               ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:575:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  575 | local z_crc_t x2nmodp(n, k)
      |               ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:726:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  726 | local z_crc_t crc_word(data)
      |               ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:735:16: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  735 | local z_word_t crc_word_big(data)
      |                ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:748:23: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  748 | unsigned long ZEXPORT crc32_z(crc, buf, len)
      |                       ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:1072:23: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1072 | unsigned long ZEXPORT crc32(crc, buf, len)
      |                       ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:1081:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1081 | uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
      |               ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:1093:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1093 | uLong ZEXPORT crc32_combine(crc1, crc2, len2)
      |               ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:1102:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1102 | uLong ZEXPORT crc32_combine_gen64(len2)
      |               ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:1112:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1112 | uLong ZEXPORT crc32_combine_gen(len2)
      |               ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/crc32.c:1119:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1119 | uLong ZEXPORT crc32_combine_op(crc1, crc2, op)
      |               ^
12 warnings generated.
[ 10%] Building C object CMakeFiles/zlib.dir/deflate.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:198:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  198 | local void slide_hash(s)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:225:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  225 | int ZEXPORT deflateInit_(strm, level, version, stream_size)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:237:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  237 | int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:389:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  389 | local int deflateStateCheck(strm)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:412:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  412 | int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:481:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  481 | int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:503:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  503 | int ZEXPORT deflateResetKeep(strm)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:541:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  541 | int ZEXPORT deflateReset(strm)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:553:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  553 | int ZEXPORT deflateSetHeader(strm, head)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:564:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  564 | int ZEXPORT deflatePending(strm, pending, bits)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:578:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  578 | int ZEXPORT deflatePrime(strm, bits, value)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:605:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  605 | int ZEXPORT deflateParams(strm, level, strategy)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:654:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  654 | int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:696:15: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  696 | uLong ZEXPORT deflateBound(strm, sourceLen)
      |               ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:768:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  768 | local void putShortMSB(s, b)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:782:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  782 | local void flush_pending(strm)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:815:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  815 | int ZEXPORT deflate(strm, flush)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:1130:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1130 | int ZEXPORT deflateEnd(strm)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:1156:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1156 | int ZEXPORT deflateCopy(dest, source)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:1215:16: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1215 | local unsigned read_buf(strm, buf, size)
      |                ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:1245:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1245 | local void lm_init(s)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:1278:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1278 | local uInt longest_match(s, cur_match)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:1527:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1527 | local void fill_window(s)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:1690:19: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1690 | local block_state deflate_stored(s, flush)
      |                   ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:1877:19: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1877 | local block_state deflate_fast(s, flush)
      |                   ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:1979:19: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1979 | local block_state deflate_slow(s, flush)
      |                   ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:2110:19: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 2110 | local block_state deflate_rle(s, flush)
      |                   ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/deflate.c:2184:19: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 2184 | local block_state deflate_huff(s, flush)
      |                   ^
28 warnings generated.
[ 12%] Building C object CMakeFiles/zlib.dir/gzclose.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzclose.c:11:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   11 | int ZEXPORT gzclose(file)
      |             ^
1 warning generated.
[ 15%] Building C object CMakeFiles/zlib.dir/gzlib.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:75:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   75 | local void gz_reset(state)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:93:14: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   93 | local gzFile gz_open(path, fd, mode)
      |              ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:272:16: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  272 | gzFile ZEXPORT gzopen(path, mode)
      |                ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:280:16: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  280 | gzFile ZEXPORT gzopen64(path, mode)
      |                ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:288:16: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  288 | gzFile ZEXPORT gzdopen(fd, mode)
      |                ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:318:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  318 | int ZEXPORT gzbuffer(file, size)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:345:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  345 | int ZEXPORT gzrewind(file)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:368:19: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  368 | z_off64_t ZEXPORT gzseek64(file, offset, whence)
      |                   ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:445:17: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  445 | z_off_t ZEXPORT gzseek(file, offset, whence)
      |                 ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:457:19: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  457 | z_off64_t ZEXPORT gztell64(file)
      |                   ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:474:17: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  474 | z_off_t ZEXPORT gztell(file)
      |                 ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:484:19: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  484 | z_off64_t ZEXPORT gzoffset64(file)
      |                   ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:507:17: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  507 | z_off_t ZEXPORT gzoffset(file)
      |                 ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:517:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  517 | int ZEXPORT gzeof(file)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:534:22: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  534 | const char * ZEXPORT gzerror(file, errnum)
      |                      ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:555:14: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  555 | void ZEXPORT gzclearerr(file)
      |              ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzlib.c:581:20: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  581 | void ZLIB_INTERNAL gz_error(state, err, msg)
      |                    ^
17 warnings generated.
[ 17%] Building C object CMakeFiles/zlib.dir/gzread.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:21:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   21 | local int gz_load(state, buf, len, have)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:56:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   56 | local int gz_avail(state)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:91:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   91 | local int gz_look(state)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:173:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  173 | local int gz_decomp(state)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:227:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  227 | local int gz_fetch(state)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:257:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  257 | local int gz_skip(state, len)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:292:16: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  292 | local z_size_t gz_read(state, buf, len)
      |                ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:373:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  373 | int ZEXPORT gzread(file, buf, len)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:409:18: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  409 | z_size_t ZEXPORT gzfread(buf, size, nitems, file)
      |                  ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:445:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  445 | int ZEXPORT gzgetc(file)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:472:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  472 | int ZEXPORT gzgetc_(file)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:479:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  479 | int ZEXPORT gzungetc(c, file)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:539:16: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  539 | char * ZEXPORT gzgets(file, buf, len)
      |                ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:603:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  603 | int ZEXPORT gzdirect(file)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzread.c:623:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  623 | int ZEXPORT gzclose_r(file)
      |             ^
15 warnings generated.
[ 20%] Building C object CMakeFiles/zlib.dir/gzwrite.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzwrite.c:17:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   17 | local int gz_init(state)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzwrite.c:73:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   73 | local int gz_comp(state, flush)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzwrite.c:154:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  154 | local int gz_zero(state, len)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzwrite.c:187:16: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  187 | local z_size_t gz_write(state, buf, len)
      |                ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzwrite.c:255:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  255 | int ZEXPORT gzwrite(file, buf, len)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzwrite.c:283:18: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  283 | z_size_t ZEXPORT gzfwrite(buf, size, nitems, file)
      |                  ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzwrite.c:313:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  313 | int ZEXPORT gzputc(file, c)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzwrite.c:361:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  361 | int ZEXPORT gzputs(file, s)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzwrite.c:565:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  565 | int ZEXPORT gzflush(file, flush)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzwrite.c:597:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  597 | int ZEXPORT gzsetparams(file, level, strategy)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/gzwrite.c:639:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  639 | int ZEXPORT gzclose_w(file)
      |             ^
11 warnings generated.
[ 22%] Building C object CMakeFiles/zlib.dir/inflate.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:105:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  105 | local int inflateStateCheck(strm)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:119:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  119 | int ZEXPORT inflateResetKeep(strm)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:145:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  145 | int ZEXPORT inflateReset(strm)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:158:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  158 | int ZEXPORT inflateReset2(strm, windowBits)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:198:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  198 | int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:242:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  242 | int ZEXPORT inflateInit_(strm, version, stream_size)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:250:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  250 | int ZEXPORT inflatePrime(strm, bits, value)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:281:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  281 | local void fixedtables(state)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:399:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  399 | local int updatewindow(strm, end, copy)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:625:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  625 | int ZEXPORT inflate(strm, flush)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1304:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1304 | int ZEXPORT inflateEnd(strm)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1318:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1318 | int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1341:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1341 | int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1376:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1376 | int ZEXPORT inflateGetHeader(strm, head)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1404:16: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1404 | local unsigned syncsearch(have, buf, len)
      |                ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1427:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1427 | int ZEXPORT inflateSync(strm)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1485:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1485 | int ZEXPORT inflateSyncPoint(strm)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1495:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1495 | int ZEXPORT inflateCopy(dest, source)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1542:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1542 | int ZEXPORT inflateUndermine(strm, subvert)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1560:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1560 | int ZEXPORT inflateValidate(strm, check)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1575:14: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1575 | long ZEXPORT inflateMark(strm)
      |              ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inflate.c:1588:23: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1588 | unsigned long ZEXPORT inflateCodesUsed(strm)
      |                       ^
22 warnings generated.
[ 25%] Building C object CMakeFiles/zlib.dir/infback.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/infback.c:28:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   28 | int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/infback.c:83:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   83 | local void fixedtables(state)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/infback.c:251:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  251 | int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/infback.c:635:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  635 | int ZEXPORT inflateBackEnd(strm)
      |             ^
4 warnings generated.
[ 27%] Building C object CMakeFiles/zlib.dir/inftrees.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inftrees.c:32:19: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   32 | int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
      |                   ^
1 warning generated.
[ 30%] Building C object CMakeFiles/zlib.dir/inffast.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/inffast.c:50:20: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   50 | void ZLIB_INTERNAL inflate_fast(strm, start)
      |                    ^
1 warning generated.
[ 32%] Building C object CMakeFiles/zlib.dir/trees.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:379:20: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  379 | void ZLIB_INTERNAL _tr_init(s)
      |                    ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:407:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  407 | local void init_block(s)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:451:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  451 | local void pqdownheap(s, tree, k)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:486:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  486 | local void gen_bitlen(s, desc)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:572:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  572 | local void gen_codes(tree, max_code, bl_count)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:615:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  615 | local void build_tree(s, desc)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:703:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  703 | local void scan_tree(s, tree, max_code)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:748:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  748 | local void send_tree(s, tree, max_code)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:799:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  799 | local int build_bl_tree(s)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:834:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  834 | local void send_all_trees(s, lcodes, dcodes, blcodes)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:863:20: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  863 | void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
      |                    ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:887:20: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  887 | void ZLIB_INTERNAL _tr_flush_bits(s)
      |                    ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:897:20: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  897 | void ZLIB_INTERNAL _tr_align(s)
      |                    ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:912:20: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  912 | void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
      |                    ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:1014:19: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1014 | int ZLIB_INTERNAL _tr_tally(s, dist, lc)
      |                   ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:1042:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1042 | local void compress_block(s, ltree, dtree)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:1102:11: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1102 | local int detect_data_type(s)
      |           ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:1136:16: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1136 | local unsigned bi_reverse(code, len)
      |                ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:1151:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1151 | local void bi_flush(s)
      |            ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/trees.c:1168:12: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
 1168 | local void bi_windup(s)
      |            ^
20 warnings generated.
[ 35%] Building C object CMakeFiles/zlib.dir/uncompr.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/uncompr.c:27:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   27 | int ZEXPORT uncompress2(dest, destLen, source, sourceLen)
      |             ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/uncompr.c:86:13: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
   86 | int ZEXPORT uncompress(dest, destLen, source, sourceLen)
      |             ^
2 warnings generated.
[ 37%] Building C object CMakeFiles/zlib.dir/zutil.o
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/zutil.c:135:22: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  135 | const char * ZEXPORT zError(err)
      |                      ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/zutil.c:307:22: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  307 | voidpf ZLIB_INTERNAL zcalloc(opaque, items, size)
      |                      ^
/home/user/.cache/bazel/_bazel_zplin/b97476d719d716accead0f2d5b93104f/sandbox/processwrapper-sandbox/2105/execroot/__main__/external/zlib/zutil.c:317:20: warning: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
  317 | void ZLIB_INTERNAL zcfree(opaque, ptr)
      |                    ^
3 warnings generated.
[ 40%] Linking C shared library libz.so
ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined
make[2]: *** [CMakeFiles/zlib.dir/build.make:321: libz.so.1.2.13] Error 1
make[1]: *** [CMakeFiles/Makefile2:93: CMakeFiles/zlib.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
_____ END BUILD LOGS _____
rules_foreign_cc: Build wrapper script location: bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib_foreign_cc/wrapper_build_script.sh
rules_foreign_cc: Build script location: bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib_foreign_cc/build_script.sh
rules_foreign_cc: Build log location: bazel-out/k8-fastbuild/bin/external/zlib/zlib-static-lib_foreign_cc/CMake.log

Target @zlib//:zlib-static-lib failed to build

cc @xytan0056

@ghost
Copy link
Author

ghost commented Jan 8, 2024

Can you paste the full workspace, with zlib srcs, or something where I can repro this fully?

@linzhp
Copy link
Contributor

linzhp commented Jan 8, 2024

You can build @zlib//:zlib-static-lib out of this workspace:

-- BUILD.bazel --
-- WORKSPACE --
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "hermetic_cc_toolchain",
    sha256 = "2eeb06a1996165575c1d13654ca178f8ba3ef34aae44f0afb201c5ac15181c68",
    strip_prefix = "hermetic_cc_toolchain-13b6062c668baf1d661de8a23230eb13c546b2ce",
    urls = [
        "https://github.com/uber/hermetic_cc_toolchain/archive/13b6062c668baf1d661de8a23230eb13c546b2ce.zip",
    ],
)

load("@hermetic_cc_toolchain//toolchain:defs.bzl", zig_toolchains = "toolchains")

# Plain zig_toolchains() will pick reasonable defaults. See
# toolchain/defs.bzl:toolchains on how to change the Zig SDK version and
# download URL.
zig_toolchains()

http_archive(
    name = "zlib",
    build_file = "//:zlib.build",
    sha256 = "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30",
    strip_prefix = "zlib-1.2.13",
    urls = [
        "https://storage.googleapis.com/mirror.tensorflow.org/zlib.net/zlib-1.2.13.tar.gz",
    ],
)

rules_foreign_cc_version = "a87e7542ee893ba1d8f3dd1505f9af10a308db92"

http_archive(
    name = "rules_foreign_cc",
    sha256 = "0abb19a1a169af5abb3801f80709895588bf2f6f6009d3af71a35152a583e6d0",
    strip_prefix = "rules_foreign_cc-{}".format(rules_foreign_cc_version),
    urls = [
        "https://github.com/bazelbuild/rules_foreign_cc/archive/{}.tar.gz".format(rules_foreign_cc_version),
    ],
)

load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

rules_foreign_cc_dependencies()
-- zlib.build --
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")

package(default_visibility = ["//visibility:public"])

filegroup(
    name = "all_srcs",
    srcs = glob(
        include = ["**"],
        exclude = ["*.bazel"],
    ),
)

cmake(
    name = "zlib-static-lib",
    cache_entries = select({
        "@platforms//os:linux": {
            "CMAKE_C_FLAGS": "${CMAKE_C_FLAGS:-} -fPIC",
        },
        "//conditions:default": {},
    }),
    generate_args = [],
    lib_source = "all_srcs",
    out_static_libs = ["libz.a"],
)

@ghost
Copy link
Author

ghost commented Jan 8, 2024

Just reproduced this without bazel:

wget https://storage.googleapis.com/mirror.tensorflow.org/zlib.net/zlib-1.2.13.tar.gz
tar -xf zlib*.gz
cd zlib-*
mkdir build; cd build
CC="zig cc -target x86_64-linux-gnu.2.28" cmake ..
make
<...>
Consolidate compiler generated dependencies of target zlib
[  2%] Linking C shared library libz.so
LLD Link... ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined
make[2]: *** [CMakeFiles/zlib.dir/build.make:321: libz.so.1.2.13] Error 1
make[1]: *** [CMakeFiles/Makefile2:93: CMakeFiles/zlib.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

@ghost
Copy link
Author

ghost commented Jan 8, 2024

Also with zlib-1.3. Also fails with zlib-1.3 and llvm lld 17 (no zig):

motiejus@mtwork:~/x/zlib-1.3$ mkdir build; cd build
motiejus@mtwork:~/x/zlib-1.3/build$ CC="clang-17  -fuse-ld=lld" cmake ..
-- The C compiler identification is Clang 17.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-17 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/motiejus/x/zlib-1.3/build
motiejus@mtwork:~/x/zlib-1.3/build$ make
[  2%] Building C object CMakeFiles/zlib.dir/adler32.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[  5%] Building C object CMakeFiles/zlib.dir/compress.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[  7%] Building C object CMakeFiles/zlib.dir/crc32.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 10%] Building C object CMakeFiles/zlib.dir/deflate.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 12%] Building C object CMakeFiles/zlib.dir/gzclose.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 15%] Building C object CMakeFiles/zlib.dir/gzlib.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 17%] Building C object CMakeFiles/zlib.dir/gzread.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 20%] Building C object CMakeFiles/zlib.dir/gzwrite.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 22%] Building C object CMakeFiles/zlib.dir/inflate.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 25%] Building C object CMakeFiles/zlib.dir/infback.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 27%] Building C object CMakeFiles/zlib.dir/inftrees.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 30%] Building C object CMakeFiles/zlib.dir/inffast.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 32%] Building C object CMakeFiles/zlib.dir/trees.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 35%] Building C object CMakeFiles/zlib.dir/uncompr.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 37%] Building C object CMakeFiles/zlib.dir/zutil.c.o
clang-17: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
[ 40%] Linking C shared library libz.so
ld.lld: error: version script assignment of 'local' to symbol 'gz_intmax' failed: symbol not defined
clang-17: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/zlib.dir/build.make:321: libz.so.1.3] Error 1
make[1]: *** [CMakeFiles/Makefile2:93: CMakeFiles/zlib.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
motiejus@mtwork:~/x/zlib-1.3/build$ 

Works with ld.lld-16.

@motiejus
Copy link
Collaborator

motiejus commented Jan 8, 2024

Works with zld though:

motiejus@mtwork:~/x/zlib-1.3/build$ CC="$HOME/code/zig/build/stage4/bin/zig cc -Wl,--no-lld -target x86_64-linux-gnu.2.28" cmake ..
-- The C compiler identification is Clang 17.0.6
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/motiejus/code/zig/build/stage4/bin/zig - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of off64_t
-- Check size of off64_t - done
-- Looking for fseeko
-- Looking for fseeko - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/motiejus/x/zlib-1.3/build
motiejus@mtwork:~/x/zlib-1.3/build$ make
[  2%] Building C object CMakeFiles/zlib.dir/adler32.c.o
[  5%] Building C object CMakeFiles/zlib.dir/compress.c.o
[  7%] Building C object CMakeFiles/zlib.dir/crc32.c.o
[ 10%] Building C object CMakeFiles/zlib.dir/deflate.c.o
[ 12%] Building C object CMakeFiles/zlib.dir/gzclose.c.o
[ 15%] Building C object CMakeFiles/zlib.dir/gzlib.c.o
[ 17%] Building C object CMakeFiles/zlib.dir/gzread.c.o
[ 20%] Building C object CMakeFiles/zlib.dir/gzwrite.c.o
[ 22%] Building C object CMakeFiles/zlib.dir/inflate.c.o
[ 25%] Building C object CMakeFiles/zlib.dir/infback.c.o
[ 27%] Building C object CMakeFiles/zlib.dir/inftrees.c.o
[ 30%] Building C object CMakeFiles/zlib.dir/inffast.c.o
[ 32%] Building C object CMakeFiles/zlib.dir/trees.c.o
[ 35%] Building C object CMakeFiles/zlib.dir/uncompr.c.o
[ 37%] Building C object CMakeFiles/zlib.dir/zutil.c.o
[ 40%] Linking C shared library libz.so
[ 40%] Built target zlib
[ 42%] Building C object CMakeFiles/zlibstatic.dir/adler32.c.o
[ 45%] Building C object CMakeFiles/zlibstatic.dir/compress.c.o
[ 47%] Building C object CMakeFiles/zlibstatic.dir/crc32.c.o
[ 50%] Building C object CMakeFiles/zlibstatic.dir/deflate.c.o
[ 52%] Building C object CMakeFiles/zlibstatic.dir/gzclose.c.o
[ 55%] Building C object CMakeFiles/zlibstatic.dir/gzlib.c.o
[ 57%] Building C object CMakeFiles/zlibstatic.dir/gzread.c.o
[ 60%] Building C object CMakeFiles/zlibstatic.dir/gzwrite.c.o
[ 62%] Building C object CMakeFiles/zlibstatic.dir/inflate.c.o
[ 65%] Building C object CMakeFiles/zlibstatic.dir/infback.c.o
[ 67%] Building C object CMakeFiles/zlibstatic.dir/inftrees.c.o
[ 70%] Building C object CMakeFiles/zlibstatic.dir/inffast.c.o
[ 72%] Building C object CMakeFiles/zlibstatic.dir/trees.c.o
[ 75%] Building C object CMakeFiles/zlibstatic.dir/uncompr.c.o
[ 77%] Building C object CMakeFiles/zlibstatic.dir/zutil.c.o
[ 80%] Linking C static library libz.a
[ 80%] Built target zlibstatic
[ 82%] Building C object CMakeFiles/example.dir/test/example.c.o
[ 85%] Linking C executable example
[ 85%] Built target example
[ 87%] Building C object CMakeFiles/minigzip.dir/test/minigzip.c.o
[ 90%] Linking C executable minigzip
[ 90%] Built target minigzip
[ 92%] Building C object CMakeFiles/example64.dir/test/example.c.o
[ 95%] Linking C executable example64
[ 95%] Built target example64
[ 97%] Building C object CMakeFiles/minigzip64.dir/test/minigzip.c.o
[100%] Linking C executable minigzip64
[100%] Built target minigzip64
motiejus@mtwork:~/x/zlib-1.3/build$ 

With the following changes to zig:

diff --git a/src/main.zig b/src/main.zig
index 4442234bd..6c440770c 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -898,6 +898,7 @@ fn buildOutputType(
     var rc_includes: Compilation.RcIncludes = .any;
     var manifest_file: ?[]const u8 = null;
     var linker_export_symbol_names: std.ArrayListUnmanaged([]const u8) = .{};
+    var use_lld: ?bool = null;
 
     // Tracks the position in c_source_files which have already their owner populated.
     var c_source_files_owner_index: usize = 0;
@@ -1928,6 +1929,10 @@ fn buildOutputType(
                             }
                             if (mem.eql(u8, linker_arg, "--build-id")) {
                                 build_id = .fast;
+                            } else if (mem.eql(u8, linker_arg, "--no-lld")) {
+                                use_lld = false;
+                            } else if (mem.eql(u8, linker_arg, "--use-lld")) {
+                                use_lld = true;
                             } else if (mem.eql(u8, linker_arg, "--as-needed")) {
                                 needed = false;
                             } else if (mem.eql(u8, linker_arg, "--no-as-needed")) {
@@ -2683,6 +2688,7 @@ fn buildOutputType(
     create_module.opts.emit_llvm_ir = emit_llvm_ir != .no;
     create_module.opts.emit_llvm_bc = emit_llvm_bc != .no;
     create_module.opts.emit_bin = emit_bin != .no;
+    create_module.opts.use_lld = use_lld;
     create_module.opts.any_c_source_files = create_module.c_source_files.items.len != 0;
 
     const main_mod = try createModule(gpa, arena, &create_module, 0, null, zig_lib_directory);

@motiejus
Copy link
Collaborator

motiejus commented Jan 8, 2024

Seems like a workaround is here: madler/zlib#865

cc @linzhp

Copy link
Contributor

@linzhp linzhp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested this with madler/zlib#865 in Uber. Everything passed.

@motiejus motiejus merged commit f5e9b9b into main Jan 8, 2024
4 checks passed
@motiejus motiejus deleted the motiejus-zig-version branch January 8, 2024 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lstat error does not set errno
2 participants