Jump to content
ertank

Lots of errors when trying to compile an old project

Recommended Posts

Hello,

 

I am using Delphi 10.3.2.

 

There is that Delphi7 project which uses over 200 units and forms.

 

I am asked to migrate it to Delphi Rio. There are some components used for skinning that will be removed during migration. Other than this, code is mostly compatible.

 

However, I cannot have a good compile. I get one of below errors too frequently that it gets a person fed up. Consider each line as an error returned after a different compile


Could not create output file 'DCU-DEBUG\xyz.dcu'

File not found: 'UnitMainForm.pas'

File not found: 'UnitLogin.pas'

File not found: 'UnitSalesEntry.pas'

File not found: 'ERP.dpr'

 

I am sure all these files exists. I did not copy-paste them. Used SVN to have all files in my computer. Removing all add-ons, even IdeFixPack and problem still exists.

 

Files are on an SSD drive and there is plenty of free space on that drive.

"DCU-DEBUG" folder is writable by Delphi.

 

I do not have any errors reported by Delphi when closing (tested to see if some memory leaks or similar).

 

I failed to find a fix for that problem and asking in here in case someone else might faced that before and can suggest a solution.

 

Thanks & regards,

Ertan

Share this post


Link to post

How much experience do you have working with Delphi?

 

Do you even know how to locate files on the hard drive?


Sorry, but I'd probably fire someone who came to me with this question.

 

If you don't know how to find files on the disk or set up Delphi's search paths properly, there's no way you're going to make any sense at all of the crap you're going to see as a result of rebuilding this D7 app with Unicode strings!

Share this post


Link to post
26 minutes ago, David Schwartz said:

How much experience do you have working with Delphi?

I have been using Delphi 1 until Delphi 7. Then I stop programming for long years and started again recently.

28 minutes ago, David Schwartz said:

Do you even know how to locate files on the hard drive?

Yes, they exists under project directory with DPR file itself.

image.thumb.png.ec4638c89821ceb3c447140f9e36f62a.png

 

29 minutes ago, David Schwartz said:

If you don't know how to find files on the disk or set up Delphi's search paths properly, there's no way you're going to make any sense at all of the crap you're going to see as a result of rebuilding this D7 app with Unicode strings!

It is not about search paths. It is something with Delphi not able to cope with very fast drives or something else that I do not know. DPR file has following lines:

uses
  Forms,
  UnitLogin in 'UnitLogin.pas' {Login},
  UnitMainForm in 'UnitMainForm.pas' {MAINFORM},

 

Error is not on same file each time. It changes. I just give some examples there. However, it mostly stops either at first or second file defined in DPR. 

Share this post


Link to post

Try do temporarily disable your virus scanner and see whether the problem goes away.

 

(That's the only idea I came up with, everything else is so obvious that I think you probably already tried it.)

Share this post


Link to post

Disabling real-time virus scanner is not helping.

I also used another drive and still got same problem.

For the record one of the drives were NVMe and other was SSD both being pro grade drives.

Using NVMe drive seemingly results in having less of the problem.

I am yet to find and try with regular spin drive.

Share this post


Link to post
3 hours ago, ertank said:

Hello,

 

I am using Delphi 10.3.2.

 

There is that Delphi7 project which uses over 200 units and forms.

 

I am asked to migrate it to Delphi Rio. There are some components used for skinning that will be removed during migration. Other than this, code is mostly compatible.

 

However, I cannot have a good compile. I get one of below errors too frequently that it gets a person fed up. Consider each line as an error returned after a different compile

 


Could not create output file 'DCU-DEBUG\xyz.dcu'

File not found: 'UnitMainForm.pas'

File not found: 'UnitLogin.pas'

File not found: 'UnitSalesEntry.pas'

File not found: 'ERP.dpr'

 

Ertan

Did you just open the old D7 project in Rio to start the migration? That is not a good idea for such a massive version jump.

 

After you have extracted the complete old project from version control,  close all files and the RIO IDE and go to the project folder on disk and move all files not having one of the following extensions to a zip folder:

 

dpr, pas, res, rc, ico

 

If the project contains other resources you may keep them as well. The important part is to delete the old project file (do not remember what extension it used in D7, perhaps bdsproj, and the old cfg file as well.

 

Then open the IDE and open the project's dpr file.  This will create a new project file. The project will show up in the project manager view and should have the Win32 target assigned automatically. It will also have a default build configuration assigned, but the settings used for that will not all be suitable for your project. So the next step is to open the project options dialog (from the Project menu or the project manager view's context menu) and adjust the settings, especially the search and output pathes.

Beware! The settings dialog is completely different from the one you may know from D7! Since you can have multiple build configurations for multiple target platforms the settings are organized as a kind of hierarchy, and you have to first select the correct hierarchy level for the settings you want to modify. You do this using the combo box at the top of the right-side pane, pick "32 bit windows platform" under "all configurations".

 

In the left-hand treeview you should have the top node (Delphi compiler) selected, that shows the page with the project-specific path settings on the right. The most important things here to get your project to compile are the unit scope names and the search path.

 

Delphi uses namespace-like scope names on the run-time and framework units and has done so since many versions. But D7 did not use unit scope names. To make migration easier the IDE and the compiler will automatically search for units named in Uses clauses within the scopes listed in the unit scope names field if the unit is not found by the given name (the System scope is always searched, though).

The default list contains the most frequently used scopes, but you have to make sure that VCL and VCL.Win are in the list as well.

 

The search path becomes important if your project uses custom units not located in the project folder (where the dpr file and the generated dproj file reside). You have to add all pathes for units there that are not found on the IDE library path (as dcu or pas).

 

I don't know how you organize your project files on disk. I usually use something like

  • projectname (dpr, dproj, cfg)
    • source (pas, inc)
    • bin (dcus)
    • exe (exe)
    • doc (documentation)
    • resources (rc and res files, files embedded in them)
    • test (unit tests and other test programs)

So the output folder path set in the dialog would be (without the quotes, of course) ".\exe".

The unit output path would be ".\bin\$(platform)\$(config)"

The search path would be ".\bin\$(platform)\$(config);.\source;$(common);$(include)"

 

"common" and "include" are environment variables defined in the IDE Options dialog that contain the pathes to my code library (not project specific units).

 

The resource compiler node on the left also has a search path setting, these are for rc and res files, but in my experience this has been a bit unreliable in recent versions; i often have to add rc files explicitely to a project to get them compiled and linked in.

 

 

 

  • Like 2

Share this post


Link to post

I finally got a regular HDD (spin drive) and when using it compilation works. It also gives errors like above, but so rare that you can ignore them.

 

All SMART checks on all drives are good. Now, I wonder if it is Windows 10 thing appeared with its latest update or something. I still cannot find a reason why creating files on disk fails or why it cannot find existing files.

 

Share this post


Link to post
On 8/4/2019 at 1:27 PM, ertank said:

I finally got a regular HDD (spin drive) and when using it compilation works. It also gives errors like above, but so rare that you can ignore them.

 

All SMART checks on all drives are good. Now, I wonder if it is Windows 10 thing appeared with its latest update or something. I still cannot find a reason why creating files on disk fails or why it cannot find existing files.

 

Try to toggle compiler cache on and off: http://docwiki.embarcadero.com/RADStudio/Rio/en/Compiling_and_Running

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×