[fpc-devel] Compilation of {$I \dir1\...\dirn\x.pas } statements by FPC is NOT consistent .

Mehmet Erol Sanliturk sanliturk at ttnet.net.tr
Sat Jul 19 23:34:59 CEST 2008


 
Dear Sirs ,
 
Compilation of sources having {$I \dir1\dir2\x.pas } kind statements
are not giving the same compilation results by the FPC.EXE 2.2.2rc2 and 
FPC 2.2.0 .
 
Assume that there are the following directory structures :
 
 Directory of C:\a
 
07/19/2008  01:17 PM    <DIR>          .
07/19/2008  01:17 PM    <DIR>          ..
07/19/2008  01:36 PM    <DIR>          B
07/19/2008  01:19 PM    <DIR>          C
07/19/2008  01:21 PM    <DIR>          D
               0 File(s)              0 bytes
 
 Directory of C:\a\B
 
07/19/2008  01:36 PM    <DIR>          .
07/19/2008  01:36 PM    <DIR>          ..
07/19/2008  01:18 PM               129 CHEERS.PAS
07/19/2008  01:18 PM               161 HELLO-WORLD.PAS
               2 File(s)            290 bytes
 
 Directory of C:\a\C
 
07/19/2008  01:19 PM    <DIR>          .
07/19/2008  01:19 PM    <DIR>          ..
07/19/2008  01:10 PM                95 CHEERS-WELCOME.PAS
07/19/2008  01:13 PM               238 HELLOS.PAS
               2 File(s)            333 bytes
 
 Directory of C:\a\D
 
07/19/2008  01:21 PM    <DIR>          .
07/19/2008  01:21 PM    <DIR>          ..
07/19/2008  01:18 PM               161 HELLO-WORLD.PAS
               1 File(s)            161 bytes
 
 Directory of C:\b
 
07/19/2008  01:46 PM    <DIR>          .
07/19/2008  01:46 PM    <DIR>          ..
07/19/2008  01:18 PM               161 HELLO-WORLD.PAS
               1 File(s)            161 bytes
 
 Directory of C:\e
 
07/19/2008  01:34 PM    <DIR>          .
07/19/2008  01:34 PM    <DIR>          ..
07/19/2008  01:18 PM               161 HELLO-WORLD.PAS
               1 File(s)            161 bytes
 
-------------------------------------------------------------------
 
The source "HELLO-WORLD.PAS"  is the same in all of the directories :
 
Program Hello ;
 
Uses
    Cheers ;
 
{$I \A\C\Hellos.PAS }
 
Begin
 
 Say_Hello
              (
              3
              ) ;
 
End .
 
-------------------------------------------------------------------
 
The source "\A\B\Cheers.PAS" is as follows :
 
Unit Cheers ;
 
Interface
 
Procedure Is_it_Problem ;
 
Implementation
 
{$I \A\C\Cheers-Welcome.PAS }
 
End .
 
-------------------------------------------------------------------
 
The source "\A\C\Cheers-Welcome.PAS" is as follows :
 
Procedure Is_it_Problem ;
 
Begin
 
Writeln ( 'Is there a problem ?' ) ;
 
End ;
 
-------------------------------------------------------------------
 
The source "\A\C\Hellos.PAS" is as follows :
 
Procedure Say_Hello
              (
              n : Integer
              ) ;
 
Var i : Integer ;
 
Begin
 
For i := 1 to N
Do
  Begin
  Writeln ( i , ' : ' , 'Hello , world .' ) ;
  Is_it_Problem ;
  End ;
 
End ;
 
-------------------------------------------------------------------
 
The compilation of "\a\b\HELLO-WORLD.PAS" is giving the following results :
 
c:\a\b > fpc -Fu\a\b hello-world.pas
c:\a\b > fpc  hello-world.pas
         :
 
Free Pascal Compiler version 2.2.2rc2 [2008/07/12] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling hello-world.pas
Compiling CHEERS.PAS
Linking hello-world.exe
57 lines compiled, 0.1 sec , 24112 bytes code, 1308 bytes data
 
The above compilation generated following parts :
 
  \A\B\Cheers.PPU
  \A\B\Cheers.O
 
-------------------------------------------------------------------
 
The compilation of "\a\d\HELLO-WORLD.PAS" is giving the following results :
 
c:\a\d > fpc -Fu\a\b hello-world.pas
         :
 
Free Pascal Compiler version 2.2.2rc2 [2008/07/12] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling hello-world.pas
Linking hello-world.exe
35 lines compiled, 0.1 sec , 24112 bytes code, 1308 bytes data
 
-------------------------------------------------------------------
 
The compilation of "\b\HELLO-WORLD.PAS" is giving the following results :
 
c:\b > fpc -Fu\a\b hello-world.pas
        :
 
Free Pascal Compiler version 2.2.2rc2 [2008/07/12] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling hello-world.pas
Linking hello-world.exe
35 lines compiled, 0.1 sec , 24112 bytes code, 1308 bytes data
 
-------------------------------------------------------------------
 
The compilation of "\e\HELLO-WORLD.PAS" is giving the following results :
 
c:\e > fpc -Fu\a\b hello-world.pas
        :
 
Free Pascal Compiler version 2.2.2rc2 [2008/07/12] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling hello-world.pas
Linking hello-world.exe
35 lines compiled, 0.1 sec , 24112 bytes code, 1308 bytes data
 
-------------------------------------------------------------------
 
Now let's delete the following parts :
 
  \A\B\Cheers.PPU
  \A\B\Cheers.O
 
Let's re-compile "Hello-World.PAS"  after this deletion
in the directories : c:\a\d , c:\b , and c:\e
WITHOUT first compilation in c:\a\b where unit CHEERS.PAS stays :
 
-------------------------------------------------------------------
 
The compilation of "\a\d\HELLO-WORLD.PAS" is giving the following results :
 
c:\a\d > fpc -Fu\a\b hello-world.pas
         :
 
Free Pascal Compiler version 2.2.2rc2 [2008/07/12] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling hello-world.pas
Compiling C:\a\b\CHEERS.PAS
CHEERS.PAS(10,2) Fatal: Can't open include file "\A\C\Cheers-Welcome.PAS"
Fatal: Compilation aborted
Error: C:\fpc\2.2.2rc2\bin\i386-win32\ppc386.exe returned an error 
exitcode (normal if you did not specify a source file to be compiled)
 
-------------------------------------------------------------------
 
The compilation of "\b\HELLO-WORLD.PAS" is giving the following results :
 
c:\b > fpc -Fu\a\b hello-world.pas
        :
 
Free Pascal Compiler version 2.2.2rc2 [2008/07/12] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling hello-world.pas
Compiling C:\a\b\CHEERS.PAS
CHEERS.PAS(10,2) Fatal: Can't open include file "\A\C\Cheers-Welcome.PAS"
Fatal: Compilation aborted
Error: c:\fpc\2.2.2rc2\bin\i386-win32\ppc386.exe returned an error 
exitcode (normal if you did not specify a source file to be compiled)
 
-------------------------------------------------------------------
 
The compilation of "\e\HELLO-WORLD.PAS" is giving the following results :
 
c:\e > fpc -Fu\a\b hello-world.pas
        :
 
Free Pascal Compiler version 2.2.2rc2 [2008/07/12] for i386
Copyright (c) 1993-2008 by Florian Klaempfl
Target OS: Win32 for i386
Compiling hello-world.pas
Compiling C:\a\b\CHEERS.PAS
CHEERS.PAS(10,2) Fatal: Can't open include file "\A\C\Cheers-Welcome.PAS"
Fatal: Compilation aborted
Error: c:\fpc\2.2.2rc2\bin\i386-win32\ppc386.exe returned an error 
exitcode (normal if you did not specify a source file to be compiled)
 
-------------------------------------------------------------------
 
CONCLUSION : Compilation of {$I \dir1\dir2\...\dirn\x.pas } statements 
are NOT
             consistent with respect to changing order of compilation or 
presence of
             compiled parts in the sense that when FPC starts to compile 
a unit which is NOT
             in the current directory , it is NOT able to find 
completely specified paths
             of included files when they are NOT showing the current 
directory
             ( when *.ppu and/or *.o does NOT exist ) .
 
Thank you very much ,
 
Mehmet Erol Sanliturk
 




More information about the fpc-devel mailing list