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 3303 - SDL window does not appear with libsdl 1.2.15 and Mac OS X 10.11
Summary: SDL window does not appear with libsdl 1.2.15 and Mac OS X 10.11
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 1.2.15
Hardware: x86 Mac OS X (All)
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-31 11:44 UTC by Fernando Lopez
Modified: 2019-09-11 10:57 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fernando Lopez 2016-03-31 11:44:19 UTC
This code works with Mac OS X 10.9 and 10.10 showing a black window, but with Mac OS X 10.11 the window does not appear.

#include <SDL.h>
#define SCREEN_WIDTH 800
#define SCREEN_HEIGHT 640
#define SCREEN_COLOR_DEPTH 32

int main(int argc, char *argv[]) {
	SDL_Surface* screen = NULL;
  // Initialize SDL's main subsystem: video
  if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    printf("Error al iniciar SDL: %s\n", SDL_GetError());
    exit(1);
  }
  atexit(SDL_Quit);
  // Creates a surface windows
  screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_COLOR_DEPTH, SDL_SWSURFACE);
  if (screen == NULL){
    printf("Error initializing video mode: '%s'\n", SDL_GetError());
    exit(1);
  }
  // Set the window title
  SDL_WM_SetCaption("Graphics primitives", NULL);
  
  // Dump the screen
  SDL_Flip(screen);
  // Wait 5000 ms
  SDL_Delay(5000);
  return 0;
}

I am linknig with sdl-config recommended flags:
$ sdl-config --cflags --libs
-I/opt/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE
-L/opt/local/lib -lSDLmain -Wl,-framework,AppKit -lSDL -Wl,-framework,Cocoa

Do you know how can I do it work with Mac OS X 10.11?

Thanks
Comment 1 Alex Szpakowski 2016-04-01 16:49:27 UTC
Have you tried using the latest Mercurial code for SDL 1.2?

(I definitely recommend upgrading to SDL 2 ASAP though, regardless).
Comment 2 Fernando Lopez 2016-04-02 08:21:38 UTC
Hello,

I have download SDL from Mercurial:

hg clone http://hg.libsdl.org/SDL

But this appear to be SDL2. Do you have any document describing how to download/compile SDL 1.2 from Mercurial?

Thanks
Comment 3 Alex Szpakowski 2016-04-02 16:36:19 UTC
Switch to the branch 'SDL-1.2' after you've cloned it: hg update SDL-1.2
Comment 4 Fernando Lopez 2016-04-08 10:11:59 UTC
Hello,

I have installed the last version with these commands:

$hg clone http://hg.libsdl.org/SDL
hg update SDL-1.2
./autogen.sh # README.MacOSX does not include this step
./configure
make
sudo make install

And it is still failing (the screen does not appear) with Mac OS X 10.11, but work ok with Mac OS X 10.10.


I need to maintain compatibility with SDL 1.2. Could you double-check what is producing this error?

Thanks
Comment 5 StormFiber 2019-01-14 08:20:30 UTC
(In reply to Fernando Lopez from comment #2)
> Hello,
> 
> I have download SDL from Mercurial:
> 
> hg clone https://whatstatus.co/happy-birthday-meme
> 
> But this appear to be SDL2. Do you have any document describing how to
> download/compile SDL 1.2 from Mercurial?
> 
> Thanks

it is still failing (the screen does not appear) with Mac OS X 10.11, but work ok with Mac OS X 10.10. I need to maintain compatibility with SDL 1.2. Could you double-check what is producing this error?
Comment 6 Ozkan Sezer 2019-09-04 08:06:31 UTC
On the failing 10.11 setup, do you build SDL-1.2 yourself on
that machine against new SDKs, or do you use the prebuilt
ones downloaded from SDL download pages?
Comment 7 Fernando Lopez 2019-09-06 15:31:16 UTC
Hello,

You can reproduce this problem with the SDL library available in MacPorts:

$sudo port installed libsdl

The following ports are currently installed:
  libsdl @1.2.15_3+x11 (active)

It also fails if I download and compile the code:

$hg clone http://hg.libsdl.org/SDL
hg update SDL-1.2
./autogen.sh # README.MacOSX does not include this step
./configure
make
sudo make install

Currently I am using Mac OS X 10.13 and also the window does not appear.
Comment 8 Ozkan Sezer 2019-09-06 15:47:02 UTC
(In reply to Fernando Lopez from comment #7)
> It also fails if I download and compile the code:
> 
> $hg clone http://hg.libsdl.org/SDL
> hg update SDL-1.2
> ./autogen.sh # README.MacOSX does not include this step

You don't need this step with current hg anymore

> ./configure
> make
> sudo make install
> 
> Currently I am using Mac OS X 10.13 and also the window does not appear.

Do the above as you describe, but then replace libSDL-1.2.0.dylib
from this:  http://uhexen2.sourceforge.net/tmp/sdl12_dylib.tar.gz
Does it work properly?  (I cross-built this on linux from current
hg repo against older SDKs.)  If it does work (which I _guess_ it
would), then this is possibly related to bug #4788.
Comment 9 Fernando Lopez 2019-09-09 16:01:21 UTC
Hello Ozcan,

The program link again this library, but the window is still not appearing.

BTW, I am obtaining this warnings when I execute the program with your .dylib file:

2019-09-09 17:57:29.572052+0200 lab1[21219:5612241] SLPSGetCurrentProcess(): This call is deprecated and should not be called anymore.
2019-09-09 17:57:29.572083+0200 lab1[21219:5612241] set_foreground_operation_state(): This call is deprecated and should not be called anymore.
2019-09-09 17:57:29.656991+0200 lab1[21219:5612241] WARNING: The Gestalt selector gestaltSystemVersion is returning 10.9.6 instead of 10.13.6. This is not a bug in Gestalt -- it is a documented limitation. Use NSProcessInfo's operatingSystemVersion property to get correct system version number.
Call location:
2019-09-09 17:57:29.657081+0200 lab1[21219:5612241] 0   CarbonCore                          0x00007fff53bd5378 ___Gestalt_SystemVersion_block_invoke + 112
2019-09-09 17:57:29.657093+0200 lab1[21219:5612241] 1   libdispatch.dylib                   0x000000010038cd8f _dispatch_client_callout + 8
2019-09-09 17:57:29.657101+0200 lab1[21219:5612241] 2   libdispatch.dylib                   0x000000010038cd6f dispatch_once_f + 288
2019-09-09 17:57:29.657110+0200 lab1[21219:5612241] 3   CarbonCore                          0x00007fff53b65c40 _Gestalt_SystemVersion + 948
2019-09-09 17:57:29.657118+0200 lab1[21219:5612241] 4   CarbonCore                          0x00007fff53b65486 Gestalt + 139

Any additional idea?

2019-09-09 17:57:29.657126+0200 lab1[21219:5612241] 5   libSDL-1.2.0.dylib                  0x000000010033aedb QZ_VideoInit + 43
2019-09-09 17:57:29.657134+0200 lab1[21219:5612241] 6   libSDL-1.2.0.dylib                  0x000000010033306b SDL_VideoInit + 555
Comment 10 Ozkan Sezer 2019-09-09 21:10:20 UTC
(In reply to Fernando Lopez from comment #9)
> Hello Ozcan,
> 
> The program link again this library, but the window is still not appearing.

Huh..  No ideas for now (The problem is I don't have a new macOS
setup to try on.)

> 
> BTW, I am obtaining this warnings when I execute the program with your
> .dylib file:
> 
> 2019-09-09 17:57:29.572052+0200 lab1[21219:5612241] SLPSGetCurrentProcess():
> This call is deprecated and should not be called anymore.
> 2019-09-09 17:57:29.572083+0200 lab1[21219:5612241]
> set_foreground_operation_state(): This call is deprecated and should not be
> called anymore.

These should be bug 4114: I am guessing that your program is using
the old version of SDLmain.m from 1.2.15 -- try using the SDLmain.m
from hg / SDL-1.2 branch.

> 2019-09-09 17:57:29.656991+0200 lab1[21219:5612241] WARNING: The Gestalt
> selector gestaltSystemVersion is returning 10.9.6 instead of 10.13.6. This
> is not a bug in Gestalt -- it is a documented limitation. Use
> NSProcessInfo's operatingSystemVersion property to get correct system
> version number.

This comes from SDL-1.2's Quartz code - should be harmless.
Comment 11 Ozkan Sezer 2019-09-11 10:57:30 UTC
Also see: bug #4788 where a test-only patch was posted