SDL.zig icon indicating copy to clipboard operation
SDL.zig copied to clipboard

Doesn't build on freebsd

Open BornTactical opened this issue 2 years ago • 1 comments

error: ld.lld: undefined symbol: hid_init
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(BSD_JoystickInit) in archive /usr/local/lib/libSDL2.a
error: ld.lld: undefined symbol: hid_end_parse
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(BSD_JoystickUpdate) in archive /usr/local/lib/libSDL2.a
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(CreateHwData) in archive /usr/local/lib/libSDL2.a
error: ld.lld: undefined symbol: hid_start_parse
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(BSD_JoystickUpdate) in archive /usr/local/lib/libSDL2.a
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(CreateHwData) in archive /usr/local/lib/libSDL2.a
error: ld.lld: undefined symbol: hid_get_data
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(BSD_JoystickUpdate) in archive /usr/local/lib/libSDL2.a
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(BSD_JoystickUpdate) in archive /usr/local/lib/libSDL2.a
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(BSD_JoystickUpdate) in archive /usr/local/lib/libSDL2.a
error: ld.lld: undefined symbol: hid_get_item
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(BSD_JoystickUpdate) in archive /usr/local/lib/libSDL2.a
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(CreateHwData) in archive /usr/local/lib/libSDL2.a
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(CreateHwData) in archive /usr/local/lib/libSDL2.a
error: ld.lld: undefined symbol: hid_dispose_report_desc
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(BSD_JoystickClose) in archive /usr/local/lib/libSDL2.a
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(MaybeAddDevice) in archive /usr/local/lib/libSDL2.a
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(MaybeAddDevice) in archive /usr/local/lib/libSDL2.a
    note: referenced 1 more times
error: ld.lld: undefined symbol: inotify_init1
    note: referenced by SDL_sysjoystick.c
    note:               SDL_sysjoystick.o:(LINUX_JoystickInit) in archive /usr/local/lib/libSDL2.a
error: ld.lld: undefined symbol: inotify_add_watch
    note: referenced by SDL_sysjoystick.c
    note:               SDL_sysjoystick.o:(LINUX_JoystickInit) in archive /usr/local/lib/libSDL2.a
error: ld.lld: undefined symbol: hid_get_report_desc
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(CreateHwData) in archive /usr/local/lib/libSDL2.a
error: ld.lld: undefined symbol: hid_get_report_id
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(CreateHwData) in archive /usr/local/lib/libSDL2.a
error: ld.lld: undefined symbol: hid_report_size
    note: referenced by SDL_bsdjoystick.c
    note:               SDL_bsdjoystick.o:(CreateHwData) in archive /usr/local/lib/libSDL2.a

I addressed this by adding a new section to build.zig:

else if (target.os.tag == .freebsd) {
    exe.linkSystemLibrary("sdl2");
    exe.linkSystemLibrary("inotify");
    exe.linkSystemLibrary("usbhid");
}

I'm not sure what else it will need but that works for the example program at least.

BornTactical avatar May 04 '23 14:05 BornTactical

Duplicate of https://github.com/ziglang/zig/issues/14111. Workaround:

$ export PKG_CONFIG_SYSTEM_LIBRARY_PATH="/usr/local/lib"

or (csh-style)

% setenv PKG_CONFIG_SYSTEM_LIBRARY_PATH "/usr/local/lib"

jbeich avatar Jun 14 '23 20:06 jbeich