View Issue Details

IDProjectCategoryView StatusLast Update
0025610FPCCompilerpublic2014-03-20 22:03
ReporterMaciej IzakAssigned ToJonas Maebe 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.7.1Product Build26466 
Target VersionFixed in Version3.0.0 
Summary0025610: Unable to find file - magic error.
DescriptionI think it is a compiler bug rather than the Lazarus bug. Error is visible when you try to install the package (attached as r14.zip). Please be prepared for magic. More in "Steps To Reproduce".
Steps To ReproduceYou need Lazarus for Windows 32 (my version is rev. 43727) and FPC 2.7.1 (my version is rev. 26466).

1. Open package r14.lpk
2. Compile package (DON'T INSTALL!)
3. Edit unit r14u02 - change "upcase" to "lowercase".
4. Try install package (impossible - error "Unable to find file r14u01.pas")

TagsNo tags attached.
Fixed in Revision27213
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0024121 resolvedJonas Maebe Incorrect PPU file produced: CRC for a 'Use Unit' section wrongly stored into calling unit 

Activities

Maciej Izak

2014-01-25 19:26

reporter  

r14.zip (1,397 bytes)

Jonas Maebe

2014-01-25 19:41

manager   ~0072676

What happens if you try to recompile the package after modifying it before installing it?

Maciej Izak

2014-01-25 19:50

reporter   ~0072677

It recompiles, and after that I can install the package.

Jonas Maebe

2014-01-25 19:53

manager   ~0072678

Then I don't see any problem, and definitely not with the compiler. If someone from Lazarus thinks it's a problem, they can investigate further. Otherwise they can close the issue as far as I'm concerned.

Juha Manninen

2014-03-17 10:23

reporter   ~0073769

The package compiles just fine here. Installing it makes no sense because it has no Register function. The IDE warns about that.
Most likely a user error.

Maciej Izak

2014-03-18 21:40

reporter   ~0073826

Nope :). Please check again new version "r14_v2.zip" without "IDE warns"

Maciej Izak

2014-03-18 21:40

reporter  

r14_v2.zip (8,934 bytes)

Juha Manninen

2014-03-19 08:31

reporter   ~0073834

Unbelievable! I can actually reproduce this. Only unit r14u02 was open in editor.

---

C:\FPC\2.6.4\bin\i386-win32\make.exe: Entering directory `C:/SW/lazarus_gitsvn'
C:/FPC/2.6.4/bin/i386-win32/make.exe -C ide idepkg
make.exe[1]: Entering directory `C:/SW/lazarus_gitsvn/ide'
../tools/svn2revisioninc.exe .. revision.inc
C:/FPC/2.6.4/bin/i386-win32/make.exe --assume-new=lazarus.pp lazarus.exe OPT=' -WG -gw -gl -godwarfsets -gt -Co -Cr -Ci -Sa @C:\Users\juham.STARSOFT\AppData\Local\lazarus\idemake.cfg -FUC:\SW\lazarus_gitsvn\units\i386-win32\win32'
make.exe[2]: Entering directory `C:/SW/lazarus_gitsvn/ide'
C:/FPC/2.6.4/bin/i386-win32/fpc.exe -gl -Sci -dlclwin32 -Fu../designer -Fu../debugger -Fu../debugger/frames -Fu../converter -Fu../packager -Fu../packager/frames -Fu../components/custom -Fuinclude/win -Fuframes -Fu. -Fiinclude -Fiinclude/win32 -Fi../images -FE.. -FU../units/i386-win32/win32 -WG -gw -gl -godwarfsets -gt -Co -Cr -Ci -Sa @C:\Users\juham.STARSOFT\AppData\Local\lazarus\idemake.cfg -FUC:\SW\lazarus_gitsvn\units\i386-win32\win32 -di386 lazarus.pp
Free Pascal Compiler version 2.6.4 [2014/03/06] for i386
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling lazarus.pp
PPU Loading C:\SW\LazTest\r14_v2\lib\i386-win32\win32\r14u01.ppu
PPU Source: r14u01.pas not found
PPU Loading C:\SW\LazTest\r14_v2\lib\i386-win32\win32\r14u01.ppu
PPU Source: r14u01.pas not found
Recompiling r14u01, checksum changed for r14u02
r14u01.pas(72,12) Fatal: Can not find r14u01 used by r14u02, ppu=..\..\LazTest\r14_v2\lib\i386-win32\win32\r14u01.ppu, package r14

Mattias Gaertner

2014-03-19 09:23

manager   ~0073836

Yes, it is a fpc bug:

[0.035] Load from R14U01 (interface) unit R14U02
[0.035] Adding dependency: R14U01 depends on R14U02
[0.035] Recompiling r14u01, checksum changed for r14u02
[0.035] Compiling r14u01.pas

Maybe related to 24121.

Juha Manninen

2014-03-19 10:40

reporter   ~0073838

> Yes, it is a fpc bug

I am not sure about that. An FPC bug should happen also when you click the "Compile" button in the package window.
Now it happens only when doing Use -> Install. Something different is passed to FPC.

Mattias Gaertner

2014-03-19 10:58

manager   ~0073839

The package needs to be compiled twice.
This is a FPC bug.

Maciej Izak

2014-03-19 11:35

reporter   ~0073840

This bug is really disruptive... IMO the bug is related to "resourcestring"...

Mattias Gaertner

2014-03-19 11:50

manager   ~0073841

This bug should be moved to FPC.

Juha Manninen

2014-03-19 13:59

reporter   ~0073844

This issue may end up floating in "uncharted territory". Jonas already rejected it:
> Then I don't see any problem, and definitely not with the compiler

Mattias Gaertner

2014-03-19 14:20

manager   ~0073847

The compiler creates invalid ppu files, which need a second compile.
That's definitely a compiler issue.

If Jonas says the FPC team won't fix it, then Lazarus might need a workaround for such packages.

Jonas Maebe

2014-03-19 14:31

manager   ~0073848

It's not a problem with the package, it's a problem with changing the name name of the unit from one case to another. Maybe it needs to be changed in FPC after all. I don't plan on working on this myself though, because I don't think it's very important nor very common and there is a trivial workaround (recompile).

Mattias Gaertner

2014-03-19 14:57

manager   ~0073849

All file names are lower case.

The problem is that the unit maintainer does not see the error, the user of the ppu file sees it. And even worse: ppu files might be installed read only. So a recompile can be tricky.
It is true, that the problem is not common, but it appears from time to time, especially with units ported from Delphi.

Lazarus needs a workaround.

Maciej Izak

2014-03-19 15:01

reporter   ~0073850

The attached example is the simplest case. Recompiling does not always work. The problem is not trivial. Through this error I lost a few days. Everything came out during the work on Generics.* namespace.

Jonas Maebe

2014-03-19 20:05

manager   ~0073852

Ah, now I see. I had misunderstood the initial bug report, I had interpreted the "change upcase into lowcase" as that the name of the unit was changed from uppercase to lowercase and that this somehow caused problems.

I've now looked at the source code, and the problem is the "external" declaration in the implementation section of the unit. This has been known for a long time and is strongly discouraged, see e.g. http://bugs.freepascal.org/view.php?id=18371#c45609

It's only allowed because Delphi allows it. You can solve the issue by moving the "external" to the interface and removing the implementation declaration (that also works in Delphi). Maybe we should give a warning when encountering such declarations.

Issue History

Date Modified Username Field Change
2014-01-25 19:26 Maciej Izak New Issue
2014-01-25 19:26 Maciej Izak File Added: r14.zip
2014-01-25 19:41 Jonas Maebe Note Added: 0072676
2014-01-25 19:41 Jonas Maebe Status new => feedback
2014-01-25 19:50 Maciej Izak Note Added: 0072677
2014-01-25 19:50 Maciej Izak Status feedback => new
2014-01-25 19:53 Jonas Maebe Note Added: 0072678
2014-01-25 19:53 Jonas Maebe Project FPC => Lazarus
2014-03-17 10:23 Juha Manninen LazTarget => -
2014-03-17 10:23 Juha Manninen Note Added: 0073769
2014-03-17 10:23 Juha Manninen Status new => resolved
2014-03-17 10:23 Juha Manninen Resolution open => unable to reproduce
2014-03-17 10:23 Juha Manninen Assigned To => Juha Manninen
2014-03-18 21:40 Maciej Izak Note Added: 0073826
2014-03-18 21:40 Maciej Izak Status resolved => assigned
2014-03-18 21:40 Maciej Izak Resolution unable to reproduce => reopened
2014-03-18 21:40 Maciej Izak File Added: r14_v2.zip
2014-03-19 08:31 Juha Manninen Note Added: 0073834
2014-03-19 08:31 Juha Manninen Status assigned => confirmed
2014-03-19 09:23 Mattias Gaertner Note Added: 0073836
2014-03-19 09:23 Mattias Gaertner Relationship added related to 0024121
2014-03-19 10:40 Juha Manninen Note Added: 0073838
2014-03-19 10:58 Mattias Gaertner Note Added: 0073839
2014-03-19 11:35 Maciej Izak Note Added: 0073840
2014-03-19 11:50 Mattias Gaertner Note Added: 0073841
2014-03-19 13:33 Bart Broersma Project Lazarus => FPC
2014-03-19 13:59 Juha Manninen Note Added: 0073844
2014-03-19 14:20 Mattias Gaertner Note Added: 0073847
2014-03-19 14:31 Jonas Maebe Note Added: 0073848
2014-03-19 14:57 Mattias Gaertner Note Added: 0073849
2014-03-19 15:01 Maciej Izak Note Added: 0073850
2014-03-19 20:05 Jonas Maebe Note Added: 0073852
2014-03-20 22:03 Jonas Maebe Assigned To Juha Manninen => Jonas Maebe
2014-03-20 22:03 Jonas Maebe Status confirmed => assigned
2014-03-20 22:03 Jonas Maebe Fixed in Revision => 27213
2014-03-20 22:03 Jonas Maebe Status assigned => resolved
2014-03-20 22:03 Jonas Maebe Fixed in Version => 2.7.1
2014-03-20 22:03 Jonas Maebe Resolution reopened => fixed