It seems the purpose of Explain Category needs some clarification.
My take is that a first post in a topic in this category
should be more like a request to explain some things,
but not giving an explanation of “some things”,
as if someone asked to explain these “some things”.
I’m really sorry that I placed this on the wrong category.
I started learning zig 2 weeks ago and if there is one thing I’ve noticed is the lack of guides or documentation.
I’ve been dealing with this problem of trying to link static files with C headers but the internet didn’t offer me anything that solves my this problem directly especially on Zig 0.13.0 on a linux machine. So when I kinda found this work around, I decided to place it here since I don’t have any blog website at the moment.
At first I thought that I should place it under Help category but I realized that I’m not looking for help so I sort of tried to place on where I thought it should be.
But I would be more diligent next time.
I’ve been able to get complex build systems working using the official build docs. There is only one example of linkSystemLibrary, but it is there. I think more of the focus within the Zig community is in building C sources within the build script rather than linking pre-built libraries. Have you considered compiling math.c within build.zig instead?
I’ve seen a lot of tutorials on how to compile c within build.zig?
However I’m more of like, what do I do if an “unusual scenario like this” happens guy.
I’ve haven’t built something significant using zig lang yet and I’m just tinkering with the tools available. While tinkering it came to me like, what if I found a good framework with only headers and static files on it, then I did some basic scenarios then did some googling and at best I’ve seen a youtube tutorial with the same conditions as I mentioned above but the only problem is the youtuber is windows and a different version of zig so I can’t apply what he did on that video to my machine.
And then had trouble searching for a solution online. I didn’t found a solution which directly solves it so what I tried reducing the whole problem to smaller more specific fragments, find solutions on them then try applying what I learned those small situations merging them back to the bigger problem and then I was able to figure out this solution.
I decided to post it here just in case I found myself on a somewhat similar situation in the future for easier referencing. I have a local folder where I place my notes but it’s nice to have one also online.