Closed 982945902 closed 8 months ago
Something is wrong with how you are trying to compile or the setup of your compiler. zlib is developed on a Mac and builds just fine there. You would need to provide actual information about how, exactly, you are attempting this build and in what environment.
Something is wrong with how you are trying to compile or the setup of your compiler. zlib is developed on a Mac and builds just fine there. You would need to provide actual information about how, exactly, you are attempting this build and in what environment.
sorry
build tool:bazel 6.4.0-homebrew clang: Apple clang version 14.0.3 (clang-1403.0.22.14.1) os: Darwin ZBMac-C02CW08SM 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:19:12 PDT 2022; root:xnu-8792.41.9~3/RELEASE_ARM64_T6020 arm64
zlib version:
def com_github_madler_zlib():
http_archive(
name = "com_github_madler_zlib", # 2017-01-15T17:57:23Z
build_file = "@sculib//bazel:zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
urls = [
"https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz",
"https://zlib.net/fossils/zlib-1.2.11.tar.gz",
"https://github.com/madler/zlib/archive/refs/tags/v1.2.11.tar.gz",
],
)
build file
cc_library(
name = "zlib",
srcs = glob(["*.c"]),
hdrs = glob(["*.h"]),
# Use -Dverbose=-1 to turn off zlib's trace logging. (#3280)
copts = [
"-w",
"-Dverbose=-1",
],
includes = ["."],
visibility = ["//visibility:public"],
)
Um yeah, no. You can't just grab all the .c and .h files and try to compile them. There is configuration required. Either you run ./configure
and make
, or use cmake.
@982945902: Can you try the current devel branch? What are your results?
Thanks in advance.
@Neustradamus bazel build file need add -Wno-implicit-function-declaration in copts
load("@rules_cc//cc:defs.bzl", "cc_library")
licenses(["notice"]) # BSD/MIT-like license
cc_library(
name = "zlib",
srcs = glob(["*.c"]),
hdrs = glob(["*.h"]),
# Use -Dverbose=-1 to turn off zlib's trace logging. (#3280)
copts = [
"-w",
"-Dverbose=-1",
"-Wno-unused-variable",
"-Wno-implicit-function-declaration",
],
includes = ["."],
visibility = ["//visibility:public"],
)
@madler: What do you think?
I think this issue is closed.
Um yeah, no. You can't just grab all the .c and .h files and try to compile them. There is configuration required. Either you run
./configure
andmake
, or use cmake.
Albeit a QoI issue, this can certainly be improved following the spirit of simplicity by adding some more detection to define Z_HAVE_UNISTD_H
in zconf.h
, as already done for some other cases. That is, if __WATCOMC__
counts, why not __APPLE__
? Or just that ./configure
is most favorable? I find no explicitly documented policy about this, and it is a non-starter for simplicity. (Notice there is no INSTALL
doc, and ./configure
is even not a standalone step in README
.) Moreover, what about having things like _LARGEFILE64_SOURCE
impliying Z_HAVE_UNISTD_H
? This is quite confusing.
Actually the op also has no clue of the idiomatic use and has a different solution than you've mentioned, which is quite wrong compared to a proper configuration: it should have been something like -DHAVE_UNISTD_H=1
instead of -Wno-implicit-function-declaration
. I see the improvement would prevent such misconfiguration.
the error reported as follow: