vrischmann / zig-sqlite

zig-sqlite is a small wrapper around sqlite's C API, making it easier to use with Zig.
MIT License
367 stars 49 forks source link

Fix build for recent Zig C naming changes #133

Closed johnbcodes closed 1 year ago

johnbcodes commented 1 year ago

Description

Zig recently introduced a change to prevent C variable names conflicting with type names that I think is the reason compilation started to fail a few days ago. I don't understand the change enough to evaluate whether the result of sqlite3_index_constraint_usage being mangled to struct_sqlite3_index_constraint_usage_4 is valid, but my change fixes the build.

Checklist

No additional code so I didn't change the tests. Note that I can't get tests to run on my local machine as discussed previously but I no longer get errors compiling. Update: With #134 all tests pass on Mac OS X with this change.

vrischmann commented 1 year ago

Thanks ! I'm not sure if the mangling is expected here but I don't have the time to dig deeper right now, so this fix is fine for me.

johnbcodes commented 1 year ago

Looks like this isn't the end of this. In the latest build the Linux step has failures on the updated name:

/home/runner/work/zig-sqlite/zig-sqlite/zig-cache/o/1d89e7d91170a50b500bd328be51c64b/cimport.zig:1356:67: note: called from here
vtab.zig:235:34: error: root struct of file '.home.runner.work.zig-sqlite.zig-sqlite.zig-cache.o.1d89e7d91170a50b500bd328be51c64b.cimport' has no member named 'struct_sqlite3_index_constraint_usage_4'
vtab.zig:235:34: error: root struct of file '.home.runner.work.zig-sqlite.zig-sqlite.zig-cache.o.0a5ce126024b37aaeb18f9cd8de97216.cimport' has no member named 'struct_sqlite3_index_constraint_usage_4'
vtab.zig:235:34: error: root struct of file '.home.runner.work.zig-sqlite.zig-sqlite.zig-cache.o.fe0b1d530a3ec6a11431b8fa6f3a780d.cimport' has no member named 'struct_sqlite3_index_constraint_usage_4'
vtab.zig:235:34: error: root struct of file '.home.runner.work.zig-sqlite.zig-sqlite.zig-cache.o.488cb338597fd0c7228241b5321547a0.cimport' has no member named 'struct_sqlite3_index_constraint_usage_4'
vrischmann commented 1 year ago

Maybe the name gets mangled differently based on the platform or something.