Linux: @cImport requires compiling with "--library c"
Brought to you by:
anthon
When I try compiling the "Zig code only" example in the readme, I get the following error:
cmd zig build-lib -dynamic -DPYHEXVER=50857712 --name zig_sum.cpython-38-x86_64-linux-gnu -I /usr/include/python3.8 -I /usr/include sum.zig
./sum.zig:3:11: error: C import failed
const c = @cImport({
^
./sum.zig:3:11: note: libc headers not available; compilation does not link against libc
const c = @cImport({
This is fixed by passing --library c to the command-line of zig build-lib.
I was able to solve this with the following patch: