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 2623

Summary: Build error for GL ES only system
Product: SDL_ttf Reporter: Maarten ter Huurne <maarten>
Component: miscAssignee: Gabriel Jacobo <gabomdq>
Status: ASSIGNED --- QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.12   
Hardware: All   
OS: Linux   

Description Maarten ter Huurne 2014-07-03 21:29:46 UTC
The current configure script will #include "SDL_opengl.h" and if that defines "GLuint" it concludes that it can link with OpenGL. This conclusion is incorrect for many embedded Linux systems that have GL ES but not the full OpenGL: the GLuint type exists there, but linking with "-lGL" won't work. As a result the build breaks.

One way to solve this would be to use the proper link flags for GL ES. However, that won't work on systems that only provide the GL ES 2.0 API, since functions like glMatrixMode() are used by glfont.c and are no longer available in GL ES 2.0 and later. So I wouldn't recommend this approach.

The solution I used is to #include "SDL_config.h" and then check whether it defines SDL_VIDEO_OPENGL:

 #include "SDL_config.h"

 #ifndef SDL_VIDEO_OPENGL
 #error SDL2 built without OpenGL support
 #endif

For completeness sake, here is the build log fragment containing the error:

libtool: link: /home/mth/gcw0/buildroot/output/host/usr/bin/mipsel-gcw0-linux-uclibc-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -pipe -O2 -I/home/mth/gcw0/buildroot/output/host/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/freetype2 -I/home/mth/gcw0/buildroot/output/host/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/SDL2 -D_REENTRANT -DHAVE_OPENGL -o glfont glfont.o  ./.libs/libSDL2_ttf.so -L/home/mth/gcw0/buildroot/output/host/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/lib -lGL -lm /home/mth/gcw0/buildroot/output/host/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/lib/libfreetype.so -lz -lbz2 /home/mth/gcw0/buildroot/output/host/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/lib/libpng14.so /home/mth/gcw0/buildroot/output/host/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/lib/libSDL2.so -lpthread -Wl,-rpath -Wl,/home/mth/gcw0/buildroot/output/build/sdl2_ttf-2.0.12/.libs -Wl,-rpath -Wl,/home/mth/gcw0/buildroot/output/host/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/lib -Wl,-rpath -Wl,/home/mth/gcw0/buildroot/output/host/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/lib
/home/mth/gcw0/buildroot/output/host/usr/lib/gcc/mipsel-gcw0-linux-uclibc/4.9.0/../../../../mipsel-gcw0-linux-uclibc/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make[1]: *** [glfont] Error 1
make[1]: Leaving directory `/home/mth/gcw0/buildroot/output/build/sdl2_ttf-2.0.12'
Comment 1 Gabriel Jacobo 2014-10-15 22:42:35 UTC
Your proposed fix works, but it solves the problem partially since you have to conditionally disable building glfont (right now it's going to be built no matter what). Sadly my system (Ubuntu 14.04) wants to update a bunch of files to auto* 1.14 thus making it hard for me to create a sane patch which leaves the configure script working also in older systems.
Comment 2 Gabriel Jacobo 2014-10-15 22:49:14 UTC
Sam or Ryan, is it safe to update those files (aclocal.m4, Makefile.am, Makefile.in) that autogen.sh is updating without me wanting it to ? :)