Skip to content

Commit c869a17

Browse files
authored
Fix regression in building zlib (#1935)
1 parent 24b9dea commit c869a17

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

crate_universe/3rdparty/BUILD.zlib.bazel

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ _ZLIB_PREFIXED_HEADERS = ["{}/{}".format(_ZLIB_HEADER_PREFIX, hdr) for hdr in _Z
3131
for hdr in _ZLIB_HEADERS
3232
]
3333

34+
_COMMON_COPTS = [
35+
"-Wno-deprecated-non-prototype",
36+
"-Wno-unused-variable",
37+
"-Wno-implicit-function-declaration",
38+
]
39+
3440
cc_library(
3541
name = "zlib",
3642
srcs = [
@@ -55,12 +61,15 @@ cc_library(
5561
] + _ZLIB_HEADERS,
5662
hdrs = _ZLIB_PREFIXED_HEADERS,
5763
copts = select({
64+
"@platforms//os:linux": [
65+
# Required for opt builds to avoid
66+
# `libzlib.a(crc32.o): requires unsupported dynamic reloc 11; recompile with -fPIC`
67+
"-fPIC",
68+
# Silence all warnings
69+
"-w",
70+
] + _COMMON_COPTS,
5871
"@platforms//os:windows": [],
59-
"//conditions:default": [
60-
"-Wno-deprecated-non-prototype",
61-
"-Wno-unused-variable",
62-
"-Wno-implicit-function-declaration",
63-
],
72+
"//conditions:default": _COMMON_COPTS,
6473
}),
6574
includes = ["zlib/include/"],
6675
visibility = ["//visibility:public"],

0 commit comments

Comments
 (0)