Jump to content

[SOLVED] Building libraries throws "zlib build failed" error on macOS Catalina 10.15.5

Recommended Posts

Hello everyone!

Newbie here. I'm trying build 0AD from source by following the instructions given here for macOS. When running the below command,


The process begins, but ends up throwing an error that says "zlib build failed". Please find the terminal message below:

Building zlib...
~/0AD Source/0ad/libraries/osx/zlib/zlib-1.2.11 ~/0AD Source/0ad/libraries/osx/zlib ~/0AD Source/0ad/libraries/osx
patching file configure
Hunk #1 succeeded at 862 with fuzz 2 (offset 87 lines).
Building static library libz.a version 1.2.11 with clang.
Checking for size_t... Yes.
Checking for off64_t... No.
Checking for fseeko... Yes.
Checking for strerror... Yes.
Checking for unistd.h... Yes.
Checking for stdarg.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for attribute(visibility) support... Yes.
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN -I. -c -o example.o test/example.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o adler32.o adler32.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o crc32.o crc32.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o deflate.o deflate.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o infback.o infback.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o inffast.o inffast.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o inflate.o inflate.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o inftrees.o inftrees.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o trees.o trees.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o zutil.o zutil.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o compress.o compress.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o uncompr.o uncompr.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o gzclose.o gzclose.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o gzlib.o gzlib.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o gzread.o gzread.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN  -c -o gzwrite.o gzwrite.c
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN -I. -c -o minigzip.o test/minigzip.c
libtool -o libz.a adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o 
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN -o example example.o -L. libz.a
clang -mmacosx-version-min=10.9 -arch x86_64 -fvisibility=hidden -DHAVE_HIDDEN -o minigzip minigzip.o -L. libz.a
/bin/sh: line 0: [: /Users/lonehawk/0AD: binary operator expected
/bin/sh: line 0: [: /Users/lonehawk/0AD: binary operator expected
/bin/sh: line 0: [: /Users/lonehawk/0AD: binary operator expected
/bin/sh: line 0: [: /Users/lonehawk/0AD: binary operator expected
/bin/sh: line 0: [: /Users/lonehawk/0AD: binary operator expected
rm -f /Users/lonehawk/0AD Source/0ad/libraries/osx/zlib/lib/libz.a
cp libz.a /Users/lonehawk/0AD Source/0ad/libraries/osx/zlib/lib
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
       cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
make: *** [install-libs] Error 64
ERROR: zlib build failed

My Cmake version is 3.10.2. My terminal uses bash.

I would appreciate any help regarding this. Thank you all in advance!

Edited by lonehawk
updated the title
Link to post
Share on other sites

Hi Stan!

I found the issue. My checkout directory had a space in its name. i.e "0AD Source" as opposed to "0ADSource". Renaming the directory and building it fixed the problem. Thank you for the help.

Is there a way I can mark this thread as "Solved" or "Fixed"? For now, I'm updating the title itself


Edited by lonehawk
updated title
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...