Public bug reported:

May also touch libsdl2-dev library.

Cannot get SDL2 to work.

Below is an example c file that calls the SDL2 library.

EXPECTED: a window with a red rectangle in it.

ACTUAL RESULTS: Instead, the background of the existing windows or
desktop shows through and no rectangle pops up.

BEGIN CODE

#include <SDL2/SDL.h>

int main()
{
  SDL_Window *window;
  SDL_Surface *surface;
  SDL_Rect rect = {0, 0, 200, 200};

  SDL_Init(SDL_INIT_EVERYTHING);

  window = SDL_CreateWindow("test", SDL_WINDOWPOS_UNDEFINED, 
SDL_WINDOWPOS_UNDEFINED, 800, 600, SDL_WINDOW_SHOWN);
  if (!window) {
    fprintf(stderr, "main: %s\n", SDL_GetError());
    return -1;
  }
    
  surface = SDL_GetWindowSurface(window);
  if (!surface) {
    fprintf(stderr, "main: %s\n", SDL_GetError());
    return -1;
  }
    
  SDL_FillRect(surface, &rect, 0xffff0000);
  SDL_UpdateWindowSurface(window);
  SDL_Delay(1000);
    
  SDL_DestroyWindow(window);
  SDL_Quit();
}
END CODE

How to build:  gcc example.c -lSDL2 -o example.out

The same issue happens on Debian Unstable. I also fired up a Fedora
instance and the above code compiled and worked as expected. Just not on
Debian Unstable or Ubuntu 17.04.

Here are all the various SDL packages installed at the moment:
sudo dpkg-query -l "*sdl*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                     Version                   
Architecture              Description
+++-========================================-=========================-=========================-======================================================================================
un  libsdl-1.3-0                             <none>                    <none>   
                 (no description available)
un  libsdl-1.3-dev                           <none>                    <none>   
                 (no description available)
ii  libsdl-ttf2.0-0:amd64                    2.0.11-3                  amd64    
                 TrueType Font library for Simple DirectMedia Layer 1.2, 
libraries
un  libsdl1.2                                <none>                    <none>   
                 (no description available)
un  libsdl1.2-all                            <none>                    <none>   
                 (no description available)
un  libsdl1.2-esd                            <none>                    <none>   
                 (no description available)
un  libsdl1.2-nas                            <none>                    <none>   
                 (no description available)
un  libsdl1.2-oss                            <none>                    <none>   
                 (no description available)
ii  libsdl1.2debian:amd64                    1.2.15+dfsg1-4            amd64    
                 Simple DirectMedia Layer
un  libsdl1.2debian-all                      <none>                    <none>   
                 (no description available)
un  libsdl1.2debian-alsa                     <none>                    <none>   
                 (no description available)
un  libsdl1.2debian-esd                      <none>                    <none>   
                 (no description available)
un  libsdl1.2debian-nas                      <none>                    <none>   
                 (no description available)
un  libsdl1.2debian-oss                      <none>                    <none>   
                 (no description available)
un  libsdl1.2debian-pulseaudio               <none>                    <none>   
                 (no description available)
ii  libsdl2-2.0-0:amd64                      2.0.5+dfsg1-2ubuntu3      amd64    
                 Simple DirectMedia Layer
ii  libsdl2-dev                              2.0.5+dfsg1-2ubuntu3      amd64    
                 Simple DirectMedia Layer development files
ii  libsdl2-image-2.0-0:amd64                2.0.1+dfsg-2build2        amd64    
                 Image loading library for Simple DirectMedia Layer 2, libraries
ii  libsdl2-image-dev:amd64                  2.0.1+dfsg-2build2        amd64    
                 Image loading library for Simple DirectMedia Layer 2, 
development files
ii  libsdl2-mixer-2.0-0:amd64                2.0.1+dfsg1-1             amd64    
                 Mixer library for Simple DirectMedia Layer 2, libraries
ii  libsdl2-mixer-dev:amd64                  2.0.1+dfsg1-1             amd64    
                 Mixer library for Simple DirectMedia Layer 2, development files
ii  libsdl2-ttf-2.0-0:amd64                  2.0.14+dfsg1-1            amd64    
                 TrueType Font library for Simple DirectMedia Layer 2, libraries
ii  libsdl2-ttf-dev:amd64                    2.0.14+dfsg1-1            amd64    
                 TrueType Font library for Simple DirectMedia Layer 2, 
development files

ProblemType: Bug
DistroRelease: Ubuntu 17.04
Package: libsdl2-2.0-0 2.0.5+dfsg1-2ubuntu3
ProcVersionSignature: Ubuntu 4.10.0-28.32-generic 4.10.17
Uname: Linux 4.10.0-28-generic x86_64
ApportVersion: 2.20.4-0ubuntu4.5
Architecture: amd64
CurrentDesktop: KDE
Date: Sun Jul 23 18:05:32 2017
InstallationDate: Installed on 2017-02-18 (154 days ago)
InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64 (20161012.2)
SourcePackage: libsdl2
UpgradeStatus: Upgraded to zesty on 2017-04-23 (90 days ago)

** Affects: libsdl2 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug zesty

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1705957

Title:
  Something is wrong with the SDL2 library and its headers

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libsdl2/+bug/1705957/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to