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 - Build error for GL ES only system
Summary: Build error for GL ES only system
Status: ASSIGNED
Alias: None
Product: SDL_ttf
Classification: Unclassified
Component: misc (show other bugs)
Version: 2.0.12
Hardware: All Linux
: P2 normal
Assignee: Gabriel Jacobo
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-03 21:29 UTC by Maarten ter Huurne
Modified: 2014-10-15 22:49 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ? :)