Summary
SDL on OSX, How does it work ?
Metadata
- Id: 11e1688a5052fd0b698f67401d2208c1e2ce287a
- Trac id: 995
- Type: defect
- Reporter: paines
- Owner:
- Cc:
- Status: closed
- Component: unknown
- Estimated difficulty:
- Resolution: fixed
- Priority: major
- Milestone: someday
- Version: 4.8.x
- Changetime: 2013-10-10 14:04:05 UTC
- Created: 2013-03-12 12:23:51 UTC
- Keywords: sdl osx
Description
I compiled and installed the SDL egg using libsdl-framework via macports. When now compiling and running a Chicken App or using csi, it will segfault with an NSInternalInconsistencyException exception. Some sources state that SDLmain / SDL_Init must be called at first like this: (cond-expand (compile-sdl (declare (foreign-declare "#include \"SDL.h\"\n")) (foreign-code "SDL_Init(SDL_INIT_EVERYTHING);")) (else (sdl-init sdl_init_everything))) .... more code
and then compile it with csc -feature compile-sdl file.scm under OSX, which still gives the same exception.
One more suggestion is to use the parameter SDL_VIDEODRIVER=x11 ./myOSXBinary but this won't produce a working GFX context.
I am not sure if this is a real bug, or I am just not using SDL correctly under Chicken + OSX. I hope someone can clear things up.
Changes and comments
[2013-03-12 14:05:09 UTC] paines wrote:
One thing to get things working is (at least this worked for me under OSX 10.8.2 and macports): sudo port install xorg sudo port install xterm Then start Xorg via Mission Control. X icon will appear in the dock. Right click on the X and then start a Terminal. From here you can do e.g. SDL_VIDEODRIVER=x11 csi and develop interactively or compile your app and start it with SDL_VIDEODRIVER=x11 ./yourBinary.
Isn't there an easier way ? The resulting binary isn't shippable or shareable among others.
[2013-03-12 17:59:25 UTC] paines wrote:
I meant Launchpad instead of Mission Control.
[2013-10-10 14:04:05 UTC] paines changed status from new to closed
[2013-10-10 14:04:05 UTC] paines set resolution to fixed
[2013-10-10 14:04:05 UTC] paines wrote:
The solution is to Init SDL under OSX is like this:
(declare (foreign-declare "#include<SDL/SDL.h>\n")) (foreign-code "SDL_Init(SDL_INIT_EVERYTHING);")
and compile the whole thing via csc yourApp.scm -lSDLmain -framework Cocoa -framework Foundation