2012-02-05 12 views
5

Estoy haciendo some tutorials on OpenGL que usan FreeGLUT.¿Es posible compilar FreeGLUT en Mac OS X?

Apparently esta es la forma de construir y lo instala en el mac:

CPPFLAGS="-I/usr/X11R6/include" ./configure --prefix="${PWD}/../" 
make 
make install 

Desafortunadamente esto por sí solo me da un error cuando lo haga el comando make: Undefined symbols for architecture x86_64

Después de hacer un poco de trabajo He encontrado que una mejora en la primera línea es:

CPPFLAGS="-I/usr/X11R6/include -L/usr/X11R6/lib" LDFLAGS="-L/usr/X11R6/lib" ./configure --prefix="${PWD}/../" 

Lamentablemente cuando hago el make comando Todavía estoy un error:

gcc -DHAVE_CONFIG_H -I. -I../../.. -I/usr/X11R6/include -L/usr/X11R6/lib -I../../../include -g -O2 -Wall -pedantic -MT smooth_opengl3-smooth_opengl3.o -MD -MP -MF .deps/smooth_opengl3-smooth_opengl3.Tpo -c -o smooth_opengl3-smooth_opengl3.o `test -f 'smooth_opengl3.c' || echo './'`smooth_opengl3.c 
smooth_opengl3.c:101: error: redefinition of typedef ‘PFNGLGENBUFFERSPROC’ 
/usr/X11R6/include/GL/glext.h:5080: error: previous declaration of ‘PFNGLGENBUFFERSPROC’ was here 
smooth_opengl3.c:102: error: redefinition of typedef ‘PFNGLBINDBUFFERPROC’ 
/usr/X11R6/include/GL/glext.h:5078: error: previous declaration of ‘PFNGLBINDBUFFERPROC’ was here 
smooth_opengl3.c:103: error: redefinition of typedef ‘PFNGLBUFFERDATAPROC’ 
/usr/X11R6/include/GL/glext.h:5082: error: previous declaration of ‘PFNGLBUFFERDATAPROC’ was here 
smooth_opengl3.c:104: error: redefinition of typedef ‘PFNGLCREATESHADERPROC’ 
/usr/X11R6/include/GL/glext.h:5197: error: previous declaration of ‘PFNGLCREATESHADERPROC’ was here 
smooth_opengl3.c:105: error: redefinition of typedef ‘PFNGLSHADERSOURCEPROC’ 
/usr/X11R6/include/GL/glext.h:5222: error: previous declaration of ‘PFNGLSHADERSOURCEPROC’ was here 
smooth_opengl3.c:106: error: redefinition of typedef ‘PFNGLCOMPILESHADERPROC’ 
/usr/X11R6/include/GL/glext.h:5195: error: previous declaration of ‘PFNGLCOMPILESHADERPROC’ was here 
smooth_opengl3.c:107: error: redefinition of typedef ‘PFNGLCREATEPROGRAMPROC’ 
/usr/X11R6/include/GL/glext.h:5196: error: previous declaration of ‘PFNGLCREATEPROGRAMPROC’ was here 
smooth_opengl3.c:108: error: redefinition of typedef ‘PFNGLATTACHSHADERPROC’ 
/usr/X11R6/include/GL/glext.h:5193: error: previous declaration of ‘PFNGLATTACHSHADERPROC’ was here 
smooth_opengl3.c:109: error: redefinition of typedef ‘PFNGLLINKPROGRAMPROC’ 
/usr/X11R6/include/GL/glext.h:5221: error: previous declaration of ‘PFNGLLINKPROGRAMPROC’ was here 
smooth_opengl3.c:110: error: redefinition of typedef ‘PFNGLUSEPROGRAMPROC’ 
/usr/X11R6/include/GL/glext.h:5223: error: previous declaration of ‘PFNGLUSEPROGRAMPROC’ was here 
smooth_opengl3.c:111: error: redefinition of typedef ‘PFNGLGETSHADERIVPROC’ 
/usr/X11R6/include/GL/glext.h:5209: error: previous declaration of ‘PFNGLGETSHADERIVPROC’ was here 
smooth_opengl3.c:112: error: redefinition of typedef ‘PFNGLGETSHADERINFOLOGPROC’ 
/usr/X11R6/include/GL/glext.h:5210: error: previous declaration of ‘PFNGLGETSHADERINFOLOGPROC’ was here 
smooth_opengl3.c:113: error: redefinition of typedef ‘PFNGLGETPROGRAMIVPROC’ 
/usr/X11R6/include/GL/glext.h:5207: error: previous declaration of ‘PFNGLGETPROGRAMIVPROC’ was here 
smooth_opengl3.c:114: error: redefinition of typedef ‘PFNGLGETPROGRAMINFOLOGPROC’ 
/usr/X11R6/include/GL/glext.h:5208: error: previous declaration of ‘PFNGLGETPROGRAMINFOLOGPROC’ was here 
smooth_opengl3.c:115: error: redefinition of typedef ‘PFNGLGETATTRIBLOCATIONPROC’ 
/usr/X11R6/include/GL/glext.h:5206: error: previous declaration of ‘PFNGLGETATTRIBLOCATIONPROC’ was here 
smooth_opengl3.c:116: error: redefinition of typedef ‘PFNGLVERTEXATTRIBPOINTERPROC’ 
/usr/X11R6/include/GL/glext.h:5280: error: previous declaration of ‘PFNGLVERTEXATTRIBPOINTERPROC’ was here 
smooth_opengl3.c:117: error: redefinition of typedef ‘PFNGLENABLEVERTEXATTRIBARRAYPROC’ 
/usr/X11R6/include/GL/glext.h:5202: error: previous declaration of ‘PFNGLENABLEVERTEXATTRIBARRAYPROC’ was here 
smooth_opengl3.c:118: error: redefinition of typedef ‘PFNGLGETUNIFORMLOCATIONPROC’ 
/usr/X11R6/include/GL/glext.h:5212: error: previous declaration of ‘PFNGLGETUNIFORMLOCATIONPROC’ was here 
smooth_opengl3.c:119: error: redefinition of typedef ‘PFNGLUNIFORMMATRIX4FVPROC’ 
/usr/X11R6/include/GL/glext.h:5242: error: previous declaration of ‘PFNGLUNIFORMMATRIX4FVPROC’ was here 
make[4]: *** [smooth_opengl3-smooth_opengl3.o] Error 1 
make[3]: *** [all-recursive] Error 1 
make[2]: *** [all-recursive] Error 1 
make[1]: *** [all-recursive] Error 1 
make: *** [all] Error 2 

Ésta ha sido documented on the net before, pero la solución no es realmente tan útil en este caso. También intenté cambiarlo por el trabajo de GLUT.framwork que viene con OS X, pero los ejemplos están usando funciones específicas de FreeGLUT.

+0

Ok, tengo un poco más en esto. Usando 'CPPFLAGS =" - I/usr/X11R6/include -L/usr/X11R6/lib "./configure --prefix =" $ {PWD} /../ "' se deshace del error de 'Símbolos no definidos'. Pero ahora obtengo 'ld: biblioteca no encontrada para -lGL' \' collect2: ld devuelto 1 estado de salida' \ 'make [2]: *** [libglut.la] Error 1' \' make [1]: * ** [todo recursivo] Error 1'/'make: *** [all] Error 2' – bjz

+1

Quizás también deba consultar con LDFLAGS,' -L/usr/X11R6/lib' es necesario. – ZhangChn

+0

Ooh gracias. Ok, utilicé 'CPPFLAGS =" - I/usr/X11R6/include -L/usr/X11R6/lib "LDFLAGS =" - L/usr/X11R6/lib "./configure --prefix =" $ {PWD}/../ "' y me deshice del error anterior. Ahora recibo una gran cantidad de errores a lo largo de las líneas de 'smooth_opengl3.c: 101: error: redefinición de typedef 'PFNGLGENBUFFERSPROC'' \' /usr/X11R6/include/GL/glext.h:5080: error: declaración previa de 'PFNGLGENBUFFERSPROC' estaba aquí' – bjz

Respuesta

4

It was suggested en la lista de correo de Xquartz, que la demo de freeglut es incorrecta para declarar esos PFN * PROC dos veces.

Por lo tanto, simplemente comentando la definición doble de smooth_opengl3.c, el exceso libre pasaría la fase de compilación. Sin embargo, desde mi experiencia, no se ejecutará y dará algún error sobre el GLSL.

También se sugirió que GLUT framework should be used en Mac OS X.

+0

Desafortunadamente, el marco GLUT de OSX no es compatible con OpenGL 3.2. –

1

Está trabajando para mí con los siguientes parámetros para configurar:

./configure CFLAGS="-I/usr/X11/include/X11/extensions -L/usr/X11/lib" LIBS="-lXrandr -lXxf86vm -lXi" --with-x --x-includes=/usr/X11/include