running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-apple-darwin" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-apple-darwin" "-stdlib=libc++" "-I" "src/zlib" "-fvisibility=hidden" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "./rust-master-20200804/build/x86_64-apple-darwin/stage1-tools/x86_64-apple-darwin/release/build/libz-sys-6b040c161b021160/out/build/src/zlib/gzlib.o" "-c" "src/zlib/gzlib.c"
cargo:warning=src/zlib/gzlib.c:214:15: error: implicitly declaring library function 'snprintf' with type 'int (char *, unsigned long, const char *, ...)' [-Werror,-Wimplicit-function-declaration]
cargo:warning= (void)snprintf(state->path, len + 1, "%s", (const char *)path);
cargo:warning= ^
cargo:warning=src/zlib/gzlib.c:214:15: note: include the header <stdio.h> or explicitly provide a declaration for 'snprintf'
cargo:warning=1 error generated.
exit code: 1
running: "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-apple-darwin" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-apple-darwin" "-stdlib=libc++" "-I" "src/zlib" "-fvisibility=hidden" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "./rust-master-20200804/build/x86_64-apple-darwin/stage1-tools/x86_64-apple-darwin/release/build/libz-sys-6b040c161b021160/out/build/src/zlib/gzread.o" "-c" "src/zlib/gzread.c"
exit code: 0
--- stderr
error occurred: Command "clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-apple-darwin" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-apple-darwin" "-stdlib=libc++" "-I" "src/zlib" "-fvisibility=hidden" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "./rust-master-20200804/build/x86_64-apple-darwin/stage1-tools/x86_64-apple-darwin/release/build/libz-sys-6b040c161b021160/out/build/src/zlib/gzlib.o" "-c" "src/zlib/gzlib.c" with args "clang" did not execute successfully (status code exit code: 1).
warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "./rust-master-20200804/build/x86_64-apple-darwin/stage0/bin/cargo" "build" "--target" "x86_64-apple-darwin" "-Zbinary-dep-depinfo" "-j" "4" "--release" "--manifest-path" "./rust-master-20200804/src/tools/cargo/Cargo.toml" "--features" "rustc-workspace-hack/all-static" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
Traceback (most recent call last):
File "./x.py", line 11, in <module>
bootstrap.main()
File "./rust-master-20200804/src/bootstrap/bootstrap.py", line 1009, in main
bootstrap(help_triggered)
File "./rust-master-20200804/src/bootstrap/bootstrap.py", line 995, in bootstrap
run(args, env=env, verbose=build.verbose)
File "./rust-master-20200804/src/bootstrap/bootstrap.py", line 143, in run
raise RuntimeError(err)
RuntimeError: failed to run: ./rust-master-20200804/build/bootstrap/debug/bootstrap build
Based on the master branch on github.com/rust-lang/rust checked out on 20200804:
./build/x86_64-apple-darwin/stage1/bin/rustc -V
rustc 1.47.0-dev
I got the same error while building the stable 1.45.2 branch. What gives?
Could you double-check that you have installed the dependencies and try to run x.py clean then re-build? https://github.com/rust-lang/rust#building-on-a-unix-like-system
I think it depends on your toolchains and you may be using stuff that we don't expect (actually, our macOS builders on pipelines build successfully).
I had the same issue on mac with clang 12, running $ sudo xcode-select --reset to point at xcode version (11.0.3) fixed this for me in case it helps anyone.
There is related iOS issue in libz-sys repository rust-lang/libz-sys/issues/44,
which indicate that snprintf declaration is protected by a feature test macro.
Fixing this on macOS should be analogous to rust-lang/libz-sys/pull/45.
Most helpful comment
There is related iOS issue in libz-sys repository rust-lang/libz-sys/issues/44,
which indicate that snprintf declaration is protected by a feature test macro.
Fixing this on macOS should be analogous to rust-lang/libz-sys/pull/45.