# Fix linking issues on BigSur · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/317c555a5cdc52612e998d8b4bcbaf730be1a6f1)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 317c555a5cdc52612e998d8b4bcbaf730be1a6f1

Requested commit: 317c555a5cdc52612e998d8b4bcbaf730be1a6f1

Commit: 317c555a5cdc52612e998d8b4bcbaf730be1a6f1

Tree: 0c414e11cfb2de91e0c7ee6485d784f61dc4330a

Author: Jakub Konka

Committer: Jakub Konka

## Message

```
Fix linking issues on BigSur

This commit fixes linking issue on macOS 11 BigSur by appending
a prefix path to all lib and framework search paths known as
`-syslibroot`.

The reason this is needed is that in macOS 11, the system libraries
and frameworks are no longer readily available in the filesystem.
Instead, the new macOS ships with a built-in dynamic linker cache
of all system-provided libraries, and hence, when linking with either
`lld.ld64` or `ld64`, it is required to pass in `-syslibroot [dir]`.
The latter can usually be obtained by invoking `xcrun --show-sdk-path`.
With this commit, Zig will do this automatically when compiling natively
on macOS. However, it also provides a flag `-syslibroot` which can be
used to overwrite the automtically populated value.

To summarise, with this change, the user of Zig is not required to
generate and append their own syslibroot path. Standard invocations
such as `zig build-exe hello.zig` or `zig build` for projects will
work out of the box. The only missing bit is `zig cc` and `zig c++`
since the addition of the `-syslibroot` option would be a mismatch
between the values provided by `clang` itself and Zig's wrapper.

```

## Parents

- [909aae8153e7ac71197bc9f864e4ceb2793317f2](https://git.cafe/gitcafe/zig/commit/909aae8153e7ac71197bc9f864e4ceb2793317f2?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/317c555a5cdc52612e998d8b4bcbaf730be1a6f1?format=markdown)
