Skip to content
JonSnowbd edited this page Oct 21, 2021 · 2 revisions

Using ZT with FreeBSD

It is possible to build and use ZT with FreeBSD, with some caveats.

Using X11 / GLFW, the usual BSD problem arrises with using the linjoystick code, so the following workarounds apply :

Changes to build.zig :

In fn glLibrary() .. where it reads if (target.isLinux()) -> if (target.isLinux() or target.isFreeBSD()) to pickup the gl lib.

In fn glfwLibrary() ... copypaste the whole if (target.isLinux()) block to make a if (target.isFreeBSD()) block with the same content. Comment out the line that reads path ++ "src/dep/glfw/src/linux_joystick.c",

Hack the vendored GLFW library

Inject a couple of NULL functions to satisfy the linker

namely :

GLFWAPI void _glfwPlatformUpdateGamepadGUID(char *)
{
   // nop
}

GLFWAPI int _glfwPlatformPollJoystick(_GLFWjoystick *, int)
{                                 
   return GLFW_FALSE;
}

That will give you a working ZT install that passes zig build without compilation errors. It just wont have Gamepad or Joystick support. (Thats an upstream issue with GLFW)

Clone this wiki locally