5

I have a small SDL 2.0 program (detailed below) that refuses to give me a window, complaining about not being able to initialize its OpenGL ES library.

Program:

#include "bcm_host.h"

#include <SDL.h>
#include <GLES2/gl2.h>
#include <stdlib.h>

int main() {
        bcm_host_init();

        SDL_Init(SDL_INIT_VIDEO);
        SDL_Window *window = SDL_CreateWindow("Test", 0, 0, 400, 300, 0);
        if (window == NULL) {
                fprintf(stderr, "%s\n", SDL_GetError());
                return 1;
        }

        return 0;
}

Output:

Could not initialize OpenGL / GLES library

What's going on? Shouldn't bcm_host_init() be all that I need to get a normal SDL 2.0 program to run on the Pi? What else do I need to do?

fouric
  • 1,809
  • 4
  • 18
  • 26

1 Answers1

3

I had the same problem and the culprit was mesa-common-dev. Try removing it using

% sudo apt-get remove mesa-common-dev

A new round of ./configure && make && sudo make install made my SDL2 program run.

kanflo
  • 41
  • 2