SDL Unable to resolve udev_device_get_action symbol while opening joystick context.

I am running through some tutorials on how to use SDL but I have hit an issue that is difficult to get around while using a joystick.

My program fails to open a joystick context with an error message:

Error: Failed loading udev_device_get_action: /lib/x86_64-linux-gnu/libSDL2-2.0.so.0: undefined symbol: _udev_device_get_action

I am developing on Kubuntu 20.04 and unfortunately its using a rather ancient version of SDL-2.0.10. I have attempted to compile my project with ’ -ludev ’ but it still fails to resolve that symbol. I have tried preloading that library but fails silently after that. I verified that that the packaged dev libraries are compiled with UDEV support and UDEV is on my system but I don’t understand while this particular symbol is not being found. I cannot upgrade my OS at this time because of video drivers, and going down the rabit’s hole of building a newer version of SDL2 is a dead last resort. (already sort of did that but a host of other issues with libraries and linking come up) I have done as much due diligence as I can come up with and I am stuck.

Without the LD_PRELOAD my stdout looks:
DEBUG: Failed loading udev_device_get_action: /lib/x86_64-linux-gnu/libSDL2-2.0.so.0: undefined symbol: _udev_device_get_action
CreateWindow
INFO: OpenGL shaders: ENABLED
INFO: Created renderer: opengl
CreateRenderer
CheckJoy

Joysticks found: 1

Unable to get a joystick handle

Error: Failed loading udev_device_get_action: /lib/x86_64-linux-gnu/libSDL2-2.0.so.0: undefined symbol: _udev_device_get_action

and with LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libudev.so.1
CreateWindow
INFO: OpenGL shaders: ENABLED
INFO: Created renderer: opengl
CreateRenderer
CheckJoy

Joysticks found: 1

Unable to get a joystick handle

Error:

There are no “unable to resolve” messages but fails all my valid pointer checks.
I did see one issue opened up for this message but the failure context seems to be different and for the ARM architecture and not x86_64.

Thanks.

Good news, when I compiled the testjoystick program from the source using branch release-2.0.10. It worked. Is there a linker option I need to be specifying for this issue?

Interestingly, even the testjoystick program still has a debug message of:
DEBUG: Failed loading udev_device_get_action: /lib/x86_64-linux-gnu/libSDL2-2.0.so.0: undefined symbol: _udev_device_get_action

Ok, sorry. I found my error. When doing my error check to see if SDL_JoystickOpen() doesn’t fail, I was inverting the returned bool.

for instance: bool ErrorCheck(value) returns false if the value is not 0. My mistake was !ErrorCheck rather than ErrorCheck.