Allegro versus Snow Leopard
Thomas Harte

First try:

thomas-hartes-macbook-pro-15:allegro-4.2.2 thomasharte$ chmod +x ./fix.sh
thomas-hartes-macbook-pro-15:allegro-4.2.2 thomasharte$ ./fix.sh macosx-universal
Configuring Allegro for Mac OSX Universal Binary ...
Done!
thomas-hartes-macbook-pro-15:allegro-4.2.2 thomasharte$ make
Compiling Allegro for MacOS X, optimised. Please wait...
misc/gcc-uni.sh -DALLEGRO_SRC -DALLEGRO_LIB_BUILD  -Wall -Wno-unused -Wno-long-double  -O2 -funroll-loops -ffast-math -fomit-frame-pointer -fno-common -pipe -dynamic -DALLEGRO_NO_ASM -I. -I./include -o obj/macosx/alleg/allegro.o -c src/allegro.c
cc1: error: unrecognized command line option "-Wno-long-double"
make: *** [obj/macosx/alleg/allegro.o] Error 1

I assume this is also relevant:

thomas-hartes-macbook-pro-15:allegro-4.2.2 thomasharte$ gcc --version
i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

So Apple aren't exactly on the bleeding edge with that one...

kazzmir

I didn't see -Wno-long-double in any of the gcc manual's

gcc 4.4.1
gcc 4.3.4
gcc 4.2.4
gcc 4.1.2

Although on my own machine gcc seems to accept it

$ gcc -Wno-long-double x.c
jon@jon-laptop ~/tmp $ gcc --version
gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Is it an undocumented option or am I just looking in the wrong place?

<edit>
But on my gentoo machine its not a valid option

$ gcc -Wno-long-double x.c
cc1: error: unrecognized command line option "-Wno-long-double"
kazzmir@crystalis ~/tmp $ gcc --version
gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.0.2)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Thomas Harte

Further to this, removing -Wno-long-double from makefile.osx and trying again gives:

thomas-hartes-macbook-pro-15:allegro-4.2.2 thomasharte$ make
Compiling Allegro for MacOS X, optimised. Please wait...
misc/gcc-uni.sh -DALLEGRO_SRC -DALLEGRO_LIB_BUILD  -Wall -Wno-unused  -O2 -funroll-loops -ffast-math -fomit-frame-pointer -fno-common -pipe -dynamic -DALLEGRO_NO_ASM -I. -I./include -o obj/macosx/alleg/allegro.o -c src/allegro.c
In file included from ./include/allegro/base.h:26,
                 from ./include/allegro.h:25,
                 from src/allegro.c:23:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
src/allegro.c: In function ‘allegro_message’:
src/allegro.c:501: warning: implicit declaration of function ‘va_start’
src/allegro.c:503: warning: implicit declaration of function ‘va_end’
make: *** [obj/macosx/alleg/allegro.o] Error 1

Per Spotlight, I have versions of stdarg.h installed at:

  • /Developer/usr/lib/gcc/i686-apple-darwin10/4.0.1/include/stdarg.h

  • /Developer/usr/lib/gcc/powerpc-apple-darwin10/4.0.1/install-tools/include/stdarg.h

  • /Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/include/stdarg.h

  • /Developer/usr/llvm-gcc-4.2/lib/gcc/powerpc-apple-darwin10/4.2.1/install-tools/include/stdarg.h

  • /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/gcc/arm-apple-darwin9/4.2.1/install-tools/include/stdarg.h

  • /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/gcc/arm-apple-darwin9/4.0.1/install-tools/include/stdarg.h

  • /Developer/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/include/stdarg.h

  • /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/stdarg.h

  • /Developer/usr/lib/gcc/i686-apple-darwin10/4.2.1/install-tools/include/stdarg.h

  • /Developer/usr/lib/gcc/powerpc-apple-darwin10/4.0.1/include/stdarg.h

  • /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/stdarg.h

  • /Developer/usr/lib/gcc/powerpc-apple-darwin10/4.2.1/install-tools/include/stdarg.h

  • /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/gcc/arm-apple-darwin9/4.2.1/include/stdarg.h

  • /Developer/usr/llvm-gcc-4.2/lib/gcc/powerpc-apple-darwin10/4.2.1/include/stdarg.h

  • /Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/include/stdarg.h

  • /Developer/usr/lib/gcc/i686-apple-darwin10/4.0.1/install-tools/include/stdarg.h

  • /System/Library/Frameworks/Kernel.framework/Versions/A/Headers/stdarg.h

  • /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/gcc/arm-apple-darwin9/4.0.1/include/stdarg.h

  • /Developer/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin10/4.2.1/install-tools/include/stdarg.h

  • /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/stdarg.h

  • /Developer/usr/lib/clang/1.0/include/stdarg.h

EDIT: I can confirm that if you manually edit makefile.osx to remove the offending warning flag then an Intel-only build works correctly on my machine.

Peter Wang

It seems to be a gcc 3 option. I wonder why it was there in the first place. It's been in the makefile since the initial checkin, in 2003. I'll delete it in the 4.4 branch.

Evert

/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory

Sounds like a problem with the XCode installation to me...

Thomas Harte
Evert said:

Sounds like a problem with the XCode installation to me...

It's Xcode 3.2, newly installed from the Snow Leopard disc with the current iPhone OS 3.1 beta development kit installed in addition. This is actually a new way of doing things for Apple as previously you downloaded either the Mac alone or Mac+iPhone version and the latter included and replaced the former. Now you download Xcode then grab the additional iPhone stuff.

If there's an installation problem, I'd therefore suggest it's going to be exactly the same for everyone.

Anyway, having looked into it more thoroughly, stdarg.h is there (though Spotlight seems not to have found it), and contains:

/* This file is public domain.  */
/* GCC uses its own copy of this header */
#if defined(__GNUC__)
#include_next <stdarg.h>
#elif defined(__MWERKS__)
#include "mw_stdarg.h"
#else
#error "This header only supports __MWERKS__."
#endif

Apart from the #error message being grammatically poor and factually inaccurate, the main thing is that it is attempting to #include_next the real stdarg.h. The stdarg.h in 10.4u's kernel.framework is complete and correct.

I'd therefore guess that the solution for 10.6 users who want to build for 10.4 universal (the oldest still available SDK) need to somehow modify the makefile to add whatever is necessary to include Kernel.framework's include path as a search path for headers.

For the interim, a copy of a universal build of the Allegro framework with full headers and liballeg_main.a included is attached that I quite possibly made back on 10.4.

Bonus Xcode tip: the default value for the build setting "C/C++ Compiler Version" is GCC 4.2. GCC 4.2 is not compatible with the 10.4 SDK. So, to build for 10.4, you need to switch both the target SDK and the compiler down to GCC 4.0. And neither LLVM GCC 4.2 or Clang LLVM 4.0 can build for 10.4 either. Building for 10.5 or 10.6 allows you to use whichever of the four compiler chains you wish.

vbovio

Hey Thomas, so how you ended up with allegro on snow leopard ?, unversal binary ?, intel only ?, or did the previous compiled version worked ?

Regards.

Thomas Harte

Universal Binary, files carried over from either a 10.4 or 10.5 build that was so long ago that I've forgotten even roughly when. I've been lucky that 4.2 has been the current stable release for so very long — I'm not sure what I'll do about 4.4. And 4.9 is an entirely separate code base with an entirely separate build system, so isn't really relevant to these concerns.

Thread #601429. Printed from Allegro.cc