View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0024483FPCCompilerpublic2013-05-26 12:452013-09-28 09:19
ReporterReinier Olislagers 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Platformx64OSWindows OS VersionVista SP2
Product VersionProduct Build41377 
Target VersionFixed in Version 
Summary0024483: Resource compilation with Gorc.exe fails
DescriptionCurrent SVN Lazarus with current FPC 2.7.1 r24617

In a project with a .rc file and {$r *.rc} in a form, compilation fails; message:

Calling resource compiler "C:\development\fpctrunk\bin\x86_64-win64\gorc.exe" with "/machine x64 /nw /ni /r /d FPC /fo d:\Reinier\Documents\SourceCode\testdbwriter\sampledbwriter\lib\x86_64-win64\testdbwriter.res D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.rc" as command line

Verification: running the command (one line) manually fails:
D:\Reinier\Documents\SourceCode\testdbwriter>"C:\development\fpctrunk\bin\x86_64-win64\gorc.exe" "/machine x64 /nw /ni /r /d FPC /fo d:\Reinier\Documents\SourceCode\testdbwriter\sampledbwriter\lib\x86_64-win64\testdbwriter.res D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.rc"

GoRC.Exe Version 0.90.3c - Copyright Jeremy Gordon 1998/2008 - JG@JGnet.co.uk

Error!
Could not open source file (/machine x64 /nw /ni /r /d FPC /fo d:\Reinier\Docume
nts\SourceCode\testdbwriter\sampledbwriter\lib\x86_64-win64\testdbwriter.res D:\
Reinier\Documents\SourceCode\testdbwriter\testdbwriter.RC)
RES file not made
OBJ file not made


Manually specifying this (one line):
D:\Reinier\Documents\SourceCode\testdbwriter>"C:\development\fpctrunk\bin\x86_64-win64\gorc.exe" /machine x64 /nw /ni /r /d FPC "/fo d:\Reinier\Documents\SourceCode\testdbwriter\sampledbwriter\lib\x86_64-win64\testdbwriter.res" "D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.rc"
does work: testdbwriter.res is created.
TagsNo tags attached.
FPCOldBugId
Fixed in Revision
Attached Fileszip file icon gorctest.zip [^] (2,656 bytes) 2013-05-26 13:04

- Relationships

-  Notes
(0067875)
Reinier Olislagers (developer)
2013-05-26 13:06

Attached project demonstrates the problem.
(0069141)
Reinier Olislagers (developer)
2013-07-29 10:34

Bump. Any more info needed?
(0069260)
ChrisF (reporter)
2013-08-05 14:51
edited on: 2013-08-05 14:55

Just my 2 cents...

As far as I can see, in the 2.7.1 version double quote characters have been added for the arguments of the resource compiler call. And GoRC definitively doesn't like them: there should be no double quote at all in the parameters for it (or eventually just for the file names ?).

Extract from comprsrc.pas (trunk version):
...
   if RequotedExecuteProcess(resbin,s) <> 0 then
...

In former versions (e.g. current version 2.6.2), this was just:
...
   if ExecuteProcess(resbin,s) <> 0 then
...

And it seems that the concerned RequotedExecuteProcess function wrongly adds the double quote character to the parameters. I say "wrongly adds" because according to the code, it shouldn't (as it's supposed to concern only the Unix versions).

Extract from cfileutl.pas (trunk version):
...
   if (cs_link_on_target in current_settings.globalswitches) then
      quote_script:=target_info.script
   else
      quote_script:=source_info.script;
   if quote_script=script_unix then
      result:=sysutils.ExecuteProcess(Path,UnixRequoteWithDoubleQuotes(ComLine),Flags)
   else
      result:=sysutils.ExecuteProcess(Path,ComLine,Flags)
...

The problem is probably due to the fact that the "UnixRequoteWithDoubleQuotes(ComLine)" call is used here, instead of the "ComLine" only.

I guess there is something wrong concerning the .script option. As far as I remember, GoRC is only used for the windows 64 bits target, not for any Unix ones. Even when cross-compiling, because Windres is used in theses cases.

**EDIT** BTW, isn't this report supposed to concern rather FPC (not Lazarus), and the compiler -or eventually the utilities ?- (not the IDE) ?

(0069309)
Reinier Olislagers (developer)
2013-08-10 11:34
edited on: 2013-08-10 11:45

@ChrisF: thanks for the digging. I reported this as Lazarus because it occurs with Lazarus; didn't know what parameter manipulation took place in Laz (apparently none?).

As the behaviour I'm seeing (see bug report) shows *no* quoting, I don't think your hypothesis that the unix script type is used is correct.

GoRC *wants* quotes around the filename.

I'll dig into the FPC code to see what's going on and if I can fix it.
Will get back.

(0069311)
Reinier Olislagers (developer)
2013-08-10 13:03

Tried a hack: modifying t_win.pas, adding ' or " around the filename arguments ends up in doublequoted or misquoted parameters, so that does not seem a worthwile solution.

FPC devs: please reassign to FPC and have a look. Thanks.
(0069320)
ChrisF (reporter)
2013-08-10 20:44
edited on: 2013-08-10 20:47

Oups !

I may have made a confusion between your error messages (i.e. during your manual tests), and error messages inside FPC.

So, could you please post all the error messages during your compilation, please ?

Messages windows in Lazarus IDE -> Copy all shown and hidden messages to clipboard : just those after the line "Compiling resource..."


For me, it's working both with FPC 2.6.2 and FPC 2.7.1. (I've just made some tests with it). Your resource file is processed by GoRC, but of course an error occurs because the "gorcerrorunit.sql" file is missing. Is it the reason of your error ?

(0069326)
Reinier Olislagers (developer)
2013-08-11 11:25
edited on: 2013-08-11 11:31

No, the error is not the missing .sql file. The error I posted is the only error.

It may be the long path/filenames and also happens if I put the project in say d:\cop\t\gorc test with spaces\

(0069327)
ChrisF (reporter)
2013-08-11 12:00
edited on: 2013-08-11 12:13

Are your sure there is no any other hidden error message in the message windows of Lazarus ?

Because in fact there is no error message at all in your post:
-"Calling resource compiler...": this is the message when GoRC is about to be called by FPC. So, there should be an error message after that, or a result message if OK; anything.

-"GoRC.Exe Version 0.90.3c - Copyright...": this is the error message for one of your manual test. It's not the error message of FPC (I've wrongly interpreted it as the error message of FPC in my first post).


And your sample program is correctly processed by FPC 2.6.2 and 2.7.1.

I mean the resource file is processed by GoRC, and GoRC returns an error because of the missing sql file. Here are all the messages (as as sample of what I mean) with FPC 2.7.1 (rev 25231):

Calling resource compiler "C:\Lazarus\fpc\2.7.1\bin\x86_64-win64\gorc.exe" with "/machine x64 /nw /ni /r /d FPC /fo C:\WORK\TESTS\gorctest\lib\x86_64-win64\gorcerrorunit.res C:\WORK\TESTS\gorctest\gorcerrorunit.rc" as command line
Error!
Line 1 of Resource Script (C:\WORK\TESTS\gorctest\gorcerrorunit.RC):-
Could not find file:-
gorcerrorunit.sql

RES file not made
gorcerrorunit.pas(28) Error: Error while compiling resources. Compile with -vd for more details. Check for duplicates.
Compiling resource C:\WORK\TESTS\gorctest\gorcerrorunit.rc
gorcerrorunit.pas(28) Error: Error while compiling resources. Compile with -vd for more details. Check for duplicates.
gorcerrorunit.pas(28) Fatal: There were 1 errors compiling module, stopping


So, do you have any more pieces of information concerning your error ? Because, currently, it seems impossible to reproduce it (i.e. not with only your test program, I mean).


BTW, GoRC doesn't really needs quotes for filenames: only when filenames include one or more space characters (and eventually any other "special" characters).

Correct sample calls:
goRC /machine x64 /nw /ni /r /d FPC /fo gorcerrorunit.res gorcerrorunit.rc
goRC /machine x64 /nw /ni /r /d FPC /fo "gorcerrorunit.res" "gorcerrorunit.rc"
goRC /machine x64 /nw /ni /r /d FPC /fo 'gorcerrorunit.res' 'gorcerrorunit.rc'
goRC /machine x64 /nw /ni /r /d FPC /fo "gorcerrorunit with spaces.res" "gorcerrorunit with spaces.rc"
goRC /machine x64 /nw /ni /r /d FPC /fo 'gorcerrorunit with spaces.res' 'gorcerrorunit with spaces.rc'

Incorrect sample calls:
goRC "/machine x64 /nw /ni /r /d FPC /fo gorcerrorunit.res gorcerrorunit.rc"
goRC '/machine x64 /nw /ni /r /d FPC /fo gorcerrorunit.res gorcerrorunit.rc'
goRC /machine x64 /nw /ni /r /d FPC /fo gorcerrorunit with spaces.res gorcerrorunit with spaces.rc


**EDIT**
I've just noted something in your case. Your output directory seems to be a subdirectory of your main project directory: is it OK ?
Source directory: ...SourceCode\testdbwriter\...
Output directory: ...SourceCode\testdbwriter\sampledbwriter\...

(0069329)
ChrisF (reporter)
2013-08-11 12:08
edited on: 2013-08-11 12:09

I forgot to say: I've intercepted the exact command line sent by FPC for GoRC, just to be sure about what is EXACTLY sent.

My directory is different of yours, myrc is called instead of GoRC, but this doesn't really change anything.

Here is the command (surrounded with '!' characters for a better reading purpose):
!"C:\Lazarus\fpc\2.7.1\bin\x86_64-win64\myrc.exe" /machine x64 /nw /ni /r /d FPC /fo C:\WORK\TESTS\gorctest\lib\x86_64-win64\gorcerrorunit.res C:\WORK\TESTS\gorctest\gorcerrorunit.rc!

And here is the same one with a long directory filename:
!"C:\Lazarus\fpc\2.7.1\bin\x86_64-win64\myrc.exe" /machine x64 /nw /ni /r /d FPC /fo C:\WORK\TESTS\TestsGoRcWithLongNameForFolder\lib\x86_64-win64\gorcerrorunit.res C:\WORK\TESTS\TestsGoRcWithLongNameForFolder\gorcerrorunit.rc!

Both of them are OK.

(0070127)
Reinier Olislagers (developer)
2013-09-17 09:11
edited on: 2013-09-17 09:26

Thanks for looking at this, Chris.

Tested again with test program as attached above.
- mkdir "D:\Cop\t\gorc with spaces"
- extracted test files into that directory
- added file gorcerrorunit.sql
Lazarus x64 trunk r42846, fpc x64 trunk r25504, Windows
Compiled ok => so yes, can't reproduce with this

(0070129)
Reinier Olislagers (developer)
2013-09-17 09:20

@ChrisF re your remarks:
In the original project where I encountered the errror:
"Are your sure there is no any other hidden error message in the message windows of Lazarus ?

Because in fact there is no error message at all in your post:
-"Calling resource compiler...": this is the message when GoRC is about to be called by FPC. So, there should be an error message after that, or a result message if OK; anything.

-"GoRC.Exe Version 0.90.3c - Copyright...": this is the error message for one of your manual test. It's not the error message of FPC (I've wrongly interpreted it as the error message of FPC in my first post)."

Actually, both the manual verification step and the original command issued in the compile run give the same error message.

"**EDIT**
I've just noted something in your case. Your output directory seems to be a subdirectory of your main project directory: is it OK ?"
Yes. The resource script D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.rc
points to a file testdbwriter_firebird.sql which also lives in the testdbwriter directory.

"BTW, GoRC doesn't really needs quotes for filenames: only when filenames include one or more space characters (and eventually any other "special" characters)."
In other words, GoRC needs to be called with double quotes just in case there are spaces etc in the file name.
(0070130)
Reinier Olislagers (developer)
2013-09-17 09:25

SUMMARY: THE ERROR WITH GORC PERSISTS WHEN COMPILING MY ORIGINAL PROJECT. IT DOES NOT OCCUR WITH THE ATTACHED TEST PROGRAM

Source code of the original application available via
https://bitbucket.org/reiniero/testdbwriter/src [^]
sampledbwriter\sampledbwriter.lpi

I have this in
D:\Reinier\Documents\SourceCode\testdbwriter\sampledbwriter

Problem does not occur with x86 compilation (i.e. windres); only with x64 (Laz r42846, fpc r25504) compilation.

Complete list of messages (all shown and hidden messages):
Hint: Start of reading config file C:\development\fpctrunk\bin\x86_64-win64\fpc.cfg
Compiling Debug Version
Hint: End of reading config file C:\development\fpctrunk\bin\x86_64-win64\fpc.cfg
Free Pascal Compiler version 2.7.1 [2013/09/17] for x86_64
Copyright (c) 1993-2013 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling sampledbwriter.lpr
Compiling D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.pas
D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.pas(361,3) Note: Local variable "dummypchar" is assigned but never used
D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.pas(211,27) Hint: Parameter "Sender" not used
D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.pas(256,26) Hint: Parameter "ATest" not used
D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.pas(258,24) Hint: Parameter "ATest" not used
D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.pas(262,23) Hint: Parameter "ATest" not used
D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.pas(266,28) Hint: Parameter "ATestSuite" not used
Compiling resource D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.rc
Error!
Line 1 of Resource Script (D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.RC):-
Could not find file:-
testdbwriter_firebird.sql

RES file not made
testdbwriter.pas(1431) Error: Error while compiling resources. Compile with -vd for more details. Check for duplicates.
Compiling resource D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.rc
D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.pas(1431) Error: Error while compiling resources. Compile with -vd for more details. Check for duplicates.
D:\Reinier\Documents\SourceCode\testdbwriter\testdbwriter.pas(1431) Fatal: There were 1 errors compiling module, stopping
(0070131)
Reinier Olislagers (developer)
2013-09-17 09:30

The error message seems to have changed between the original bug report (where gorc couldn't find the .rc file) to one where gorc can find the .rc file but cannot find a file mentioned in that rc file.
(Perhaps because of modifications in FPC trunk meanwhile)

Perhaps gorc's working directory is not set to the location of the script file but to the location of the project file?
(0070411)
ChrisF (reporter)
2013-09-27 22:45

(Sorry for answering a bit late).

According to a few tests I've just done:
-GoRC uses only the current directory to find eventual additional files when the resource file is compiled,
-while WindRes uses both the current directory AND the directory of the resource file.

That's why it's working with WindRes in your case. Because, and unless I'm wrong, your current directory is probably the directory of your project (i.e. ".\testdbwriter\sampledbwriter\"), while the directory for your resource file and the concerned SQL script files is different (i.e. ".\testdbwriter\").


Note 1 - It's possible to add an additional include path for WindRes with an extra parameter : -I --include-dir=<dir>

Note 2 - There is no such parameter for GoRc, but according to the documentation (http://godevtool.com/GorcFrame.htm [^]), it's possible to define an INCLUDE environment string before calling GoRC. However, it seems it concerns only the "#Include" resource command (and with a more recent version than the one coming with FPC, moreover).


So, a possible patch would be to change the current directory before calling GoRC (to the directory of the resource file), then restore it just after the call.
(0070418)
Reinier Olislagers (developer)
2013-09-28 09:19

@Chris: agreed!

- Issue History
Date Modified Username Field Change
2013-05-26 12:45 Reinier Olislagers New Issue
2013-05-26 12:47 Reinier Olislagers Description Updated View Revisions
2013-05-26 12:48 Reinier Olislagers Description Updated View Revisions
2013-05-26 13:04 Reinier Olislagers File Added: gorctest.zip
2013-05-26 13:06 Reinier Olislagers Note Added: 0067875
2013-07-29 10:34 Reinier Olislagers Note Added: 0069141
2013-08-05 14:51 ChrisF Note Added: 0069260
2013-08-05 14:52 ChrisF Note Edited: 0069260 View Revisions
2013-08-05 14:55 ChrisF Note Edited: 0069260 View Revisions
2013-08-10 11:34 Reinier Olislagers Note Added: 0069309
2013-08-10 11:45 Reinier Olislagers Note Edited: 0069309 View Revisions
2013-08-10 13:03 Reinier Olislagers Note Added: 0069311
2013-08-10 17:49 Maxim Ganetsky Category IDE => Compiler
2013-08-10 17:49 Maxim Ganetsky Project Lazarus => FPC
2013-08-10 19:46 ChrisF Note Added: 0069319
2013-08-10 20:20 ChrisF Note Deleted: 0069319
2013-08-10 20:44 ChrisF Note Added: 0069320
2013-08-10 20:45 ChrisF Note Edited: 0069320 View Revisions
2013-08-10 20:47 ChrisF Note Edited: 0069320 View Revisions
2013-08-11 11:25 Reinier Olislagers Note Added: 0069326
2013-08-11 11:26 Reinier Olislagers Note Edited: 0069326 View Revisions
2013-08-11 11:28 Reinier Olislagers Note Edited: 0069326 View Revisions
2013-08-11 11:31 Reinier Olislagers Note Edited: 0069326 View Revisions
2013-08-11 12:00 ChrisF Note Added: 0069327
2013-08-11 12:01 ChrisF Note Edited: 0069327 View Revisions
2013-08-11 12:08 ChrisF Note Added: 0069329
2013-08-11 12:09 ChrisF Note Edited: 0069329 View Revisions
2013-08-11 12:13 ChrisF Note Edited: 0069327 View Revisions
2013-09-17 09:11 Reinier Olislagers Note Added: 0070127
2013-09-17 09:12 Reinier Olislagers Note Added: 0070128
2013-09-17 09:20 Reinier Olislagers Note Added: 0070129
2013-09-17 09:25 Reinier Olislagers Note Added: 0070130
2013-09-17 09:26 Reinier Olislagers Note Edited: 0070127 View Revisions
2013-09-17 09:26 Reinier Olislagers Note Deleted: 0070128
2013-09-17 09:30 Reinier Olislagers Note Added: 0070131
2013-09-27 22:45 ChrisF Note Added: 0070411
2013-09-28 09:19 Reinier Olislagers Note Added: 0070418



MantisBT 1.2.12[^]
Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker