[fpc-pascal] problem with the opengl unit

YuGiOhJCJ Mailing-List yugiohjcj-mailinglist at laposte.net
Sat May 3 15:45:38 CEST 2014


Hello,

I have built from source code the fpc-2.6.4 compiler on Linux.
I am not sure that I have correctly build it because:

1) It works well with my hello_world.pas code:
program Hello;
begin
  writeln ('Hello, world.')
end.
$ fpc hello_world.pas 
Free Pascal Compiler version 2.6.4 [2014/05/03] for i386
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling hello_world.pas
Linking hello_world
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
4 lines compiled, 0.3 sec
$ ./hello_world 
Hello, world.

2) It does not work with my glut.pas code:
procedure glutInitPascal(ParseCmdLine: Boolean); 
var
  Cmd: array of PChar;
  CmdCount, I: Integer;
begin
  if ParseCmdLine then
    CmdCount := ParamCount + 1
  else
    CmdCount := 1;
  SetLength(Cmd, CmdCount);
  for I := 0 to CmdCount - 1 do
    Cmd[I] := PChar(ParamStr(I));
  glutInit(@CmdCount, @Cmd);
end;
$ fpc glut.pas 
Free Pascal Compiler version 2.6.4 [2014/05/03] for i386
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling glut.pas
glut.pas(12,15) Error: Illegal type conversion: "ShortString" to "PChar"
glut.pas(13,11) Error: Identifier not found "glutInit"
glut.pas(15) Fatal: Syntax error, "BEGIN" expected but "end of file" found
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)

3) It does not work when I am compiling hedgewars-src-0.9.20:
$ cmake . -DNOSERVER=1
$ make
[...]
[  6%] Building Pascal object hedgewars/CMakeFiles/hwengine.dir/hwengine.o
options.inc(25,3) Fatal: Can't find unit GL used by uConsts
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
make[2]: *** [hedgewars/CMakeFiles/hwengine.dir/hwengine.o] Error 1
make[1]: *** [hedgewars/CMakeFiles/hwengine.dir/all] Error 2
make: *** [all] Error 2

It seems that my opengl unit is not found.
However, it seems to be installed because, as you can see, the files are here:
usr/lib/fpc/2.6.4/units/i386-linux/opengl/
usr/lib/fpc/2.6.4/units/i386-linux/opengl/freeglut.ppu
usr/lib/fpc/2.6.4/units/i386-linux/opengl/glext.o
usr/lib/fpc/2.6.4/units/i386-linux/opengl/glu.ppu
usr/lib/fpc/2.6.4/units/i386-linux/opengl/Package.fpc
usr/lib/fpc/2.6.4/units/i386-linux/opengl/glx.o
usr/lib/fpc/2.6.4/units/i386-linux/opengl/glx.ppu
usr/lib/fpc/2.6.4/units/i386-linux/opengl/glu.o
usr/lib/fpc/2.6.4/units/i386-linux/opengl/freeglut.o
usr/lib/fpc/2.6.4/units/i386-linux/opengl/glext.ppu
usr/lib/fpc/2.6.4/units/i386-linux/opengl/glut.o
usr/lib/fpc/2.6.4/units/i386-linux/opengl/glut.ppu
usr/lib/fpc/2.6.4/units/i386-linux/opengl/libpfreeglut.a
usr/lib/fpc/2.6.4/units/i386-linux/opengl/gl.ppu
usr/lib/fpc/2.6.4/units/i386-linux/opengl/libpgl.a
usr/lib/fpc/2.6.4/units/i386-linux/opengl/libpglext.a
usr/lib/fpc/2.6.4/units/i386-linux/opengl/libpglu.a
usr/lib/fpc/2.6.4/units/i386-linux/opengl/libpglx.a
usr/lib/fpc/2.6.4/units/i386-linux/opengl/gl.o
usr/lib/fpc/2.6.4/units/i386-linux/opengl/libpglut.a

Do you know why I am unable to compile 2) and 3)?

Thank you.
Best regards.



More information about the fpc-pascal mailing list