| Summary: | OS X compilation error (probably due to XInput2 changes) | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Gabriel Jacobo <gabomdq> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | dimitris.zenios |
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Mac OS X (All) | ||
| Attachments: | Xcode build fix | ||
Adding Dimitris to the CC as he may know if this is related to those XInput2 changes This is weird since SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS is defined inside SDL_config_macosx.h.Since this is defined it shouldn't enter the below path #ifndef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS /*Define XGenericEventCookie as forward declaration when *xinput2 is not available in order to compile*/ struct XGenericEventCookie; typedef struct XGenericEventCookie XGenericEventCookie; #endif To tell you the truth though,I didn't compile the changes on macosx since I don't own a pc with mac.Did you change the compilation flags or disabled anything in SDL_config_macosx.h? My configure command is: ./configure --enable-silent-rules CFLAGS="-g -O2 -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -m32" LDFLAGS="-m32 -static-libgcc" --disable-shared --enable-static --prefix="some_path" After that, make -j8, nothing fancy. You can also try to undef SDL_VIDEO_DRIVER_X11_XINPUT2 1 SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1 SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 from SDL_config_macosx.h and try compiling again to see if it works Is there some test in configure to define/undefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS ? I think my system is not using SDL_config_macosx.h but rather the autogenerated/detected header SDL_config.h, if the test is there it's failing, and if it is not there we have to add one. AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent])) On OS X i'm getting "checking for XGetEventData in -lX11... no", I think it should be yes for SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS to be defined according to the configure code. Can this be related to the fact that you commited changes to configure.in but not to configure (AFAICT from the mercurial log) ? Same did autogen.sh one the next commit.Just tried it on a macosx I have and even though I get "checking for XGetEventData in -lX11... no" it compiles fine. Sam not Same :) Yeah, I ran autoconf.sh just to see if that was the problem, but it persists. What configure/make commands are you running that are working fine on your system? just doing configure --prefix=some_prefix make I made some progress... I'm using OS X 10.7.4, if I configure with: ./configure CFLAGS="-g -O2 -m32" LDFLAGS="-m32 -static-libgcc" --disable-shared --enable-static --prefix="path" The XGetEventData test works (result: yes) and compilation goes through fine. But if I add -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk to the configure line, the XGetEventData test fails (result: no) and compilation fails as well as reported earlier, I think this turns out to be a valid bug as this used to work before, can you verify? It looks like your compiling for an older mac version.I will reproduce tommorow and confirm. (In reply to comment #2) > To tell you the truth though,I didn't compile the changes on macosx since I > don't own a pc with mac. http://buildbot.libsdl.org/waterfall ... it shows you what the build results are for each change you push to hg.libsdl.org. --ryan. Waterfall does not show any errors regarding Xinput2 on any build.It seems that the problem is when compiling for older macosx (10.6 in this case). (In reply to comment #15) > Waterfall does not show any errors regarding Xinput2 on any build. Yeah? http://buildbot.libsdl.org/builders/sdl-macosx-xcode/builds/306/steps/compile/logs/stdio In file included from /buildbot/slave/SDL/sdl-macosx-xcode/src/Xcode/SDL/../../src/video/x11/SDL_x11dyn.c:27: /buildbot/slave/SDL/sdl-macosx-xcode/src/Xcode/SDL/../../src/video/x11/SDL_x11dyn.h:57:36: error: X11/extensions/XInput2.h: No such file or directory In file included from /buildbot/slave/SDL/sdl-macosx-xcode/src/Xcode/SDL/../../src/video/x11/SDL_x11dyn.c:110: /buildbot/slave/SDL/sdl-macosx-xcode/src/Xcode/SDL/../../src/video/x11/SDL_x11sym.h:131: error: expected declaration specifiers or '...' before 'XGenericEventCookie' /buildbot/slave/SDL/sdl-macosx-xcode/src/Xcode/SDL/../../src/video/x11/SDL_x11sym.h:131: error: expected declaration specifiers or '...' before 'XGenericEventCookie' (etc.) (The Mac OS X buildslaves are all running 10.6) --ryan. Indeed.You are right.I will take a closer look tonight. Created attachment 872 [details]
Xcode build fix
OK from the discussion, it seems there are two bugs.
First is when compiling the traditional way for older macosx version and the second is when compiling through Xcode.The attached patch, fixes the second problem (Some defines where wrong and also files where missing).I am still looking at the first problem
I am on macosx 10.6.8
and compile using the command
../configure --enable-silent-rules CFLAGS="-g -O2 -mmacosx-version-min=10.6 -isysroot /Developer/SDKs/MacOSX10.6.sdk -m32" LDFLAGS="-m32 -static-libgcc" --disable-shared --enable-static --prefix=/Users/zenios/lib
Using the above command everything works ok.Most probably it has something to do with the newer version of macosx.From what i understand XGetEventData can not be found in the lib (SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS not defined) but the headers include it. (error: previous declaration of ‘XGenericEventCookie’ was here).
Try changing in configure.in
AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
with
AC_MSG_CHECKING(for support generic events)
have_generic_events=no
AC_TRY_COMPILE([
#include <X11/Xlib.h>
#include <X11/Xproto.h>
extern Bool XGetEventData(Display* a,XGenericEventCookie* b);
],[
],[
have_generic_events=yes
AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS)
])
AC_MSG_RESULT($have_generic_events)
and retry.
Dimitris Zenios
Looking at the bug again it seems that the problem is at the parameters you pass when compiling. -isysroot dir This option is like the --sysroot option, but applies only to header files. See the --sysroot option for more information. Maybe you have to change to --sysroot=dir Use dir as the logical root directory for headers and libraries. For example, if the compiler would normally search for headers in /usr/include and libraries in /usr/lib, it will instead search dir/usr/include and dir/usr/lib. If you use both this option and the -isysroot option, then the --sysroot option will apply to libraries, but the -isysroot option will apply to header files. The way you were compiling, you use the headers of macosx 10.6 but the libraries of macosx 10.7 Dimitris Zenios p.s: I am not an expert when comes to macosx compiling.Comments and tips are welcome. THANKS! Replacing -isysroot for --sysroot= solves the problem, feel free to close after the Xcode build fix is reviewed/accepted. Amazingly, to compile for iOS I have to use -isysroot instead of --sysroot= (though I use configure/make for iOS, I overwrite the generated SDL_config.h with SDL_config_iphoneos.h ) ...sigh. See here: http://www.cybergarage.org/twiki/bin/view/Main/IosDevTips I am glad that your problem was fixed.I will ping Ryan in order to check the patch for Xcode and close the bug, Sam fixed Xcode projects http://hg.libsdl.org/SDL/rev/079ecfd1cde7 |
I'm getting a compilation error that started happening after updating my copy with the recent changes... libtool: compile: gcc -g -O2 -mmacosx-version-min=10.6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -m32 -DUSING_GENERATED_CONFIG_H -I./include -mmmx -m3dnow -msse -msse2 -DTARGET_API_MAC_CARBON -DTARGET_API_MAC_OSX -fvisibility=hidden -I/usr/X11R6/include -D_THREAD_SAFE -falign-loops=16 -force_cpusubtype_ALL -fpascal-strings -Wall -MMD -MT build/SDL_x11events.lo -c src/video/x11/SDL_x11events.c -o build/SDL_x11events.o In file included from src/video/x11/SDL_x11events.c:33: src/video/x11/SDL_x11xinput2.h:30: error: conflicting types for ‘XGenericEventCookie’ /usr/X11R6/include/X11/Xlib.h:975: error: previous declaration of ‘XGenericEventCookie’ was here /usr/X11R6/include/X11/Xlib.h: typedef struct { int type; /* of event. Always GenericEvent */ unsigned long serial; /* # of last request processed */ Bool send_event; /* true if from SendEvent request */ Display *display; /* Display the event was read from */ int extension; /* major opcode of extension that caused the event */ int evtype; /* actual event type. */ unsigned int cookie; void *data; } XGenericEventCookie; src/video/x11/SDL_x11xinput2.h: #ifndef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS /*Define XGenericEventCookie as forward declaration when *xinput2 is not available in order to compile*/ struct XGenericEventCookie; typedef struct XGenericEventCookie XGenericEventCookie; #endif