mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 06:09:15 +02:00
IDE: added check for missing real compiler
git-svn-id: trunk@28962 -
This commit is contained in:
parent
02e6bda022
commit
1323dd35bc
@ -6966,6 +6966,7 @@ begin
|
||||
SrcRule:=Rules[i];
|
||||
Rule:=Add(SrcRule.Filename);
|
||||
Rule.Assign(SrcRule);
|
||||
//debugln(['TFPCSourceRules.Assign ',i,' ',Rule.Targets,' ',Rule.Filename]);
|
||||
end;
|
||||
IncreaseChangeStamp;
|
||||
end;
|
||||
@ -7573,11 +7574,11 @@ begin
|
||||
// fpc searches via PATH for the real compiler, resolves any symlink
|
||||
// and that is the RealCompiler
|
||||
// check if PATH
|
||||
AFilename:=FindRealCompilerInPath(TargetCPU,true);
|
||||
if RealCompilerInPath<>AFilename then begin
|
||||
debugln(['TFPCTargetConfigCache.NeedsUpdate real compiler in PATH changed from "',RealCompilerInPath,'" to "',AFilename,'"']);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
AFilename:=FindRealCompilerInPath(TargetCPU,true);
|
||||
if RealCompilerInPath<>AFilename then begin
|
||||
debugln(['TFPCTargetConfigCache.NeedsUpdate real compiler in PATH changed from "',RealCompilerInPath,'" to "',AFilename,'"']);
|
||||
exit;
|
||||
end;
|
||||
for i:=0 to ConfigFiles.Count-1 do begin
|
||||
Cfg:=ConfigFiles[i];
|
||||
@ -7661,8 +7662,10 @@ begin
|
||||
for i:=0 to UnitPaths.Count-1 do
|
||||
UnitPaths[i]:=ChompPathDelim(TrimFilename(UnitPaths[i]));
|
||||
// store the real compiler file and date
|
||||
if (RealCompiler<>'') and FileExistsCached(RealCompiler) then
|
||||
if (RealCompiler<>'') and FileExistsCached(RealCompiler) then begin
|
||||
RealCompilerDate:=FileAgeCached(RealCompiler);
|
||||
end else
|
||||
debugln(['TFPCTargetConfigCache.Update WARNING: compiler is broken: '+Compiler+' '+ExtraOptions]);
|
||||
// store the list of tried and read cfg files
|
||||
if CfgFiles<>nil then begin
|
||||
for i:=0 to CfgFiles.Count-1 do begin
|
||||
|
@ -584,6 +584,33 @@ var
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function PPUFilesAndCompilerMatch: boolean;
|
||||
// check if compiler is in another directory than the ppu files
|
||||
// for example: a 'make install' installs to /usr/local/lib/fpc
|
||||
// while the rpm/deb packages install to /usr/lib
|
||||
var
|
||||
Cfg: TFPCTargetConfigCache;
|
||||
Filename: String;
|
||||
begin
|
||||
Cfg:=UnitSetCache.GetConfigCache(false);
|
||||
if Cfg=nil then exit(true);
|
||||
if Cfg.RealCompiler='' then begin
|
||||
debugln(['PPUFilesAndCompilerMatch Compiler=',Cfg.Compiler,' RealComp=',Cfg.RealCompiler,' InPath=',Cfg.RealCompilerInPath]);
|
||||
IDEMessageDialog(lisCCOErrorCaption, Format(
|
||||
lisCompilerDoesNotSupportTarget, [Cfg.Compiler, Cfg.TargetOS, Cfg.
|
||||
TargetCPU]),
|
||||
mtError,[mbOk]);
|
||||
exit(false);
|
||||
end;
|
||||
Filename:=ReadAllLinks(Cfg.RealCompiler,false);
|
||||
if (Filename='') then begin
|
||||
IDEMessageDialog('Error','Compiler executable is missing: '+Cfg.RealCompiler,
|
||||
mtError,[mbOk]);
|
||||
exit(false);
|
||||
end;
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
begin
|
||||
if ClearCaches then begin
|
||||
{ $IFDEF VerboseFPCSrcScan}
|
||||
@ -690,12 +717,10 @@ begin
|
||||
CodeToolBoss.DefineTree.ClearCache;
|
||||
|
||||
if not Quiet then begin
|
||||
if not FoundSystemPPU then begin
|
||||
IDEMessageDialog(lisCCOErrorCaption,
|
||||
Format(lisTheProjectUsesTargetOSAndCPUTheSystemPpuForThisTar, [
|
||||
TargetOS, TargetCPU, #13, #13]),
|
||||
mtError,[mbOk]);
|
||||
end else if (UnitSetCache<>nil) then begin
|
||||
// check for common installation mistakes
|
||||
if not PPUFilesAndCompilerMatch then exit;
|
||||
if (UnitSetCache<>nil) then begin
|
||||
// check if at least one fpc config is there
|
||||
if UnitSetCache.GetFirstFPCCfg='' then begin
|
||||
IgnorePath:='MissingFPCCfg_'+TargetOS+'-'+TargetCPU;
|
||||
if (InputHistories<>nil) and (InputHistories.Ignores.Find(IgnorePath)=nil)
|
||||
@ -707,6 +732,12 @@ begin
|
||||
InputHistories.Ignores.Add(IgnorePath,iiidIDERestart);
|
||||
end;
|
||||
end;
|
||||
end else if not FoundSystemPPU then begin
|
||||
// system.ppu is missing
|
||||
IDEMessageDialog(lisCCOErrorCaption,
|
||||
Format(lisTheProjectUsesTargetOSAndCPUTheSystemPpuForThisTar, [
|
||||
TargetOS, TargetCPU, #13, #13]),
|
||||
mtError,[mbOk]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -41,9 +41,12 @@ type
|
||||
|
||||
TFPCSrcScan = class(TThread)
|
||||
protected
|
||||
fLogMsg: string;
|
||||
Files: TStringList;
|
||||
procedure Execute; override;
|
||||
procedure OnFilesGathered; // main thread, called after thread has collected Files
|
||||
procedure MainThreadLog;
|
||||
procedure Log(Msg: string);
|
||||
public
|
||||
Directory: string;
|
||||
Scans: TFPCSrcScans;
|
||||
@ -76,39 +79,59 @@ implementation
|
||||
procedure TFPCSrcScan.Execute;
|
||||
begin
|
||||
try
|
||||
Log('TFPCSrcScan.Execute AAA1');
|
||||
// scan fpc source directory, check for terminated
|
||||
Files:=GatherFilesInFPCSources(Directory,nil);
|
||||
//debugln(['TFPCSrcScan.Execute ',Files<>nil]);
|
||||
// let main thread update the codetools fpc source cache
|
||||
Synchronize(@OnFilesGathered);
|
||||
Log('TFPCSrcScan.Execute '+dbgs(Files<>nil));
|
||||
except
|
||||
on E: Exception do begin
|
||||
debugln(['TFPCSrcScan.Execute error: ',E.Message]);
|
||||
Log('TFPCSrcScan.Execute error: '+E.Message);
|
||||
end;
|
||||
end;
|
||||
if Files=nil then
|
||||
Files:=TStringList.Create;
|
||||
// let main thread update the codetools fpc source cache
|
||||
Synchronize(@OnFilesGathered);
|
||||
end;
|
||||
|
||||
procedure TFPCSrcScan.OnFilesGathered;
|
||||
var
|
||||
SrcCache: TFPCSourceCache;
|
||||
begin
|
||||
//debugln(['TFPCSrcScan.OnFilesGathered ',Directory,' FileCount=',Files.Count]);
|
||||
// copy Files to codetools cache
|
||||
if CodeToolBoss<>nil then
|
||||
begin
|
||||
SrcCache:=CodeToolBoss.FPCDefinesCache.SourceCaches.Find(Directory,true);
|
||||
SrcCache.Update(Files);
|
||||
try
|
||||
debugln(['TFPCSrcScan.OnFilesGathered ',Directory,' FileCount=',Files.Count]);
|
||||
// copy Files to codetools cache
|
||||
if CodeToolBoss<>nil then
|
||||
begin
|
||||
SrcCache:=CodeToolBoss.FPCDefinesCache.SourceCaches.Find(Directory,true);
|
||||
debugln(['TFPCSrcScan.OnFilesGathered SrcCache.Update ...']);
|
||||
SrcCache.Update(Files);
|
||||
|
||||
//debugln(['TFPCSrcScan.OnFilesGathered BuildBoss.RescanCompilerDefines ...']);
|
||||
if BuildBoss<>nil then
|
||||
BuildBoss.RescanCompilerDefines(false,false,false,true);
|
||||
debugln(['TFPCSrcScan.OnFilesGathered BuildBoss.RescanCompilerDefines ...']);
|
||||
if BuildBoss<>nil then
|
||||
BuildBoss.RescanCompilerDefines(false,false,false,true);
|
||||
end;
|
||||
FreeAndNil(Files);
|
||||
// delete item in progress window
|
||||
debugln(['TFPCSrcScan.OnFilesGathered closing progress item ...']);
|
||||
FreeAndNil(ProgressItem);
|
||||
Scans.Remove(Self);
|
||||
debugln(['TFPCSrcScan.OnFilesGathered END']);
|
||||
except
|
||||
on E: Exception do
|
||||
debugln(['TFPCSrcScan.OnFilesGathered ERROR: ',E.Message]);
|
||||
end;
|
||||
FreeAndNil(Files);
|
||||
// delete item in progress window
|
||||
//debugln(['TFPCSrcScan.OnFilesGathered closing progress item ...']);
|
||||
FreeAndNil(ProgressItem);
|
||||
Scans.Remove(Self);
|
||||
//debugln(['TFPCSrcScan.OnFilesGathered END']);
|
||||
end;
|
||||
|
||||
procedure TFPCSrcScan.MainThreadLog;
|
||||
begin
|
||||
debugln(fLogMsg);
|
||||
end;
|
||||
|
||||
procedure TFPCSrcScan.Log(Msg: string);
|
||||
begin
|
||||
fLogMsg:=Msg;
|
||||
Synchronize(@MainThreadLog);
|
||||
end;
|
||||
|
||||
{ TFPCSrcScans }
|
||||
|
@ -1926,6 +1926,8 @@ resourcestring
|
||||
dlgCCOTestMissingPPU = 'Test: Checking missing fpc ppu ...';
|
||||
dlgCCOTestCompilerDate = 'Test: Checking compiler date ...';
|
||||
lisCCOErrorCaption = 'Error';
|
||||
lisCompilerDoesNotSupportTarget = 'Compiler "%s" does not support target %'
|
||||
+'s-%s';
|
||||
lisInvalidMode = 'Invalid mode %s';
|
||||
lisTheProjectCompilerOptionsAndTheDirectivesInTheMain = 'The project '
|
||||
+'compiler options and the directives in the main source differ. For the '
|
||||
|
@ -259,6 +259,7 @@ begin
|
||||
FreeAndNil(Items[i].fPanel);
|
||||
FItems.Delete(i);
|
||||
end;
|
||||
debugln(['TIDEProgressWindow.Notification ',Count]);
|
||||
if Count=0 then
|
||||
Hide;
|
||||
finally
|
||||
|
Loading…
Reference in New Issue
Block a user