Trouble compiling GLFW 2.7.7 on Mac OS X Leopard (10.5)

mrmormon wrote on Wednesday, April 03, 2013:

I’m trying to compile GLFW 2.7.7 (the latest as of April 1, 2013) on Mac OS X Leopard (10.5). I installed Xcode 3.1.4 and put the GLFW folder in /Developer. The GLFW readme says I just have to run make cocoa in Terminal from the root GLFW directory, but I get this huge mess of errors:

new-host:glfw-2.7.7 user$ make cocoa
cd lib/cocoa && make -f Makefile.cocoa
cc -O2 -g -c -I. -I… -Wall -fno-common -o enable.o …/enable.c
In file included from …/enable.c:31:
…/internal.h:58:20: error: stdlib.h: No such file or directory
…/internal.h:59:20: error: string.h: No such file or directory
…/internal.h:60:19: error: stdio.h: No such file or directory
In file included from …/internal.h:92,
from …/enable.c:31:
./platform.h:40:53: error: ApplicationServices/ApplicationServices.h: No such file or directory
./platform.h:44:21: error: pthread.h: No such file or directory
In file included from ./platform.h:46,
from …/internal.h:92,
from …/enable.c:31:
./…/…/include/GL/glfw.h:167:25: error: OpenGL/gl.h: No such file or directory
./…/…/include/GL/glfw.h:170:26: error: OpenGL/glu.h: No such file or directory
In file included from …/internal.h:92,
from …/enable.c:31:
./platform.h:51: error: syntax error before ‘’ token
./platform.h:51: warning: type defaults to ‘int’ in declaration of ‘PFNGLGETSTRINGIPROC’
./platform.h:51: warning: parameter names (without types) in function declaration
./platform.h:51: warning: data definition has no type or storage class
./platform.h:63: error: syntax error before ‘GLFWintptr’
./platform.h:63: warning: type defaults to ‘int’ in declaration of ‘GLFWintptr’
./platform.h:63: warning: data definition has no type or storage class
./platform.h:120: error: syntax error before ‘PFNGLGETSTRINGIPROC’
./platform.h:120: warning: no semicolon at end of struct or union
./platform.h:129: error: syntax error before ‘}’ token
./platform.h:162: error: syntax error before ‘CGEventSourceRef’
./platform.h:162: warning: no semicolon at end of struct or union
./platform.h:164: warning: type defaults to ‘int’ in declaration of ‘_glfwLibrary’
./platform.h:164: warning: data definition has no type or storage class
./platform.h:211: error: syntax error before ‘pthread_t’
./platform.h:211: warning: no semicolon at end of struct or union
./platform.h:218: error: syntax error before ‘pthread_mutex_t’
./platform.h:218: warning: no semicolon at end of struct or union
./platform.h:226: error: syntax error before ‘}’ token
./platform.h:226: warning: type defaults to ‘int’ in declaration of ‘_glfwThrd’
./platform.h:226: warning: data definition has no type or storage class
In file included from …/enable.c:31:
…/internal.h:134: error: syntax error before ‘GLFWintptr’
…/internal.h:134: warning: no semicolon at end of struct or union
…/internal.h:135: warning: type defaults to ‘int’ in declaration of ‘_GLFWfbconfig’
…/internal.h:135: warning: data definition has no type or storage class
…/internal.h:154: error: syntax error before ‘FILE’
…/internal.h:154: warning: no semicolon at end of struct or union
…/internal.h:158: error: syntax error before ‘}’ token
…/internal.h:158: warning: type defaults to ‘int’ in declaration of ‘_GLFWstream’
…/internal.h:158: warning: data definition has no type or storage class
…/internal.h:208: warning: type defaults to ‘int’ in declaration of ‘_GLFWfbconfig’
…/internal.h:208: error: syntax error before ‘
’ token
…/internal.h:246: warning: type defaults to ‘int’ in declaration of ‘GLubyte’
…/internal.h:246: error: syntax error before ‘’ token
…/internal.h:250: error: syntax error before ‘
’ token
…/internal.h:251: error: syntax error before ‘’ token
…/internal.h:252: error: syntax error before ‘
’ token
…/internal.h:253: error: syntax error before ‘’ token
…/internal.h:254: error: syntax error before ‘
’ token
…/internal.h:255: error: syntax error before ‘’ token
…/internal.h:258: error: syntax error before ‘
’ token
…/internal.h:261: error: syntax error before ‘’ token
…/internal.h:261: warning: type defaults to ‘int’ in declaration of ‘_GLFWfbconfig’
…/internal.h:261: error: syntax error before ‘
’ token
…/internal.h:263: warning: type defaults to ‘int’ in declaration of ‘_glfwChooseFBConfig’
…/internal.h:263: warning: data definition has no type or storage class
…/enable.c: In function ‘enableMouseCursor’:
…/enable.c:46: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:46: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:54: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:55: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:64: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:66: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:72: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:72: error: ‘GL_FALSE’ undeclared (first use in this function)
…/enable.c:72: error: (Each undeclared identifier is reported only once
…/enable.c:72: error: for each function it appears in.)
…/enable.c: In function ‘disableMouseCursor’:
…/enable.c:81: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:81: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:90: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:90: error: ‘GL_TRUE’ undeclared (first use in this function)
…/enable.c: In function ‘enableSystemKeys’:
…/enable.c:160: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:168: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:168: error: ‘GL_FALSE’ undeclared (first use in this function)
…/enable.c: In function ‘disableSystemKeys’:
…/enable.c:177: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:185: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c:185: error: ‘GL_TRUE’ undeclared (first use in this function)
…/enable.c: In function ‘enableAutoPollEvents’:
…/enable.c:214: error: invalid use of incomplete typedef ‘_GLFWwin’
…/enable.c: In function ‘disableAutoPollEvents’:
…/enable.c:223: error: invalid use of incomplete typedef ‘_GLFWwin’
make[1]: *** [enable.o] Error 1
make: *** [cocoa] Error 2

Any ideas what’s wrong? GCC 4.0.1 should be the default compiler, since I didn’t change any Xcode settings.