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 fails to build lib on macOS #1878

euantorano opened this Issue Jan 14, 2019 · 3 comments


None yet
3 participants
Copy link

euantorano commented Jan 14, 2019

Creating a new library with init-lib and then attempting to build it on macOS Mojave 10.14.2 fails.


mkdir zig-test && cd zig-test
zig init-lib
zig build


Undefined symbol: /Users/euantorano/Desktop/zig-crash-test/zig-cache/zig-crash-test.o: __mh_execute_header
symbol(s) not found
lld: warning: ignoring unknown argument: -headerpad_max_install_names
lld: warning: -sdk_version is required when emitting min version load command.  Setting sdk version to match provided min version

The following command exited with error code 1:
zig build-lib /Users/euantorano/Desktop/zig-crash-test/src/main.zig --cache-dir /Users/euantorano/Desktop/zig-crash-test/zig-cache --output /Users/euantorano/Desktop/zig-crash-test/zig-cache/libzig-crash-test.a --output-h /Users/euantorano/Desktop/zig-crash-test/zig-cache/zig-crash-test.h --name zig-crash-test

Build failed. The following command failed:
/Users/euantorano/Library/Application Support/zig/stage1/artifact/_rGLoCx9ObHWbibERqfIOmBmsy5bDjGpDd4abDyi3PGZpQIQRdgroELQ5n1mBwRO/build zig /Users/euantorano/Desktop/zig-crash-test /Users/euantorano/Desktop/zig-crash-test/zig-cache

Contents of the workspace after the build:

├── build.zig
├── src
│   └── main.zig
└── zig-cache
    ├── zig-crash-test.h
    └── zig-crash-test.o

2 directories, 4 files

This comment has been minimized.

Copy link

andrewrk commented Jan 15, 2019

Hmm this is interesting. I thought that symbol was guaranteed in libSystem. I'll have to investigate.


This comment has been minimized.

Copy link

wilsonk commented Feb 22, 2019

@andrewrk I think this was fixed with 28bf768 wasn't it?


This comment has been minimized.

Copy link

andrewrk commented Feb 22, 2019

That's right. See also #1981 and #1982

@andrewrk andrewrk closed this Feb 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.