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 1659 - testgamecontroller.c does not build on SDL without Joystick/Haptic support
Summary: testgamecontroller.c does not build on SDL without Joystick/Haptic support
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.0
Hardware: x86_64 Windows 7
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-10 17:05 UTC by Andreas Schiffler
Modified: 2012-12-31 16:32 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schiffler 2012-12-10 17:05:26 UTC
When SDL is build without Joystick/Haptic (i.e. I tend to have to do this on Windows with cygwin/mingw32: ../configure --disable-joystick --disable-haptic) the tests don't build anymore.
 
One probably needs to define some stubs in SDL for the missing functions (and add some detection in testgamecontroller.c so it doesn't run).

gcc -o testgamecontroller.exe testgamecontroller.c -g -O2
-I/usr/local/include/SDL2 -I/usr/include/mingw -mno-cygwin 
-Dmain=SDL_main -DHAVE_OPENGL -L/usr/local/lib -lmingw32 -lSDL2main
-lSDL2 -mno-cygwin -mwindows
/tmp/ccQ0QJSS.o: In function `WatchGameController':
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:73: undefined 
reference to `_SDL_GameControllerName'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:113: undefined 
reference to `_SDL_GameControllerGetButton'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:122: undefined 
reference to `_SDL_GameControllerGetAxis'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:130: undefined 
reference to `_SDL_GameControllerGetAxis'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:147: undefined 
reference to `_SDL_GameControllerGetAttached'
/tmp/ccQ0QJSS.o: In function `SDL_main':
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:170: undefined 
reference to `_SDL_NumJoysticks'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:171: undefined 
reference to `_SDL_IsGameController'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:170: undefined 
reference to `_SDL_NumJoysticks'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:174: undefined 
reference to `_SDL_GameControllerNameForIndex'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:183: undefined 
reference to `_SDL_GameControllerOpen'
/cygdrive/i/Sources/SDL/test/testgamecontroller.c:193: undefined 
reference to `_SDL_GameControllerClose'
collect2: ld returned 1 exit status
Makefile:92: recipe for target `testgamecontroller.exe' failed
make: *** [testgamecontroller.exe] Error 1

On 12/10/2012 3:46 PM, Sam Lantinga wrote:
> For some reason when the haptic and joystick subsystems are disabled the code is explicitly excluded from the build.  This isn't the case for the audio and video subsystems.  I'll have to look into why that was done at some point.  I think the original idea was that disabling a subsystem completely excised the API, but then later that was revised to just stubbing the API and the joystick and haptic code wasn't updated.
>
> testjoystick suffers from the same problem and I think always has.
Comment 1 Sam Lantinga 2012-12-31 16:32:41 UTC
Andreas fixed this by checking for disabled systems in the test programs