Failed to build SDL_ttf

Hi,

I’m trying to build SDL_ttf (SVN r4453) on Mac OS X, I already have SDL
(SVN r4461) built and installed. However, building SDL_ttf produced the
following error:

$ make
gcc -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION=""
-DPACKAGE_STRING="" -DPACKAGE_BUGREPORT="" -DPACKAGE=“SDL_ttf”
-DVERSION=“2.0.9” -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_ALLOCA_H=1
-DHAVE_ALLOCA=1 -I. -g -O2 -I/usr/local/include/freetype2
-I/usr/local/include -I/usr/local/include/SDL -D_GNU_SOURCE=1
-D_THREAD_SAFE -DHAVE_OPENGL -MT glfont.o -MD -MP -MF .deps/glfont.Tpo
-c -o glfont.o glfont.c
glfont.c: In function ?SDL_GL_LoadTexture?:
glfont.c:140: error: ?struct SDL_PixelFormat? has no member named ?alpha?
make: *** [glfont.o] Error 1

It seems SDL_PixelFormat defined in SDL_pixels.h indeed do no have a
member called ‘alpha’. Is it updated? How can I fix the SDL_ttf build?

Thanks.

  • Jiang

Jjgod Jiang wrote:

Hi,

I’m trying to build SDL_ttf (SVN r4453) on Mac OS X, I already have SDL
(SVN r4461) built and installed. However, building SDL_ttf produced the
following error:

$ make
gcc -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION=""
-DPACKAGE_STRING="" -DPACKAGE_BUGREPORT="" -DPACKAGE=“SDL_ttf”
-DVERSION=“2.0.9” -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_ALLOCA_H=1
-DHAVE_ALLOCA=1 -I. -g -O2 -I/usr/local/include/freetype2
-I/usr/local/include -I/usr/local/include/SDL -D_GNU_SOURCE=1
-D_THREAD_SAFE -DHAVE_OPENGL -MT glfont.o -MD -MP -MF .deps/glfont.Tpo
-c -o glfont.o glfont.c
glfont.c: In function ?SDL_GL_LoadTexture?:
glfont.c:140: error: ?struct SDL_PixelFormat? has no member named ?alpha?
make: *** [glfont.o] Error 1

It seems SDL_PixelFormat defined in SDL_pixels.h indeed do no have a
member called ‘alpha’. Is it updated? How can I fix the SDL_ttf build?

Thanks.

  • Jiang

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I can confirm this, except on:
Linux nyx 2.6.27-gentoo-r8 #12 SMP Fri Feb 20 21:27:35 EST 2009 x86_64
Intel® Core™2 Duo CPU T7300 @ 2.00GHz GenuineIntel GNU/Linux
w/ gcc 4.1.2

The alpha (& colorkey) members appear to be moving in the source code. I
experimented a bit, and this change seems to be what is needed, maybe
with some error checking? I’m not an expert on SDL_ttf’s innards looking
at SDL_SetAlpha’s code seems to indicate this is the equivalent of
SDL_GetAlpha (never existed, but that’s what the old code seemed to do
manually…)

Index: glfont.c===================================================================
— glfont.c (revision 4462)
+++ glfont.c (working copy)
@@ -137,7 +137,7 @@

/* Save the alpha blending attributes */
saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK);
  • saved_alpha = surface->format->alpha;
  • SDL_GetSurfaceAlphaMod(surface, &saved_alpha);
    if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
    SDL_SetAlpha(surface, 0, 0);
    }

You know you’re using SVN HEAD, right?

-Roy Wellington
PS: I’m not an expert at any of this, just a fellow SDL user who’s up
too late and bored… On a side note, it seems some of the recent
changes will allow me to do spiffy things, like per-pixel AND
per-surface alpha, a feat I’ve always wanted to accomplish. (Read: .png
file fading in)

Hiyya, I don’t do mac but it looks like maybe there could be a wrong version dll? I could be way wrong :frowning:

---- Roy Wellington IV <cactus_hugged at yahoo.com> wrote:=============
Jjgod Jiang wrote:

Hi,

I’m trying to build SDL_ttf (SVN r4453) on Mac OS X, I already have SDL
(SVN r4461) built and installed. However, building SDL_ttf produced the
following error:

$ make
gcc -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION=""
-DPACKAGE_STRING="" -DPACKAGE_BUGREPORT="" -DPACKAGE=“SDL_ttf”
-DVERSION=“2.0.9” -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1
-DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1
-DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1
-DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DHAVE_ALLOCA_H=1
-DHAVE_ALLOCA=1 -I. -g -O2 -I/usr/local/include/freetype2
-I/usr/local/include -I/usr/local/include/SDL -D_GNU_SOURCE=1
-D_THREAD_SAFE -DHAVE_OPENGL -MT glfont.o -MD -MP -MF .deps/glfont.Tpo
-c -o glfont.o glfont.c
glfont.c: In function ?SDL_GL_LoadTexture?:
glfont.c:140: error: ?struct SDL_PixelFormat? has no member named ?alpha?
make: *** [glfont.o] Error 1

It seems SDL_PixelFormat defined in SDL_pixels.h indeed do no have a
member called ‘alpha’. Is it updated? How can I fix the SDL_ttf build?

Thanks.

  • Jiang

SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I can confirm this, except on:
Linux nyx 2.6.27-gentoo-r8 #12 SMP Fri Feb 20 21:27:35 EST 2009 x86_64
Intel® Core™2 Duo CPU T7300 @ 2.00GHz GenuineIntel GNU/Linux
w/ gcc 4.1.2

The alpha (& colorkey) members appear to be moving in the source code. I
experimented a bit, and this change seems to be what is needed, maybe
with some error checking? I’m not an expert on SDL_ttf’s innards looking
at SDL_SetAlpha’s code seems to indicate this is the equivalent of
SDL_GetAlpha (never existed, but that’s what the old code seemed to do
manually…)

Index: glfont.c

— glfont.c (revision 4462)
+++ glfont.c (working copy)
@@ -137,7 +137,7 @@

/* Save the alpha blending attributes */
saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK);
  • saved_alpha = surface->format->alpha;
  • SDL_GetSurfaceAlphaMod(surface, &saved_alpha);
    if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
    SDL_SetAlpha(surface, 0, 0);
    }

You know you’re using SVN HEAD, right?

-Roy Wellington
PS: I’m not an expert at any of this, just a fellow SDL user who’s up
too late and bored… On a side note, it seems some of the recent
changes will allow me to do spiffy things, like per-pixel AND
per-surface alpha, a feat I’ve always wanted to accomplish. (Read: .png
file fading in)


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I’m trying to build SDL_ttf (SVN r4453) on Mac OS X, I already have SDL
(SVN r4461) built and installed. However, building SDL_ttf produced the
following error:

The attached patch should fix the problem.

Thanks!
-Sam Lantinga, Founder and President, Galaxy Gameworks LLC
-------------- next part --------------
Index: glfont.c===================================================================
— glfont.c (revision 4462)
+++ glfont.c (working copy)
@@ -137,10 +137,15 @@

/* Save the alpha blending attributes */
saved_flags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK);

+#if SDL_VERSION_ATLEAST(1, 3, 0)

  • SDL_GetSurfaceAlphaMod(surface, &saved_alpha);

  • SDL_SetSurfaceAlphaMod(surface, 0xFF);
    +#else
    saved_alpha = surface->format->alpha;
    if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
    SDL_SetAlpha(surface, 0, 0);
    }
    +#endif

    /* Copy the surface into the GL texture image */
    area.x = 0;
    @@ -150,9 +155,13 @@
    SDL_BlitSurface(surface, &area, image, &area);

    /* Restore the alpha blending attributes */
    +#if SDL_VERSION_ATLEAST(1, 3, 0)

  • SDL_SetSurfaceAlphaMod(surface, saved_alpha);
    +#else
    if ( (saved_flags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
    SDL_SetAlpha(surface, saved_flags, saved_alpha);
    }
    +#endif

    /* Create an OpenGL texture for the image */
    glGenTextures(1, &texture);