We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4267

Summary: linkage failure with --enable-hidapi because of missing libudev symbols
Product: SDL Reporter: Ozkan Sezer <sezeroz>
Component: joystickAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: All   
OS: Linux   
Attachments: hidapi dynamic udev initial patch

Description Ozkan Sezer 2018-09-24 10:22:31 UTC
Current hg, when configured with --enable-hidapi on Linux, fails
linkage because of missing udev symbols:  We link dynamically to
libudev, but use direct calls to libudev functions.

build/.libs/SDL_hidapijoystick.o: In function `HIDAPI_ShutdownDiscovery':
src/joystick/hidapi/SDL_hidapijoystick.c:373: undefined reference to `udev_monitor_unref'
src/joystick/hidapi/SDL_hidapijoystick.c:376: undefined reference to `udev_unref'
build/.libs/SDL_hidapijoystick.o: In function `HIDAPI_UpdateDiscovery':
src/joystick/hidapi/SDL_hidapijoystick.c:342: undefined reference to `udev_monitor_receive_device'
src/joystick/hidapi/SDL_hidapijoystick.c:344: undefined reference to `udev_device_unref'
build/.libs/SDL_hidapijoystick.o: In function `HIDAPI_InitializeDiscovery':
src/joystick/hidapi/SDL_hidapijoystick.c:275: undefined reference to `udev_new'
src/joystick/hidapi/SDL_hidapijoystick.c:277: undefined reference to `udev_monitor_new_from_netlink'
src/joystick/hidapi/SDL_hidapijoystick.c:279: undefined reference to `udev_monitor_enable_receiving'
src/joystick/hidapi/SDL_hidapijoystick.c:280: undefined reference to `udev_monitor_get_fd'
Comment 1 Sam Lantinga 2018-09-24 15:46:35 UTC
True, although HIDAPI on Linux isn't recommended because it requires root and doesn't add any significant benefit there.

Would you like to write a dynamic loading patch?
Comment 2 Ozkan Sezer 2018-09-24 16:19:36 UTC
(In reply to Sam Lantinga from comment #1)
> Would you like to write a dynamic loading patch?

OK, will look at it.
Comment 3 Ozkan Sezer 2018-09-24 18:43:03 UTC
Created attachment 3310 [details]
hidapi dynamic udev initial patch

Attached is an initial quick hack.  Please review.
Comment 4 Sam Lantinga 2018-09-24 23:33:42 UTC
Looks good!
https://hg.libsdl.org/SDL/rev/b527a6a49bfd