How to link a shared library with Zig 0.16 (linkSystemLibrary not found)

When I run the build script, which was written for 0.15.2, then the build breaks with:

build.zig:27:27: error: no field or member function named ‘linkSystemLibrary’ in ‘Build.Step.Compile’

How do I link a shared library to a system library with Zig 0.16.0?

step.root_module.linkSystemLibrary(...)

3 Likes

For future reference, when an api disapears, go back a version and look at the docs. It will mention if it is deprecated and if so what it is replaced with.

Also pay attention to deprecations in release notes/docs so you can transition before they get removed, they almost always give a grace period of at least 1 version.

4 Likes

That’s an important information. I never would have considered to read the old documentation, because I would not have expected to be changed. Thank you.

With language changes slowing down, you should absolutely expect std to change more often now. 0.16 is a prime example of that.

1 Like