I'm writing a program for raspberry pi but compiling it on my mac to speed up the compilation. I've got the basic cross-compilation working but now struggling to figure out how to use pigpio, a GPIO c shared library already on the raspberry pi.
I've tried these approaches (all separate approaches)
in build.zig, attempting to at least point the build at the link location:
exe.addSystemIncludePath-> build expects a local version of pigpioexe.linkSystemLibrary2("pigpio", .{.preferred_link_mode = .dynamic});-> also expects local version
in main.zig, attempting to do the "import" and library calls at runtime
std.DynLib.open("/lib/libpigpio.so")-> some ElfHashTableNotFound error at runtime
in main.zig, attempting to do normal @cImports -> expects a local version of pigpio
in pigpio.zig, attempting to just declare extern functions and hoping calling them resulted in the symbols being found on the host machine's lib
pub extern fn gpioInitialise() c_int;
pub extern fn gpioSetMode(gpio: c_uint, mode: c_uint) c_int;
pub extern fn gpioWrite(gpio: c_uint, level: c_uint) c_int;
pub extern fn gpioTerminate() void;
Excuse me if any of this is naive, I'm not experienced with building C. I've done some FFI stuff from dynamic langauages into .so libraries but never compiled languages.
Is there a simple solution here?