DCC32 command-line compiler completes successfully, but does not generate the EXE file

2.6k Views Asked by At

I'm using the Delphi 5 command-line compiler to do a build. The build does not report any errors, however it does not generate the EXE file either.

I can confirm the following:

  • Doing the same build via the IDE behaves correctly.
  • There is no difference in the source code or options between IDE vs. DCC32 build.
  • The problem occurrs only on a full build. I.e. doing a build first with -B option and followed by one without, the 'compile' correctly generates the EXE file.
  • Using the -E switch on the command-line to force an invalid build output path doesn't report an error -- as if there isn't even an attempt to generate the EXE file.
  • Other projects do build correctly.
  • I have disabled anti-virus software and so can confirm that that is not the problem.

EDIT Although I experienced this with Delphi 5, it is not specific to that version. The Delphi Bug List confirmed the issue in at least D4-D6.

4

There are 4 best solutions below

0
On BEST ANSWER

After a lengthy investigation, I've managed pinpoint the problem.

  • I wrote a little batch file to do the build and check for the EXE and report success or failure either way.
  • I then went through the painstaking process of eliminating dependencies one at a time and retesting the build.
  • I eventually tracked it down to a specific compiler directive {$ObjExportAll ON} that was used in some of our third party packages.
  • Searching the internet revealed that this bug was introduced when the $ObjExportAll was added for BCB support. Though it seems to have been rarely encountered - just my luck :(
  • I'm unsure if or which version the bug was fixed.

You can test the bug with the following simple project:

program TestDCC32ObjExportAll;

{$OBJEXPORTALL ON}

begin
end;
  • With the directive, dcc32 does not create the EXE.
  • Without the directive, dcc32 does create the EXE.
  • The IDE always creates the EXE.

Fortunately we don't use BCB at all, so I've simply disabled the directive wherever it occurred.


EDIT
The wonderful resource The Delphi Bug List reports that the issue was confirmed to exist in Delphi 4, 5, and 6. Unfortunately, The Delphi Bug List was discontinued after that. :(

1
On

I think it may be a very known issue (for those, who works with D5).

For example, FinalBuilder contains "Use workaround for Delphi 5 compiler bug" in "Build Delphi project" action, which builds project twice with different options - specifically to create exe, when dcc32 doesn't create one (according to help file).

There is no similar option for Delphi 4 or Delphi 6, so I guess that it was introduced in Delphi 5 and was fixed in Delphi 6.

3
On

You can use ProcessMonitor by SysInternale/Microsoft to investigate on .execreation. Run procmon.exe and add filter with "Path" "contains" (your exe name) then "include".

In my environment compiling t.pas gave:

    12:09:58,1927245    DCC32.EXE   3596    CreateFile  C:\tmp\t.exe    SUCCESS Desired Access: Generic Write, Read Attributes, Disposition: OverwriteIf, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: 0, OpenResult: Overwritten
    12:09:58,1928116    DCC32.EXE   3596    CreateFile  C:\tmp\t.exe    SUCCESS Desired Access: Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Complete If Oplocked, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
    12:09:58,1928281    DCC32.EXE   3596    QueryFileInternalInformationFile    C:\tmp\t.exe    SUCCESS IndexNumber: 0x46b00000000c296
    12:09:58,1928376    DCC32.EXE   3596    CloseFile   C:\tmp\t.exe    SUCCESS 
    12:09:58,1961352    DCC32.EXE   3596    WriteFile   C:\tmp\t.exe    SUCCESS Offset: 0, Length: 19 968
    ....

Maybe it is bug in dcc32?

0
On

I remember similar things with somewhere in the Delphi 5 era (might be Delphi 4 or Delphi 6 though) in the IDE when we had some rogue .dcu file (which we did have a a .pas file).

Deleting the .DCU files before building resolved the issue.

Also: anti-virus software can do really bad timing-related things to your system; been there done that: most of my development systems are in a virtual machine without anti-virus for that reason alone.

Try to reproduce your Delphi 5 dcc32 issue on a clean machine (just Windows and the Delphi components you need, nothing more).

If that works, then use Process Monitor to see the differences between those machines as Michał Niklas suggested.