I don't have FreePascal installed at the moment, but from past experience, OpenGL crashes between compilers is usually caused by one compiler being more strict about the function declarations than another.

in glu.pas, gluUnProject is currently declared as...
[pascal]
gluUnProject: function(winx, winy, winz: GLdouble; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray; objx, objy, objz: PGLdouble): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}[/pascal]

which looks fine to me, when compared to the C code. But maybe a declaration of...

[pascal]
gluUnProject: function(winx, winy, winz: GLdouble; const modelMatrix, projMatrix: T16dArray; viewport: TViewPortArray; var objx : GLdouble; var objy : GLdouble; var objz : GLdouble ): Integer; {$IFDEF WIN32}stdcall;{$ELSE}cdecl;{$ENDIF}[/pascal]

would be more cross compiler compatible and possibly more correct.

I tested this change with Delphi 6 ( I need to make some small changes to your demo project ) and it does not crash. Why not give it a try with FPC and let us know.