sasagawa888 / eisl

ISLisp interpreter/compiler
Other
272 stars 22 forks source link

fatal error: 'GL/glut.h' file not found #239

Closed yurivict closed 1 year ago

yurivict commented 1 year ago
===>   Generating temporary packing list
gmake[1]: Entering directory '/usr/ports/lang/eisl/work/eisl-2.70'
echo '(load "library/compiler.lsp") (compile-file "library/opengl.lsp")' | ./eisl -r
Easy-ISLisp Ver2.70
> T
> type inference
initialize
pass1
pass2
compiling GLUT:INIT 
compiling GLUT:INIT-DISPLAY-MODE 
compiling GLUT:INIT-WINDOW-SIZE 
compiling GLUT:INIT-WINDOW-POSITION 
compiling GLUT:CREATE-WINDOW 
compiling GL:CLEAR-COLOR 
compiling GLUT:DISPLAY-FUNC 
compiling GLUT:KEYBOARD-FUNC 
compiling GLUT:MOUSE-FUNC 
compiling GLUT:MAIN-LOOP 
compiling GL:CLEAR 
compiling GL:COLOR3D 
compiling GL:BEGIN 
compiling GL:VERTEX2D 
compiling GL:VERTEX3D 
compiling GL:VERTEX4D 
compiling GLUT:SOLID-CUBE 
compiling GLUT:SOLID-SPHERE 
compiling GLUT:SOLID-TORUS 
compiling GLUT:SOLID-ICOSAHEDRON 
compiling GLUT:SOLID-OCTAHEDRON 
compiling GLUT:SOLID-TETRAHEDRON 
compiling GLUT:SOLID-DODECAHEDRON 
compiling GLUT:SOLID-CONE 
compiling GLUT:SOLID-TEAPOT 
compiling GL:END 
compiling GL:FLUSH 
compiling GL:FINISH 
finalize
invoke CC
library/opengl0.c:2:10: fatal error: 'GL/glut.h' file not found
#include <GL/glut.h>
         ^~~~~~~~~~~
1 error generated.
T
> 

CFLAGS has proper flags: CFLAGS=-O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing. GL/glut.h is present:

$ ls /usr/local/include/GL/glut.h
/usr/local/include/GL/glut.h

But the build fails to find it.

sasagawa888 commented 1 year ago

Mr. Poldy please help us.

sasagawa888 commented 1 year ago

I modified opengl.lsp added -L option.

(c-include "<GL/glut.h>") (c-option "-lglut -lGLU -lGL -L/usr/local/include/")

Please try again.

poldy commented 1 year ago

Sorry it took ages until I had time to look at this. I'm able to reproduce the problem on macOS, but I don't know much about glut and on macOS it seems to depend on X-Windows, which I don't use. I did notice from the ticket description that there is a false assumption: the CFLAGS and LDFLAGS environment variables are used by make, but not by eisl when compiling. I have submitted an experimental PR #241 to implement this, but I'll leave it up to you whether you think it's a good idea or not, I'm not sure. Hopefully this will help.

sasagawa888 commented 1 year ago

Mt. poldy Thank you for your advice.

yurivict commented 1 year ago

This problem is still present in 2.72

lassik commented 1 year ago

Why -isystem /usr/local/include instead of the normal -I /usr/local/include?

yurivict commented 1 year ago

Why -isystem /usr/local/include instead of the normal -I /usr/local/include?

Compilers allow to use -isystem for system header locations.