Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL_GameControllerHasRumble is undefine #267

Closed
tienake opened this issue Sep 26, 2023 · 3 comments
Closed

SDL_GameControllerHasRumble is undefine #267

tienake opened this issue Sep 26, 2023 · 3 comments

Comments

@tienake
Copy link

tienake commented Sep 26, 2023

In src/game_controller.cpp line 324
SDL_GameControllerHasRumble is undefine
Fail to build joy

@mor2code
Copy link

mor2code commented Oct 2, 2023

focal 20.04 SDL version is 20.10, it does not have SDL_GameControllerHasRumble, function was implemented at SDL 2.18.

I have replaced the call with SDL_GameControllerRumble sending zeros in all 3 parameters it should have same effect.

current:
if (SDL_GameControllerHasRumble(game_controller_)) {
change to :
if (0==SDL_GameControllerRumble(game_controller_, 0, 0, 0)) {

for backward compatibility please don't use SDL_GameControllerHasRumble.

attached diff

game_controller.diff.txt

@meyerj
Copy link

meyerj commented Oct 13, 2023

Same problem for me when building ROS Humble from source in Ubuntu 20.04 Focal (a Tier 3 platform):

[ 50%] Building CXX object CMakeFiles/game_controller.dir/src/game_controller.cpp.o
/opt/ros/humble/src/joystick_drivers/joy/src/game_controller.cpp: In member function ‘void joy::GameController::handleControllerDeviceAdded(const SDL_ControllerDeviceEvent&)’:
/opt/ros/humble/src/joystick_drivers/joy/src/game_controller.cpp:319:7: error: ‘SDL_GameControllerHasRumble’ was not declared in this scope; did you mean ‘SDL_GameControllerRumble’?
  319 |   if (SDL_GameControllerHasRumble(game_controller_)) {
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |       SDL_GameControllerRumble
make[2]: *** [CMakeFiles/game_controller.dir/build.make:63: CMakeFiles/game_controller.dir/src/game_controller.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:167: CMakeFiles/game_controller.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Installed versions:

$ dpkg -l | grep libsdl2
ii  libsdl2-2.0-0:amd64                                 2.0.10+dfsg1-3                        amd64        Simple DirectMedia Layer
ii  libsdl2-dev:amd64                                   2.0.10+dfsg1-3                        amd64        Simple DirectMedia Layer development files

and sdl2_vendor selects the system version by default.

If this is the only detail, then I agree with @mor2code that the joy package should probably be kept backwards-compatible by either using the old API or by compiling conditionally (the version can be checked by including SDL2/SDL_version.h).

I don't see how #270 would solve the problem (and it does not) as long as SDL2_FOUND is true and we use the system version. I tested that patch, without success.

The pull request that introduced the new API: #258

This repository also has a humble-devel branch that is not affected, but the rosdistro index and https://index.ros.org/p/joy/#humble point to the ros2 branch for Humble?

@clalancette
Copy link
Contributor

Closing this as it was fixed by #273 .

This repository also has a humble-devel branch that is not affected, but the rosdistro index and https://index.ros.org/p/joy/#humble point to the ros2 branch for Humble?

Yeah, we can probably just remove that humble-devel branch, as we aren't currently using it (as far as I know). I'll take a quick look and then do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants