Note that build-exe
command does not use build.zig
. This is fine, until you have a working command line.
The library is “libmysqlclient.so” you need -lmysqlclient
e.g.: zig build-exe src/main.zig -lc -lmysqlclient
If zig cannot find the library, provide an additional library path with -L/usr/local/..../lib
(libmysqlclient.so or libmysqlclient.so.* or libmysqlclient.a must be present in the specified folder).
The next problem might be locating where is mysql.h
that is included in the zig code. You can specify an additional include path using -I/usr/includes
(mysql.h must be present in the specified folder).
The final, working, command line must be like:
zig build-exe src/main.zig -lc -lmysqlclient -L/path/to/lib -I/path/to/include
If mysql is located at system locations the following is enough:
zig build-exe src/main.zig -lc -lmysqlclient