[fpc-pascal] fpc stderr broken?

Mattias Gaertner nc-gaertnma at netcologne.de
Mon May 26 15:20:36 CEST 2014


Hi all,

When I compile a program with a duplicate $R
directive fpc (2.6.4) gives an error. Unlike other error messages this
error is written to stderr (under Linux and OS X).
Running fpc in a shell seems to always work. The output/stdout and
stderr are both written nicely together.
But when the stderr is redirected (e.g. fpc test.pas 2> errors.txt)
then errors.txt is empty and the stderr error message is lost. And
depending on the quantity of output/stdout some output bytes in front
of the error are missing too.
The same happens when running fpc via TProcess (with or without
poStdErrToOutput).

Is it a bug in fpc or in ppcx64 or in fpcres?

Here is an example:

debugressourcestderrbug.pas:
program debugressourcestderrbug;

{$mode objfpc}{$H+}

uses
  Classes, SysUtils;

{$R debugressourcestderrbug.lfm}
{$R debugressourcestderrbug.lfm}

begin
  writeln;
end.

debugressourcestderrbug.lfm:
object Form1: TForm1
  Left = 337
end
------------------------------------------
Running in terminal:
fpc debugressourcestderrbug.pas

...snip...
Compiling debugressourcestderrbug.pas
Compiling resource debugressourcestderrbug.or
Error: Duplicate resource: Type = 10, Name = TFORM1, Lang ID = 0000
debugressourcestderrbug.pas(23,1) Error: Error while compiling resources
...snap...

------------------------------------------
Running in terminal with stderr redirect:
fpc debugressourcestderrbug.pas 2> error.txt

...snip...
Compiling debugressourcestderrbug.pas
Compiling resource debugressourcestderrbug.or
debugressourcestderrbug.pas(23,1) Error: Error while compiling resources
...snap...

error.txt is empty.

Mattias



More information about the fpc-pascal mailing list