SDL 1.2.14 fails to compile on OS X

Error message:

…/…/src/SDL_error.c -fno-common -DPIC -o build/.libs/SDL_error.o
…/…/src/SDL_error.c: In function ‘SDL_SetError’:
…/…/src/SDL_error.c:79: error: parse error before ‘int’
…/…/src/SDL_error.c:83: error: parse error before ‘double’
…/…/src/SDL_error.c:87: error: parse error before ‘void’
…/…/src/SDL_error.c:92: error: parse error before 'const’
make: *** [build/SDL_error.lo] Error 1

Command line: ./build-scripts/fatbuild.sh
OS: Mac OS X 10.4.11
Processor: 1.25 GHz PowerPC G4
XCode version: 2.5
gcc version: powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (build 5370)–
Rainer Deyke - rainerd at eldwood.com

Rainer Deyke wrote:

Error message:

…/…/src/SDL_error.c -fno-common -DPIC -o build/.libs/SDL_error.o
…/…/src/SDL_error.c: In function ‘SDL_SetError’:
…/…/src/SDL_error.c:79: error: parse error before ‘int’
…/…/src/SDL_error.c:83: error: parse error before ‘double’
…/…/src/SDL_error.c:87: error: parse error before ‘void’
…/…/src/SDL_error.c:92: error: parse error before 'const’
make: *** [build/SDL_error.lo] Error 1

Command line: ./build-scripts/fatbuild.sh
OS: Mac OS X 10.4.11
Processor: 1.25 GHz PowerPC G4
XCode version: 2.5
gcc version: powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (build 5370)

Compile step:

libtool: compile: gcc-4.0 -arch i386 -O3 -g -pipe
-mmacosx-version-min=10.4 -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 -nostdinc
-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks
-I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include
-isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include -Iinclude
-I…/…/include -D_GNU_SOURCE=1 -DTARGET_API_MAC_CARBON
-DTARGET_API_MAC_OSX -fvisibility=hidden -I/usr/X11R6/include -DXTHREADS
-D_THREAD_SAFE -force_cpusubtype_ALL -fpascal-strings -c

It seems that gcc is choking on ‘va_arg’.

Looking at ‘build/x86/include/SDL_config.h’, I can see that:

  • ‘HAVE_LIBC’ is defined.
  • ‘STDC_HEADERS’ is not defined.
  • ‘HAVE_STDARG_H’ is not defined.
    By way of comparison, in ‘build/x86/include/SDL_config.h’,
    ‘HAVE_STDARG_H’ is defined. ‘include/SDL_config_macosx.h’ does not
    define ‘HAVE_STDARG_H’, but does define ‘STDC_HEADERS’, which has the
    same effect in ‘include/SDL_stdinc.h’ of including <stdarg.h>.

What this all comes down to is that <stdarg.h>, required for
’SDL_error.c’, isn’t being included for the x86 build. I checked
’/Developer/SDKs/MacOSX10.4u.sdk/usr/include’ and the file definitely
exists.

The error seems to come from either ‘fatbuild.sh’ or ‘configure’ One
thing I’ve noticed is that ‘fatbuild.sh’ doesn’t seem to have been
updated for 64 bit support, which indicates that it may be outdated.

Has anybody gotten ‘fatbuild.sh’ to work?–
Rainer Deyke - rainerd at eldwood.com

fatbuild.sh doesn’t work with SDL 1.2 and isn’t officially supported.
You might have better luck with the version in SDL 1.3, which has been
updated for the newer SDKs.

See ya!On Wed, Oct 21, 2009 at 9:52 PM, Rainer Deyke wrote:

Rainer Deyke wrote:

Error message:

…/…/src/SDL_error.c ?-fno-common -DPIC -o build/.libs/SDL_error.o
…/…/src/SDL_error.c: In function ‘SDL_SetError’:
…/…/src/SDL_error.c:79: error: parse error before ‘int’
…/…/src/SDL_error.c:83: error: parse error before ‘double’
…/…/src/SDL_error.c:87: error: parse error before ‘void’
…/…/src/SDL_error.c:92: error: parse error before 'const’
make: *** [build/SDL_error.lo] Error 1

Command line: ./build-scripts/fatbuild.sh
OS: Mac OS X 10.4.11
Processor: 1.25 GHz PowerPC G4
XCode version: 2.5
gcc version: powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (build 5370)

Compile step:

libtool: compile: ?gcc-4.0 -arch i386 -O3 -g -pipe
-mmacosx-version-min=10.4 -DMAC_OS_X_VERSION_MIN_REQUIRED=1040 -nostdinc
-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks
-I/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include
-isystem /Developer/SDKs/MacOSX10.4u.sdk/usr/include -Iinclude
-I…/…/include -D_GNU_SOURCE=1 -DTARGET_API_MAC_CARBON
-DTARGET_API_MAC_OSX -fvisibility=hidden -I/usr/X11R6/include -DXTHREADS
-D_THREAD_SAFE -force_cpusubtype_ALL -fpascal-strings -c

It seems that gcc is choking on ‘va_arg’.

Looking at ‘build/x86/include/SDL_config.h’, I can see that:
?- ‘HAVE_LIBC’ is defined.
?- ‘STDC_HEADERS’ is not defined.
?- ‘HAVE_STDARG_H’ is not defined.
By way of comparison, in ‘build/x86/include/SDL_config.h’,
‘HAVE_STDARG_H’ is defined. ?‘include/SDL_config_macosx.h’ does not
define ‘HAVE_STDARG_H’, but does define ‘STDC_HEADERS’, which has the
same effect in ‘include/SDL_stdinc.h’ of including <stdarg.h>.

What this all comes down to is that <stdarg.h>, required for
’SDL_error.c’, isn’t being included for the x86 build. ?I checked
’/Developer/SDKs/MacOSX10.4u.sdk/usr/include’ and the file definitely
exists.

The error seems to come from either ‘fatbuild.sh’ or ‘configure’ ?One
thing I’ve noticed is that ‘fatbuild.sh’ doesn’t seem to have been
updated for 64 bit support, which indicates that it may be outdated.

Has anybody gotten ‘fatbuild.sh’ to work?


Rainer Deyke - rainerd at eldwood.com


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


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Sam Lantinga wrote:

fatbuild.sh doesn’t work with SDL 1.2 and isn’t officially supported.
You might have better luck with the version in SDL 1.3, which has been
updated for the newer SDKs.

I see… README.MacOSX still mentions ‘fatbuild.sh’. And
’test/gcc-fat.sh’, which doesn’t look any newer.

So what’s the recommended way to build universal binaries on OS X?
XCode? (If so, I’ll just get the pre-built development binaries
instead. I hate messing around with IDEs.)–
Rainer Deyke - rainerd at eldwood.com

Yes, XCode is the recommended way, but feel free to post a fix for
fat-build.sh if you get it working!On Wed, Oct 21, 2009 at 11:26 PM, Rainer Deyke wrote:

Sam Lantinga wrote:

fatbuild.sh doesn’t work with SDL 1.2 and isn’t officially supported.
You might have better luck with the version in SDL 1.3, which has been
updated for the newer SDKs.

I see… README.MacOSX still mentions ‘fatbuild.sh’. ?And
’test/gcc-fat.sh’, which doesn’t look any newer.

So what’s the recommended way to build universal binaries on OS X?
XCode? ?(If so, I’ll just get the pre-built development binaries
instead. ?I hate messing around with IDEs.)


Rainer Deyke - rainerd at eldwood.com


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


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Rainer Deyke wrote:

So what’s the recommended way to build universal binaries on OS X?
XCode? (If so, I’ll just get the pre-built development binaries
instead. I hate messing around with IDEs.)

Xcode has a handy commandline interface:

cd $project; xcodebuild -target Release

(Or type xcodebuild -h to see all options.)

Ooh, that’s a neat trick. Thanks!On Thu, Oct 22, 2009 at 12:14 AM, albert wrote:

Rainer Deyke wrote:

So what’s the recommended way to build universal binaries on OS X?
XCode? (If so, I’ll just get the pre-built development binaries
instead. I hate messing around with IDEs.)

Xcode has a handy commandline interface:

cd $project; xcodebuild -target Release

(Or type xcodebuild -h to see all options.)


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


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

albert wrote:

Xcode has a handy commandline interface:

cd $project; xcodebuild -target Release

(Or type xcodebuild -h to see all options.)

I see… Tried it, and (as expected) SDL fails to compile. Now it’s
complaining that it doesn’t find the 64 bit SDK or gcc 4.2. Which makes
sense, because I have neither of those installed, nor /can/ I install
them on my G4 Mac mini.

So let me rephrase my question: what’s the recommended way to build (32
bit) universal binaries on a G4 Mac mini running OS X 10.4.11 and XCode 2.5?–
Rainer Deyke - rainerd at eldwood.com

cd $project; xcodebuild -target Release

The above switch is wrong. Typically Release refers to a
configuration, not a target, and we don’t have a configuration named
"Release". (Historical trivia: Apple used to use the name Deployment
instead of Release which gives some hints as to how old our project
is.)

I see… Tried it, and (as expected) SDL fails to compile. Now it’s
complaining that it doesn’t find the 64 bit SDK or gcc 4.2. Which makes
sense, because I have neither of those installed, nor /can/ I install
them on my G4 Mac mini.

So let me rephrase my question: what’s the recommended way to build (32
bit) universal binaries on a G4 Mac mini running OS X 10.4.11 and XCode 2.5?

If you don’t want to open the Xcode GUI, I left a backdoor build
configuration open called *_native_only. It only picks the native arch
and current OS SDK.

xcodebuild -target Framework -configuration Deployment_native_only

But I think it only builds the native arch, not Universal (since this
was the fallback/last resort case).

If you are willing to open the IDE, you can change the architecture
settings. (You might be able to override this with one of the
xcodebuild switches too, but I don’t know the advanced options well
enough to know for sure.)

If you just want a working universal binary, just download the
official distribution. It’s all ready to go and drag-and-drop.

-Eric