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 1438

Summary: SDL2 compile error on OS X -arch ppc
Product: SDL Reporter: Nikos Chantziaras <realnc>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: buckyballreaction
Version: HG 2.0   
Hardware: x86_64   
OS: Mac OS X 10.6   

Description Nikos Chantziaras 2012-03-03 03:56:53 UTC
Configuring SDL2 (current hg) on OS X 10.6.8 with:

--enable-audio --disable-video --disable-render --disable-joystick --disable-haptic --disable-cdrom --disable-diskaudio CFLAGS="-arch ppc -O2 -pipe -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk" CXXFLAGS="-arch ppc -O2 -pipe -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk" LDFLAGS="-arch ppc -mmacosx-version-min=10.5 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk"

produces a build that fails:

libtool: compile:  gcc -arch ppc -O2 -fomit-frame-pointer -pipe -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk -DUSING_GENERATED_CONFIG_H -Iinclude -I../SDL/include -maltivec -DTARGET_API_MAC_CARBON -DTARGET_API_MAC_OSX -fvisibility=hidden -D_THREAD_SAFE -falign-loops=16 -force_cpusubtype_ALL -fpascal-strings -Wall -MMD -MT build/SDL_blit_N.lo -c ../SDL/src/video/SDL_blit_N.c -o build/SDL_blit_N.o
../SDL/src/video/SDL_blit_N.c: In function 'ConvertAltivec32to32_noprefetch':
../SDL/src/video/SDL_blit_N.c:711: error: 'SDL_PixelFormat' has no member named 'alpha'
../SDL/src/video/SDL_blit_N.c:740: error: 'SDL_PixelFormat' has no member named 'alpha'
../SDL/src/video/SDL_blit_N.c: In function 'ConvertAltivec32to32_prefetch':
../SDL/src/video/SDL_blit_N.c:798: error: 'SDL_PixelFormat' has no member named 'alpha'
../SDL/src/video/SDL_blit_N.c:831: error: 'SDL_PixelFormat' has no member named 'alpha'
make: *** [build/SDL_blit_N.lo] Error 1
Comment 1 Nikos Chantziaras 2012-03-03 04:11:10 UTC
OK, too much unneeded complexity.  It even fails with a simple:

configure CFLAGS="-arch ppc" LDFLAGS="-arch ppc"
Comment 2 buckyballreaction 2012-03-19 10:21:04 UTC
Hi,

I came across this same error and wrote to the mailing with my findings:

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2012-March/084160.html

Short answer to the workaround:  set SDL_ALTIVEC_BLITTERS to 0 in the file
SDL_config_macosx.h

D
Comment 3 buckyballreaction 2012-03-19 10:23:15 UTC
I should explain the issue in more detail here in the bug:

From my e-mail:

---snip---
It looks like the 'alpha' member of the SDL_PixelFormat struct was
part of SDL 1.2 in the file SDL_video.h (my IDE jumped to the system
SDL header when I followed it by accident...)  It looks like that in
SDL 2.0, SDL_PixelFormat has moved to SDL_pixels.h and has removed the
'alpha' member.

However, there is left over code that uses the 'alpha' member in the
SDL_ALTIVEC_BLITTERS portion of SDL_blit_N.c and therefore fails to
compile when compiling for Mac OS X ppc (10.4/10.5)

As a workaround, you can set SDL_ALTIVEC_BLITTERS to 0 in the file
SDL_config_macosx.h; however, I do not know the effects of this (maybe
performance will suffer in some areas?)
---snap---
Comment 4 Sam Lantinga 2012-04-08 01:02:00 UTC
I think this is fixed with this change:
http://hg.libsdl.org/SDL/rev/9821f5c9b7bd

Can you confirm?
Comment 5 buckyballreaction 2012-04-08 07:11:37 UTC
Confirmed.  Compilation succeeds with SDL_ALTIVEC_BLITTERS set to 1 now.

Tested with cross-compile on Xcode 3.2.2 on Snow Leopard (10.6).
Comment 6 buckyballreaction 2013-05-22 18:06:18 UTC
I just did a fresh PPC build with no alterations against the latest commit (53df899db00b).  SDL2 Builds with no problems.  SDL_ALTIVEC_BLITTERS was defined

Am I allowed to resolved this if I'm not the opener?