Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-05

fpc stderr broken?

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mattias Gaertner

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

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 15 lines
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?

fpcres, I think, because the compiler does not use stderr, to my knowledge...

Michael.

Reply by email

Mattias Gaertner
to Michael Van Canneyt
Show quoted text 21 lines
On Mon, 26 May 2014, Mattias Gaertner wrote: > 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? fpcres, I think, because the compiler does not use stderr, to my knowledge...

Confirmed.
Calling fpcres gives the problem.

Mattias

Reply by email