Perpetual "File not found" - delphi

I have two Delphi runtime packages. The SecondPackage includes FirstPackage in its requires clause. One of the other developers recently added several new files to the first package.
Now when I compile the first package I don't have any errors but when I compile the second package I keep getting:
[DCC Fatal Error] FirstPackage.dpk(91): F1026 File not found: 'SomeFile.dcu'
SomeFile is already contained in FirstPackage but re-adding it to FirstPackage moves SomeFile to the end of the Contains clause and gets me:
[DCC Fatal Error] FirstPackage.dpk(91): F1026 File not found: 'SomeOtherFile.dcu'
I can continue re-adding files until I'm blue in the face and the result is always the same. The first file in the contains clause cannot be found when SecondPackage is compiled.
I've tried deleting all related dcus, dcps and bpls manually and rebuilding but to no avail. Any ideas?

Grrr! Dang you Delphi IDE! Quit messing with the library path. If I wanted to add an entry I would have done so.
Apparently if the project type is a package and you add a file to it Delphi gets a little trigger happy and adds the file's location to the IDE's global library path. Removing the unnecessary entries allowed the packages to compile. Why these entries prevented one of the packages from compiling in the first place is an other matter.

Related

Delphi 10.3.2 Build Fails to Find DFM files

I'm using parallels VM and recently had my code in Dropbox contained within the VM. Dropbox was quite problematic in that it is really slow if you have a lot of files. Since Parallels happily shares folders from the HOST, and one of those folders is the HOST Dropbox folder, I started using that drive (essentially \mac\Dropbox mapped as W:). All goes well, the VM is much faster and I can easily access the pas/dfm files.
HOWEVER, when I build the project, the compiler complains that it cannot find DFM files (eg. about.dfm, login.dfm etc). The various DFM files are all there and the compiler complains of different DFM files, ie. one build it will be login.dfm and about.dfm, the next it will complain it cannot find Waiting.dfm. All of the DFM files are there, readily editable in the IDE.
The only thing I could try, other than constantly trying to build the project, was to put the path of the project into the library. This made no difference.
In another project the compiler cannot find the project resource (res) file. And, of course, that file is also there.
[dcc32 Error] E1026 File not found: 'EMPSecureInitialize.res'
[dcc32 Error] E1026 File not found: 'EMPSecureInitialize.res'
[dcc32 Error] E1026 File not found: 'About.dfm'
[dcc32 Error] E1026 File not found: 'Login.dfm'
[dcc32 Error] E1026 File not found: 'EMPSecureSlideShow.dfm'
[dcc32 Error] E1026 File not found: 'About.dfm'
[dcc32 Error] E1026 File not found: 'Login.dfm'
[dcc32 Error] E1026 File not found: 'EMPSecureSlideShow.dfm'
Projects with the source on a local drive, build without issue. Projects with source on a network (Parallels Host) drive arbitrarily do not find DFM or RES files. Those files are always and readily found when using the IDE, ie. click Design and the form appears.
I could understand if this was a consistent fault, but it is not 100% repeatable, sometimes the build works as expected. Is there some sort of weird timing or path construct that the compiler uses?
While it is practically impossible for anyone to reproduce your precise environment to reproduce this issue, I have a very strong feeling the issue is with a limitation in the number of concurrent files that can be opened at a time. At least on Windows, when a folder is shared, it has the ability to control the number of concurrent connections.
Imagine how the compiler works. It needs to open numerous files rapidly to read their contents and build DCUs out of them. First, the PAS files are loaded. Then, those which depend on additional files, such as DFM or RES files, get those loaded. Then all gets linked together to produce an output. That's a lot of files the compiler needs to open at the same time.
So there's likely a way to control and increase the number of concurrently open files through the Parallels virtualization. This doesn't seem to be an issue with Dropbox.

dxGDIPlusClasses.pas not found error delphi 10

When I tried to compile one of my BPL files, I get an error:
dxGDIPlusClasses.pas not found.
I double checked the unit file exists on the hard drive.
I also added $(BDSCOMMONDIR)\Dcp to the DCP Output directory, and $(BDSCOMMONDIR)\Bpl to the Package Output directory. The runtime package containing the unit was also added to the BPL.
I searched online for answers, foound one suggestion to enable Build with runtime packages under the Project Options, but when I checked I dont have that option.
Does anyone know how to solve this?
The error message indicates that either:
the compiler can't find the source file it needs for the unit.
the compiler found a .dcu file compiled with a different version of the compiler and needs to recompile it.
.dcu files are not compatible across compiler versions (with the single exception of D2006->D2007), meaning that every new version release of the compiler means all your source needs to be recompiled in order to be compatible with it.
You need to add the path to the source to Project->Options->Directories and Conditionals->Search Path so it can find the source code it needs.

How to recompile modifications to VCL source file (Menus.pas)?

We have a modified menus.pas.
At
uses ...,Controls,...;
The compiler raised a fatal error:
[DCC Fatal Error] Menus.pas(*): F2051 Unit Controls was compiled with
a different version of Menus.TPopupMenu
tried:
deleted all dcu in the project.
build
build all
tried adding the file to library path which leads to add db folder(from vcl too) and then to
[DCC Error] jpeg.pas(872): E2065 Unsatisfied forward or external declaration: 'jpeg_save_markers'
which is a dead end.
deleted the controls.dcu (all 3) and the delphi did not know automaticaly to recompile them, instead reported that controls.dcu is missing.
Here is how I handle modifications to VCL source files:
Make a copy of the file in your project structure. Either add the file to your project, or make sure the search path finds your modified file.
Make modifications, but only in the implementation section. You are not able to modify the interface section if you use any other units that themselves use the unit you are modifying.
Explicitly set the compiler options at the top of the modified source file. Use default Delphi options, as found by pressing CTRL+O O in a default vanilla project.
I'd guess that one of the final two bullet points is what is tripping you up.
In Delphi XE7 (and below) themes and styles are totally unusable.
So, I patched the file ( Delphi XE7\source\vcl\Vcl.Themes.pas ) add it to the project file, compiled it and got a DCU. I replaced the old DCU ( Delphi XE7\lib\win32\release\Vcl.Themes.dcu - same for "debug" folder) with the new one. Everything works smooth now. I don't even have to link the PAS file to my projects.

Delphi Error E1026 File not found: "myprojectname.tlb"

I have a project let's call it Yellow.dproj, which I saved as Blue.dproj, to make some changes. There must be some COM/DCOM related code in this project, but I can't figure out where.
The error I am getting when I try to build Yellow.dproj is that it can not find a type library (TLB) file: "E1026 File not found: ". The file it can't find is MyAppName.tlb. There is a MyAppName_tlb.pas file, which I have tried adding and removing from the project, either way I get this error.
I think I probably have to go into that TLB file, which I don't really understand, and rename a bunch of junk in there, because it is dependant on the name of my application. This is something that happens to you, I suspect, when you use COM/DCOM and type libraries in Delphi (Delphi 2010). You can't just rename or save-as and build a new project again.
What do I do to fix this unit up?
Do you have {$ *.TLB} in your project source?
The * is the project name, so the TLB file has to match the name of the project - perhaps the name of the tbl was not changed along with the project.

Delphi: Required package not found

I'm trying to build 3 packages, A, B and C. A defines some base classes that are used in B and C. I've got all 3 of them in the same project group, all set up to output to the same custom BPL output folder. This folder is in the search path for B and C. But when I go to build B and C, the compiler chokes on the Requires list. "Required package 'A' not found."
How do I tell B and C where to find A so they'll build correctly?
Either the package can't be found, or the compiler is confused. In the later case, a restart sometimes helps. Then a manual build from all packages in order.
If it really can't be found, check if all package (bpl and dcp) and dcu files are available. You need both.
If this happens when the IDE is trying to load a package: your package output directory (where the *.bpl files go) has to be on your system's PATH environment variable. Packages are statically linked DLLs, Windows has to be able to find them to load them.
If this happens when building the packages: any/all of your DCP output directories (where the *.dcp files go) have to be in the dependent projects' search path so that the compiler can find the compiled packages.
You can also leave the DCP output directory of the package project empty - in which case the global DCP output directory set in Tools\Options\Library is used; the dependent projects then don't need to include it in their search path.
It is possible that the name of the required package is incorrectly specified in the 'requires' clause of the package you are trying to compile. Let's take an example:
We have two packages - VirtualTreesR.dpk and VirtualTreesD.dpk. VirtualTreesD requires VirtualTreesR. They both have the '16' suffix, so they both are displayed in the Delphi project manager window as VirtualTreesR16.bpl and VirtualTreesD16.bpl. You may think that these are the names of the packages, but you are wrong. The names of the packages are still VirtualTreesR and VirtualTreesD, not VirtualTreesR16 and VirtualTreesD16.
When VirtualTreesR.dpk is compiled Delphi produces two files (I don't talk about DCUs here) VirtualTreesR*16*.bpl and VirtualTreesR.dcp. See the difference?
Then we attempt to compile VirtualTreesD.dpk and get the error: "[DCC Fatal Error] VirtualTreesD.dpk(35): E2202 Required package 'VirtualTreesR16' not found".
The error happens because the 'requires' clause of the VirtualTreesD.dpk package contains the following lines:
requires
designide,
VirtualTreesR16;
Delphi tries to find VirtualTreesR16.dcp and fails even if the Delphi search path and the PATH environment variable are set correctly because there is no VirtualTreesR16.dcp. Only VirtualTreesR.dcp.
The solution is to fix the 'requires' clause so it will look like the one below:
requires
designide,
VirtualTreesR;
Hope it helps.
P.S. This a quite frustrating issue because this name mismatch is not obvious and its fragments are scattered across different settings. Delphi could be more specific if it specified what file exactly it tried to find (e.g. 'VirtualTreesR.dcp' instead of 'VirtualTreesR').
I would check to make sure where you are writing the .dcp files for the packages. once you have this, check that the search path of each package has an entry for the .dcp output folder.
I sometimes receive the "package not found" error when adding required packages via the Delphi Project Manager context menu. (Open a package, right click "Requires", choose "Add Reference..." command)
Instead it's easier to add the required package by editing the package project file manually:
Select the package in the Project Manager. MyPackage.bpl for example.
Ctrl+V to open the project file.
Add the required package to the requires clause.
Ensure the required package *.DCP file is in the package search path.

Resources