Sign in Join

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

Mailing lists / fpc-devel / 2007-09

resource compilation fails, if cpp is not on the path

10 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Vincent Snijders

Consider the following application:

program rescomp;
{$R lazarus.rc}
begin
end.

If I have an empty path variable and I call the compiler with an absolute path, it fails, see below. The solution would be to add the --preprocessor parameter to windres, as is done below. The cpp.exe should be located in the same directory as windres. How can this be done?

Vincent

D:\lazarus\bugs\rescomp>SET PATH=

D:\lazarus\bugs\rescomp>d:\fpc\2.3.1\bin\i386-win32\fpc rescomp.pas Free Pascal Compiler version 2.3.1 [2007/07/12] for i386 Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Win32 for i386
Compiling rescomp.pas
Compiling resource lazarus.rc
gcc: installation problem, cannot exec `cpp': No such file or directory d:\FPC\2.3.1\bin\i386-win32\windres.exe: no resources rescomp.pas(6,1) Error: Error while linking
rescomp.pas(6,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
Error: d:\fpc\2.3.1\bin\i386-win32\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled)

D:\lazarus\bugs\rescomp>d:\fpc\2.3.1\bin\i386-win32\windres lazarus.rc lazarus.r es
gcc: installation problem, cannot exec `cpp': No such file or directory d:\fpc\2.3.1\bin\i386-win32\windres: no resources

D:\lazarus\bugs\rescomp>d:\fpc\2.3.1\bin\i386-win32\windres --preprocessor=d:\fp c\2.3.1\bin\i386-win32\cpp.exe lazarus.rc lazarus.res

Reply by email

Yury Sidorov
to Vincent Snijders

From: "Vincent Snijders"

Show quoted text 45 lines
Consider the following application: program rescomp; {$R lazarus.rc} begin end. If I have an empty path variable and I call the compiler with an absolute path, it fails, see below. The solution would be to add the --preprocessor parameter to windres, as is done below. The cpp.exe should be located in the same directory as windres. How can this be done? Vincent D:\lazarus\bugs\rescomp>SET PATH= D:\lazarus\bugs\rescomp>d:\fpc\2.3.1\bin\i386-win32\fpc rescomp.pas Free Pascal Compiler version 2.3.1 [2007/07/12] for i386 Copyright (c) 1993-2007 by Florian Klaempfl Target OS: Win32 for i386 Compiling rescomp.pas Compiling resource lazarus.rc gcc: installation problem, cannot exec `cpp': No such file or directory d:\FPC\2.3.1\bin\i386-win32\windres.exe: no resources rescomp.pas(6,1) Error: Error while linking rescomp.pas(6,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted Error: d:\fpc\2.3.1\bin\i386-win32\ppc386.exe returned an error exitcode (normal if you did not specify a source file to be compiled) D:\lazarus\bugs\rescomp>d:\fpc\2.3.1\bin\i386-win32\windres lazarus.rc lazarus.r es gcc: installation problem, cannot exec `cpp': No such file or directory d:\fpc\2.3.1\bin\i386-win32\windres: no resources D:\lazarus\bugs\rescomp>d:\fpc\2.3.1\bin\i386-win32\windres --preprocessor=d:\fp c\2.3.1\bin\i386-win32\cpp.exe lazarus.rc lazarus.res

Yes. It is known issue. Compiler can search for "cpp" tool the same way as other tools like "as", "ld" and then pass --preprocessor switch to windres if "cpp" was found.

Yury.

Reply by email

Vincent Snijders
to Yury Sidorov
Yury Sidorov wrote 5 lines
Yes. It is known issue. Compiler can search for "cpp" tool the same way as other tools like "as", "ld" and then pass --preprocessor switch to windres if "cpp" was found.

I created the attached patch. What do you think?

Vincent

Reply by email

Yury Sidorov
to Vincent Snijders

From: "Vincent Snijders"

Show quoted text 10 lines
Yury Sidorov schreef: > > Yes. It is known issue. Compiler can search for "cpp" tool the same > way > as other tools like "as", "ld" and then pass --preprocessor switch > to > windres if "cpp" was found. > I created the attached patch. What do you think?

Use FindFile and FindExe functions to search for "cpp". The same way as windres binary is searched above:

  resfound:=false;
  if utilsdirectory'' then
    resfound:=FindFile(utilsprefix+bin+source_info.exeext,utilsdirectory,false,resbin);
  if not resfound then
    resfound:=FindExe(utilsprefix+bin,false,resbin);

Yury.

Reply by email

Vincent Snijders
to Yury Sidorov
Yury Sidorov wrote 23 lines
From: "Vincent Snijders" > Yury Sidorov schreef: >> >> Yes. It is known issue. Compiler can search for "cpp" tool the same way >> as other tools like "as", "ld" and then pass --preprocessor switch to >> windres if "cpp" was found. >> > > I created the attached patch. What do you think? Use FindFile and FindExe functions to search for "cpp". The same way as windres binary is searched above: resfound:=false; if utilsdirectory'' then resfound:=FindFile(utilsprefix+bin+source_info.exeext,utilsdirectory,false,resbin); if not resfound then resfound:=FindExe(utilsprefix+bin,false,resbin);

utilsprefix is not necessary, don't you think? Or do you have i386-win32-cpp on linux for cross compilation?

Vincent

Reply by email

Yury Sidorov
to Vincent Snijders

From: "Vincent Snijders"

Show quoted text 28 lines
Yury Sidorov schreef: > From: "Vincent Snijders" > > >> Yury Sidorov schreef: >>> >>> Yes. It is known issue. Compiler can search for "cpp" tool the >>> same way >>> as other tools like "as", "ld" and then pass --preprocessor >>> switch to >>> windres if "cpp" was found. >>> >> >> I created the attached patch. What do you think? > > Use FindFile and FindExe functions to search for "cpp". The same > way as windres binary is searched above: > > resfound:=false; > if utilsdirectory'' then > > resfound:=FindFile(utilsprefix+bin+source_info.exeext,utilsdirectory,false,resbin); > if not resfound then > resfound:=FindExe(utilsprefix+bin,false,resbin); > utilsprefix is not necessary, don't you think? Or do you have i386-win32-cpp on linux for cross compilation?

You are right. There is no need for prefix or path search in case of cpp.
Your patch is correct.

Yury.

Reply by email

Vincent Snijders
to Yury Sidorov
Yury Sidorov wrote 25 lines
From: "Vincent Snijders" > Yury Sidorov schreef: >> From: "Vincent Snijders" >> >> >>> I created the attached patch. What do you think? >> >> Use FindFile and FindExe functions to search for "cpp". The same way >> as windres binary is searched above: >> >> resfound:=false; >> if utilsdirectory'' then >> >> resfound:=FindFile(utilsprefix+bin+source_info.exeext,utilsdirectory,false,resbin); >> if not resfound then >> resfound:=FindExe(utilsprefix+bin,false,resbin); >> > > utilsprefix is not necessary, don't you think? Or do you have > i386-win32-cpp on linux for cross compilation? You are right. There is no need for prefix or path search in case of cpp. Your patch is correct.

Thanks for the review. I committed the patch in r8670.

Vincent

Reply by email

Vincent Snijders
to Yury Sidorov
Yury Sidorov wrote 10 lines
From: "Vincent Snijders" > Vincent Snijders schreef: >> >> Thanks for the review. I committed the patch in r8670. >> > > Can this be merged to the fixes branch for fpc 2.2.1? Fine for me.

Done in r8721.

Vincent

Reply by email