View Issue Details

IDProjectCategoryView StatusLast Update
0010551FPCCompilerpublic2018-05-12 21:47
ReporterIgor Funa Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Product Version2.2.0 
Summary0010551: FPC does not find unit in subfolder used by used unit
DescriptionUnzip attached file including folder structure.
You should have

Main.pas in TEST
Unit1 in TEST\UNIT1
Unit2 in TEST\UNIT2

Unit1 uses Unit2 and compiles fine (in its folder).
Unit2 uses Unit1 and compiles fine (in its folder).

Program Main (in its folder) does not compile and gives error:

Main.pas(6,18) Fatal: Can't find unit Unit2 used by Unit1

It normally finds both units since it has both paths for units defined,
but when it tries to recompile Unit1 it does not find Unit2.

TagsFU
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0009961 resolvedFlorian -B Doesn't Build All 
related to 0009664 closedPeter Vreman Incompatibility with Delphi in searching of units and wrong units compiled if .ppu files exists 
has duplicate 0014052 closedJonas Maebe Lazarus does not compile units stored in other directory. 
related to 0013461 closedJonas Maebe include of foo/bar.inc doesn't work if foo not in current directory 
related to 0018294 new $LINKLIB won't search library if -FU directory wasn't cleared 
related to 0030569 new changes to include file do not trigger recompilation of unit 

Activities

2008-01-04 18:44

 

TEST.zip (1,073 bytes)

Marco van de Voort

2008-07-24 21:01

manager   ~0020926

I reproduced it with -va, and indeed, when loading unit2 as a dependancy from unit1, the unitpaths are not used. Are they somehow local only for units loaded directly from main?

2010-01-30 00:48

 

fpc_bug_0010551.patch (975 bytes)   
Index: compiler/fppu.pas
===================================================================
--- compiler/fppu.pas	(revision 14828)
+++ compiler/fppu.pas	(working copy)
@@ -357,6 +357,7 @@
        var
          fnd : boolean;
          hs  : TCmdStr;
+         lf  : tmodule;
        begin
          if shortname then
           filename:=FixFileName(Copy(realmodulename^,1,8))
@@ -413,8 +414,12 @@
            fnd:=SourceSearchPath('.');
          if (not fnd) and Assigned(main_module) and (main_module.Path^<>'') then
            fnd:=SourceSearchPath(main_module.Path^);
-         if (not fnd) and Assigned(loaded_from) then
-           fnd:=SearchPathList(loaded_from.LocalUnitSearchPath);
+         lf:=loaded_from;
+         while (not fnd) and assigned(lf) do
+          begin
+            fnd:=SearchPathList(lf.LocalUnitSearchPath);
+            lf:=lf.loaded_from;
+          end;
          if not fnd then
            fnd:=SearchPathList(UnitSearchPath);
 
fpc_bug_0010551.patch (975 bytes)   

Aleksa Todorovic

2010-01-30 00:48

reporter   ~0034055

Attached patch modifies ppu searching algorithm to take into account any $UNITPATH hit while loading unit files. Is that proper solution for this problem?

Issue History

Date Modified Username Field Change
2008-01-04 18:44 Igor Funa New Issue
2008-01-04 18:44 Igor Funa File Added: TEST.zip
2008-01-04 19:54 Jonas Maebe Relationship added related to 0009961
2008-01-12 18:07 Jonas Maebe Relationship added related to 0009664
2008-07-24 21:01 Marco van de Voort Note Added: 0020926
2008-08-17 15:27 Jonas Maebe Tag Attached: FU
2009-04-04 00:36 Jonas Maebe Relationship added related to 0013461
2009-06-25 13:20 Jonas Maebe Relationship added related to 0014052
2009-06-26 17:06 Jonas Maebe Relationship replaced has duplicate 0014052
2010-01-30 00:48 Aleksa Todorovic File Added: fpc_bug_0010551.patch
2010-01-30 00:48 Aleksa Todorovic Note Added: 0034055
2010-12-23 17:46 Marco van de Voort Relationship added related to 0018294
2018-05-12 21:47 Marco van de Voort Relationship added related to 0030569