Delphi Package Build / Install debugging - delphi

I'm using Delphi 2007 Pro. I have a runtime package that includes a number of compound components I'm developing, which are based on TFrames. There is also a related design package which installs these components to the tool palette. These TFrame descendents use a number of third-party components, for various reasons, and also inherit from one another, as a class hierarchy. So far (and with the help of some great advice here), this approach is working very well for what I want to accomplish.
Recently I ran into a problem, however, compiling/building the runtime package. Initially, it had to do with some conflict centering on nxEventLog.pas, the details of which unfortunately I failed to record, but was basically something along the lines of "the definition for this method does not agree with the previous definition for it," like what you get when your implementation declaration doesn't agree with your class declaration. This file is a NexusDB file (the application uses a NexusDB embedded server).
I tried various things, but never was successful in getting the conflict to go away. The closest I came was upon compiling, having the IDE request adding TRUCKLOAD of completely unrelated units to the contains/uses clause. More on this later, but if I proceeded with that, it still wouldn't work. The nxEventLog file had not changed from its original state.
Unable to ferret out why this error was showing up -- it was showing up in Nexus files, not my actual package or units, and I had changed nothing in the Nexus code -- I finally went ahead and just completely uninstalled Nexus, and manually searched to try to make sure I had deleted all related dcu and bpl files, and then reinstalled it. (I'm running Nexus 2.07)
Upon firing up the IDE, I got the following errors:
bds.exe - Entry Point Not Found
---------------------------
The procedure entry point
#Nxsddatadictionary#TnxBaseTableDescriptor#LoadFromReader$qqrp15Classes#TReader could not be located in the dynamic link library NexusDB207sd110.bpl.
---------------------------
OK
Followed by:
Can't load package ....NexusDB207dv110.bpl
Can't load package ....cmTPPanels_D2007_DesignReg.bpl
The specified procedure oculd not be found.
Do you want to attempt to load this package the next time a package is loaded?
Once I uninstalled the cmTPPanels runtime/design packages (my component set), via Component -> Install Package -> Remove, my other "normal Nexus DB" applications seem to work fine, including those which include Nexus's nxEventLog ocmponent. This seems to indicate the problem is definitely in my install packages somewhere.
So, having confirmed that my Nexus installation does not seem to be the actual problem, I opened up the project group which contains both packages. Building (or compiling) the runtime package, the Delphi IDE gives me the same dialog box I mentioned above:
"The following changes are necessary to make this package compatible with other installed package. Choose OK to apply these changes and rebuild the package."
Add dsnap.
dsnap contains implicit unit(s) DBClient, Provider, DataBkr, MidConst, Midas, DSIntf.
Add ibxpress.
ibxpress contains implicit unit(s) IBUtils, IB, IBSQLMonitor, IBHeader, IBIntf, IBXConst, IBXMLHeader, IBSQL, IBBlob, IBCustomDataSet, IBDatabase, IBErrorCodes, IBDatabaseInfo, IBExternals, IBInstallHeader, IBServices.
Add IndyCore.
IndyCore contains implicit unit(s) IdIOHandlerSocket, IdSocks, IdIOHandlerStack, IdBuffer, IdResourceStringsCore, IdIntercept, IdCustomTransparentProxy, IdExceptionCore, IdSocketHandle, IdIOHandler, IdTCPConnection, IdReplyRFC, IdReply, IdTCPClient, IdIPAddress, IdAssignedNumbers.
Add IndySystem.
IndySystem contains implicit unit(s) IdBaseComponent, IdGlobal, IdStreamVCL, IdSysNativeVCL, IdSysVCL, IdSysBase, IdSysWin32, IdResourceStrings, IdException, IdSys, IdStream, IdObjs, IdComponent, IdStack, IdStackWindows, IdWship6, IdWinSock2, IdStackConsts, IdStackBSDBase, IdAntiFreezeBase.
Add Rz30DBCtls90.
Rz30DBCtls90 contains implicit unit(s) RzDBNav, RzDBLbl, RzDBStat.
Add lmdweb30_d10.
lmdweb30_d10 contains implicit unit(s) LMDWebHTTPGet, LMDHTMLObjectUnit, LMDFSSupport, LMDHTTPSupp, LMDStringsSupport, LMDURLSupp, LMDRASSupport, LMDRASCF, LMDWebConst, LMDRAS, LMDSyncUnit, LMDWebBase, LMDWebLex, LMDWebHTMLLex, LMDWebDownloadFormUnit, LMDDownload, LMDInetConst, LMDWebConfig, LMDWebInfo.
Add lmddsg30_d10.
lmddsg30_d10 contains implicit unit(s) LMDDsgPropInsp, LMDDsgPropEditors, LMDDsgMenuEditor, LMDDsgObjects, LMDDsgClass, LMDDsgCst, LMDDsgCollectionEditor, LMDDsgStrsEditor, LMDDsgPropPage, LMDDsgModule.
Add lmdstorage10_d10.
lmdstorage10_d10 contains implicit unit(s) LMDStorFormProperties, LMDStorFormHook, LMDStorBase, LMDStorConsts, LMDStorPropertiesStorage, LMDStorCommon, LMDStorINIVault.
Add ExceptionExpert11.
ExceptionExpert11 contains implicit unit(s) ExceptionLog, EDisAsm, EHash, EListView, EConsts, ETypes, ELogManager, EEncrypt, EBase64, EXMLBuilder, ECore, EWebTools, EZip, EZlib, ESockets, ELang, EHook, EDebug, ELeaks.
Add RemObjects_Core_D11.
RemObjects_Core_D11 contains implicit unit(s) uROClasses, uROSerializer, uROXMLIntf, uROMSXMLImpl, uRORes, uROMSXML2_TLB, uROClient, uRODLToXML, uRODL, uROTypes, uROHTTPTools, uROClientIntf, uROEncryption, uROZlib, uROCipher1, uROHash, uRODECUtil, uRODECConst, uROCipher, uROCiphers, uROBinaryHelpers, uROCompression, uROEventRepository, uROServerIntf, uROSessions, uRODynamicRequest, uRORemoteService, uROThreadPool, uROServer, uROAsync, uROThread, uROBinMessage, uROStreamSerializer.
Add RemObjects_Indy_D11.
RemObjects_Indy_D11 contains implicit unit(s) uROSuperTCPChannel, uROSCHelpers.
Add DataAbstract_Core_D11.
DataAbstract_Core_D11 contains implicit unit(s) uDADataTable, uDASupportClasses, uDARes, uDABusinessProcessor, uDAEngine, uDASQL92QueryBuilder, uDASQL92Interfaces, uDAWhere, uDAInterfaces, DataAbstract4_Intf, DataAbstract3_Intf, uDAHelpers, uDAClasses, uDAMemDataTable, uDAMemDataset, uDAExpressionEvaluator, uDAMacros, uDAUtils, uDAXMLUtils, uDADriverManager, uDAInterfacesEx, uDADelta, uDARegExpr, uDAScriptingProvider, uDAOracleInterfaces, uDAMacroProcessors, uDADataStreamer, uDACDSDataTable, uDARemoteDataAdapter, uDAReconcileDialog, uDAReconcileDialogDetails, uDARemoteDataAdapterRequests, uDABinAdapter.
Add VirtualTreesD11.
VirtualTreesD11 contains implicit unit(s) VirtualTrees, VTAccessibilityFactory.
Add VirtualShellToolsD11.
VirtualShellToolsD11 contains implicit unit(s) VirtualExplorerTree, ColumnForm, VirtualResources, VirtualShellAutoComplete, VirtualShellNotifier, VirtualScrollbars.
Add dxBarDBNavD11.
dxBarDBNavD11 contains implicit unit(s) dxBarDBNav, dxBarDBNavStrs.
Add dxBarExtDBItemsD11.
dxBarExtDBItemsD11 contains implicit unit(s) dxBarExtDBItems.
Add cxVerticalGridD11.
cxVerticalGridD11 contains implicit unit(s) cxDBVGrid, cxVGridViewInfo, cxVGridUtils, cxVGrid, cxVGridNewCategory, cxVGridConsts.
Add dxNavBarD11.
dxNavBarD11 contains implicit unit(s) dxNavBar, dxNavBarExplorerViews, dxNavBarConsts, dxNavBarGraphics, dxNavBarStyles, dxNavBarBase, dxNavBarViewsFact, dxNavBarCollns, dxNavBarVSToolBoxViews, dxNavBarBaseViews, dxNavBarOffice11Views, dxNavBarOfficeViews, dxNavBarXPViews.
Add dxLayoutControlD11.
dxLayoutControlD11 contains implicit unit(s) dxLayoutControl, dxLayoutCustomizeForm, dxLayoutEditForm, dxLayoutCommon, dxLayoutLookAndFeels, dxLayoutControlAdapters.
Add dxMasterViewD11.
dxMasterViewD11 contains implicit unit(s) dxMasterViewColumns, dxMasterView, dxMasterViewStrs.
Add dxdbtrD11.
dxdbtrD11 contains implicit unit(s) dxdbtrel, dxlocate, dxtree, dxdbtree.
Add dxPSCoreD11.
dxPSCoreD11 contains implicit unit(s) dxPSEdgePatterns, dxPSUtl, dxPSImgs, dxPSRes, dxPrnDev, dxPSGlbl, dxPSEngn, dxPSSngltn, dxPSESys, dxBase, dxPSCore, dxPSPrVwStd, dxPSPopupMan, dxPgsDlg, dxWrap, dxPSHFToolBarBld, dxPSfmAutoHFTextFmt, dxPSEvnt, dxPrnPg, dxPpAttr, dxBkGnd, dxFEFDlg, dxPcPrVw,dxExtCtrls, dxExtCtrlsStrs, dxPSForm, dxPSAutoHFTextMnuBld, dxfmDfnStl, dxfmMnPg, dxfmClr, dxPreVw, dxPSPrVw, dxfmZoom, dxPSExtDlgs, dxfmPNFmt, dxfmDTFmt, dxPSPrVwOpt, dxPSfmCompositionDsg, dxPSfmCompositionAdd, dxPSCompsProvider, dxPSXplorerTreeView, dxPSfmReportProperties, dxPSPgsMnuBld, dxfmChFN, dxPSfmTtl, dxPSCPDsg, dxPSfmLnkAdd, dxPSfmEditDesc, dxPSFillPatterns, dxPrnDlg.
Add dxPScxCommonD11.
dxPScxCommonD11 contains implicit unit(s) dxPScxCommon.
Add dxPScxGridLnkD11.
dxPScxGridLnkD11 contains implicit unit(s) dxPScxGridLnk.
Add NexusDB207se110.
NexusDB207se110 contains implicit unit(s) nxseAutoComponent, nxseAllEngines, nxseRecordCompressionEngineSmart, nxseRecordEngineVariable, nxseFulltextEngineCursor, nxseFulltextEngineTable, nxseRefIntEngine, nxseJournalEngine, nxseSortEngineMerge, nxseTemporaryStorageChunked, nxseRecordEngineStatic, nxseIndicesEngineSimple, nxseIndexBase, nxseHeapEngineCached, nxseBlockHeapEngineNonfragmenting, nxseBlobEngineSimple, nxseIndexEngineStaticKeyBstarTree, nxseHeaderAccess, nxseEncryptionEngineBlowfishRC4, nxseBlobEngineSegmented, nxseAutoIncEngineSimple, nxseStreamEngineSimple.
Add NexusDB207sr110.
NexusDB207sr110 contains implicit unit(s) nxsrSqlEngineBase, nxExeConst, nxsrServerEngine, nxsrBlobHandlerCaching, nxsrTimeoutHandling, nxsrTypes, nxsrBlobHandlerBase, nxsrBufferManager, nxsrFileImplWin32, nxsrStrings, nxsrEncryptionEngineBase, nxsrConst, nxsrTemporaryStorageBase, nxsrBlobEngineBase, nxsrSubEngineBase, nxsrBlobHandlerPassthrough, nxsrRecordMapperEngine, nxsrFieldMapperEngineAutoInc, nxsrFieldMapperEngine, nxsrFieldMapper, nxsrSortEngineBase, nxsrFulltextEngineBase, nxsrIndexEngineBase, nxsrRecordEngineBase, nxsrRefIntEngineBase, nxsrAutoIncEngineBase, nxsrStreamEngineBase, nxsrTableLockContainer, nxsrDataDictionary, nxsrFileHandling, nxsrServerCursorMapping, nxsrSystemStorage, nxsrRecordCompressionEngineBase, nxsrHeapEngineBase, nxsrBlockHeapEngineBase.
Add NexusDB207sq110.
NexusDB207sq110 contains implicit unit(s) nxsqlEngine, nxsqlFunctions, nxsqlDataDef, nxsqlFunctionOrganizer, nxsqlCondExp, nxsqlTableExp, nxsqlViews, nxsqlProxies, nxSQLParse, nxsqlPSM, nxsqlTest, CocoaBaseW, nxsqlBase, nxsqlDataManip, nxSQLTok, nxSQLProxiesIntf.
Add NexusDB207lg110.
NexusDB207lg110 contains implicit unit(s) nxlgEventLogDispatcher, nxlgEventLog.
Add NexusDB207dv110.
NexusDB207dv110 contains implicit unit(s) nxServerManager, nxBaseServerComp, nxConfigSettings.
Add MPCommonLibD11.
MPCommonLibD11 contains implicit unit(s) MPDataObject, MPCommonObjects, MPCommonUtilities, MPResources, MPShellTypes, MPThreadManager, MPShellUtilities.
What's weird about this, aside from the fact that includes just about everything but the kitchen sink, is that a number of the packages mentioned aren't even relevant to the components included in this package I'm trying to install; DataSnap, Indy, IBExpress, RemObjects Data Abstract, etc -- none of these are even referenced in my components.
If I click "OK" to all these added units/packages, more chaos ensues, and it doesn't compile.
The NexusDB folders, and the folders which these components I'm developing reside in, are all on my Library path, with my custom components listed last.
I'm working on a virtual machine, and can snapshot as needed, but I can't seem to get around this problem regardless, and it's clear that I don't have enough in-depth understanding of how the compiler works to know where to look for diagnosis of the problem. Anything anyone can mention which might help me do so, would be much appreciated.

As a rule, these errors come from having incompatible, or, more commonly, multiple versions of the same BPL and/or DCP files on the path. Do a full search of your system for all the BPLs and DCPs, and make sure there is only one copy of each.
Tracking these types of errors down can be a massive pain in the ass. :-/

If you have several related packages, the build and installation order is extremely important. If package A depends on B and some unit in B changes, it sometimes goes really wrong. You can reinstall Delphi, but its better to reinstall the packages in order.
First remove all packages. (With inslall packages and remove all you can.)
Then check the registry. Sometimes some information is left which can cause problems later on.
In the HKCU\Software\ [Borland|Codegear]\[Version]\Disabled Packages, there is a list of packages that are disabled. Have a look at these. And remove anything you need.
In the HKCU\Software\ [Borland|Codegear]\[Version]\Known Packages, there is a list of all known packages. Have a look at these and remove all suspicious packages.
For older versions this infomation can be found in:
In the HKLM\Software\Borland[Version]\Known Packages
Try to restart Delphi for sanity and rebuild and install anything needed in the correct order.

Related

Missing procedure entry point for VariantInit during run of C++Builder application

When starting a compiled C++Builder application, it says it cannot find the procedure entry point for VariantInit, and the program does not start. After recompiling, the missing procedure varies (_wopen, VariantCopyInd, _time, _write). Using static linking of the run-time environment (Link with dynamic RTL = false, Link with run-time packages = false).
In the project options, disable incremental link. Doing a full rebuild also works.

EOutOfResources in DLL

I migrated several DLLs and an application from Embarcadero C++ Builder XE to C++ Builder 10.1 Berlin.
Now when my DLL (which contains forms) gets loaded by the application, I get
EOutofResources "Das angegebene übergeordnete Element ist kein übergeordnetes Element von '%s'"
in TApplication::CreateHandle
After searching for hours, I found no one with the same error, not even the english translation. I would translate it as "The specified parent element is not a parent element of '%s'".
My stacktrace:
When I set breakpoints in my DLL's code, none are triggered, so I am not sure why there is even a call to the TApplication constructor (there IS one in my code, but it doesn't seem to be called).
I suspect some issue with dependencies, so I used dependency walker and it found two 64-bit dlls. Not sure if this is a false positive:
What can I do to fix or diagnose this further?
I tried starting a new VCL type project to see if there were differences in the project setup, and lo and behold:
<PropertyGroup>
<ProjectGuid>{E8815773-6421-4FB8-A109-F4F505A67A2E}</ProjectGuid>
<ProjectVersion>18.2</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<AppType>Application</AppType>
<MainSource>Project1.cpp</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
</PropertyGroup>
The newly created project has an element FrameworkType set to VCL. My migrated project had this set to None. After changing this to VCL, the error went away.

Compile with standalone flag gives compilation errors in client code

I'm attempting to compile Zero29 with the --standalone compiler flag. The project itself compiles fine, but I have a unit test project that exercises some code in the Zero29 project, even though it's an executable program (.exe).
Everything works fine without the --standalone compilation flag.
However, when I add the --standalone compilation flag to the Zero29 project, the Zero29 project compiles fine, but in the unit test project, the compiler complains about this Discriminated Union defined in the Zero29 project:
namespace Ploeh.ZeroToNine
open System
open Ploeh.ZeroToNine.Versioning
type Arg =
| Assign of Version
| AssignRank of Rank * int
| Increment of Rank
| ListVersions
| ShowHelp
| Unknown of string list
The unit test project directly references the Zero29 project:
Zero29.UnitTests --references--> Zero29 (where --standalone is added)
When I attempt to compile the entire solution, the Zero29 project compiles with the --standalone flag, but then compilation of Zero29.UnitTests fails. There are several errors, but they are all the same, so here's a single example:
error FS0039: The value or constructor 'Assign' is not defined
Which points to the third line of this code:
let ParseAssignVersionReturnsCorrectResult(version : string) =
let actual = [| "-a"; version |] |> Args.Parse
verify <# [Assign(Version version)] = (actual |> Seq.toList) #>
The strange thing is that while the compiler complains about Assign in the third line of this code snippet, it doesn't complain about the use of Args.Parse, even though it's defined in the same code file as the Arg Discriminated Union.
Why does it do that, and how can I resolve this issue?
(I've attempted to distil the problem here, but the links I've provided point to the actual code files on GitHub, if more information is required.)
Libraries compiled with the --standalone switch cannot expose any F# datatypes. This is, for one, expressly stated in Pickering (2007), p. 210. In your case, a discriminated union is one of these prohibited types. The fact that the file is an executable changes nothing here: it becomes a library the moment you attempt to use it as one.
There have been also multiple reports (for example, here and here) that even libraries compiled with --standalone behave, quoting one of these sources, “funky.” It would be safe to say that the use of this switch should perhaps be limited to stand-alone executables only (and they cannot pretend to be a library even when under unit tests).
Pickering R. (2007). Foundations of F#. Apress.

What is this error? mscorlib_TLB.pas

We have a lot of Delphi Projects, when I build them before, I didn't see any error. But recently I see the following error when I build one of those projects.
D:\Delphi Projects\MySetting.pas Fatal: Could not compile used unit 'mscorlib_TLB.pas'
At first I thought some background process is using this mscorlib_TLB.pas, then I restart my computer and build it again, it still fails and gives the same error above. What is this mscorlib_TLB.pas error?
Thanks!
You have imported a COM object that is COM Callable Wrapper (CCW) around a managed (.net) object. The imported type _TLB.pas file will (sometimes needlessly) have a reference to mscorlib_TLB in its uses clause.
Delphi's type-library importer is buggy, and there are syntax errors in the auto-generated TLB pas file.
Try removing references to mscorlib_TLB in whatever unit is using it.
If the unit actually depends on something in mscorelib, then you'll have to manually fix the syntax errors in the 400kB pas file.
If you really need to use the library, you can import it using the Component::Import Component tool.
I found mscorlib_TLB alongside a COM wrapper that I built in C# a few years ago, MyComWrapper. When I copied MyComWrapper_TLB to another workstation, it was also necessary to copy mscorlib_TLB since it included type definitions required by MyComWrapper_TLB.
A re-import of the related tlb should regenerate mscorlib_TLB.pas if it can't be found. It appears I reimported the tlb on Oct 4, 2017.
Here's the prologue describing the unit:
unit mscorlib_TLB;
// ************************************************************************ //
// WARNING
// -------
// The types declared in this file were generated from data read from a
// Type Library. If this type library is explicitly or indirectly (via
// another type library referring to this type library) re-imported, or the
// 'Refresh' command of the Type Library Editor activated while editing the
// Type Library, the contents of this file will be regenerated and all
// manual modifications will be lost.
// ************************************************************************ //
// $Rev: 52393 $
// File generated on 10/4/2017 11:15:21 PM from Type Library described below.
// ************************************************************************ //
// Type Lib: C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.tlb (2)
// LIBID: {BED7F4EA-1A96-11D2-8F08-00A0C9A6186D}
// LCID: 0
// Helpfile:
// HelpString: mscorlib.dll
// DepndLst:
// (1) v2.0 stdole, (C:\Windows\SysWow64\stdole2.tlb)
// Parent TypeLibrary:
// (0) v1.0 MyComWrapper, (C:\source\my-client\client-project\MyComWrapper\bin\x86\Release\MyComWrapper.tlb)

Variants recursively uses itself?

I'm trying to build a debug version of rtl140.bpl to make debugging apps with runtime packages easier. I built the DPK and ran DCC32 on it, and it gets a ways in, then dies.
C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\source\Win32\rtl\sys\Variants.pas(1072) Fatal: F2092 Program or unit 'Variants' recursively uses itself
But looking at Variants.pas, I can't see how. It only uses SysUtils and Types in the interface section, and neither of those use Variants, or use anything that uses Variants.
Does anyone have any idea why this is breaking?
This is one of the main reasons why we (the RAD Studio team) do not recommend rebuilding the core rtl package. It needs to be done very carefully and the units need to be listed in the contains section in a specific order.
Variants is a bit of a "bastard" unit. The compiler has specific knowledge of it such that when it sees the use of the Variant type, it will automatically add Variants to the uses list in order to ensure the actual RTL support for the Variant type is present. System.pas defers most all variant operations to the Variants unit, but since System cannot use any other units other than SysInit (which is also a very special unit), the compiler has to get involved.
At this time, I don't have any specific suggestions to make this work, other than try to rearrange the contains list in the .dpk and try again. Here's the contains list from the rtl.dpk that we used to build that package:
Variants in 'sys\Variants.pas',
VarUtils in 'sys\VarUtils.pas',
SysConst in 'sys\SysConst.pas',
SysUtils in 'sys\SysUtils.pas',
SyncObjs in 'common\SyncObjs.pas',
Types in 'sys\Types.pas',
VCLCom in 'common\VCLCom.pas',
ComConst in 'common\ComConst.pas',
ComObj in 'common\ComObj.pas',
ComObjWrapper in 'common\ComObjWrapper.pas',
RTLConsts in 'common\RTLConsts.pas',
Contnrs in 'common\Contnrs.pas',
ConvUtils in 'common\ConvUtils.pas',
DateUtils in 'common\DateUtils.pas',
IniFiles in 'common\IniFiles.pas',
Masks in 'common\Masks.pas',
Math in 'common\Math.pas',
Registry in 'common\Registry.pas',
StdConvs in 'common\StdConvs.pas',
StdVCL in 'common\StdVCL.pas',
StrUtils in 'common\StrUtils.pas',
TypInfo in 'common\TypInfo.pas',
VarConv in 'common\VarConv.pas',
VarCmplx in 'common\VarCmplx.pas',
Classes in 'common\Classes.pas',
MaskUtils in 'common\MaskUtils.pas',
HelpIntfs in 'common\HelpIntfs.pas',
ScktComp in 'common\ScktComp.pas',
AccCtrl in 'win\AccCtrl.pas',
AclAPI in 'win\AclAPI.pas',
ActiveX in 'win\ActiveX.pas',
ComSvcs in 'win\ComSvcs.pas',
ADOInt in 'win\ADOInt.pas',
AspTlb in 'win\AspTlb.pas',
COMAdmin in 'win\COMAdmin.pas',
CommCtrl in 'win\CommCtrl.pas',
CommDlg in 'win\CommDlg.pas',
Cpl in 'win\Cpl.pas',
DDEml in 'win\DDEml.pas',
Dlgs in 'win\Dlgs.pas',
DwmApi in 'win\DwmApi.pas',
FlatSB in 'win\FlatSB.pas',
ImageHlp in 'win\ImageHlp.pas',
Imm in 'win\Imm.pas',
Isapi in 'win\Isapi.pas',
Isapi2 in 'win\Isapi2.pas',
LZExpand in 'win\LZExpand.pas',
Mapi in 'win\Mapi.pas',
Messages in 'win\Messages.pas',
MMSystem in 'win\MMSystem.pas',
msxml in 'win\msxml.pas',
Mtx in 'win\Mtx.pas',
MultiMon in 'win\MultiMon.pas',
Nb30 in 'win\Nb30.pas',
Ns30Fix in 'win\Ns30Fix.pas',
Ns35Fix in 'win\Ns35Fix.pas',
Ns36Fix in 'win\Ns36Fix.pas',
Nsapi in 'win\Nsapi.pas',
ObjComAuto in 'common\ObjComAuto.pas',
ObjAuto in 'common\ObjAuto.pas',
OleDB in 'win\OleDB.pas',
OleDlg in 'win\OleDlg.pas',
OpenGL in 'win\OpenGL.pas',
oleacc in 'win\oleacc.pas',
Penwin in 'win\Penwin.pas',
PsAPI in 'win\PsAPI.pas',
RegStr in 'win\RegStr.pas',
RichEdit in 'win\RichEdit.pas',
ShellAPI in 'win\ShellAPI.pas',
SHFolder in 'win\SHFolder.pas',
ShlObj in 'win\ShlObj.pas',
ShLwApi in 'win\ShLwApi.pas',
StrHlpr in 'sys\StrHlpr.pas',
TlHelp32 in 'win\TlHelp32.pas',
UrlMon in 'win\UrlMon.pas',
UxTheme in 'win\UxTheme.pas',
VarHlpr in 'sys\VarHlpr.pas',
WideStrings in 'common\WideStrings.pas',
WideStrUtils in 'common\WideStrUtils.pas',
windows in 'win\windows.pas',
winInet in 'win\winInet.pas',
Winsafer in 'win\Winsafer.pas',
WinSock in 'win\WinSock.pas',
winSpool in 'win\winSpool.pas',
winSvc in 'win\winSvc.pas',
CorError in 'win\CorError.pas',
CorHdr in 'win\CorHdr.pas',
Cor in 'win\Cor.pas',
DXTypes in 'win\DXTypes.pas',
DXFile in 'win\DXFile.pas',
DxDiag in 'win\DxDiag.pas',
D3DX8 in 'win\D3DX8.pas',
D3DX9 in 'win\D3DX9.pas',
Direct3D in 'win\Direct3D.pas',
Direct3D8 in 'win\Direct3D8.pas',
DX7toDX8 in 'win\DX7toDX8.pas',
Direct3D9 in 'win\Direct3D9.pas',
DirectDraw in 'win\DirectDraw.pas',
DirectShow9 in 'win\DirectShow9.pas',
DirectInput in 'win\DirectInput.pas',
DirectSound in 'win\DirectSound.pas',
DirectPlay8 in 'win\DirectPlay8.pas',
DirectMusic in 'win\DirectMusic.pas',
WMF9 in 'win\WMF9.pas',
ZLibConst in 'common\ZLibConst.pas',
ZLib in 'common\ZLib.pas',
Character in 'common\Character.pas',
Generics.Defaults in 'common\Generics.Defaults.pas',
Generics.Collections in 'common\Generics.Collections.pas',
Rtti in 'common\Rtti.pas',
TimeSpan in 'common\TimeSpan.pas',
Diagnostics in 'common\Diagnostics.pas',
AnsiStrings in 'common\AnsiStrings.pas',
TpcShrd in 'win\TpcShrd.pas',
RtsCom in 'win\RtsCom.pas',
MsInkAut in 'win\MsInkAut.pas',
MsInkAut15 in 'win\MsInkAut15.pas',
Manipulations in 'win\Manipulations.pas',
IOUtils in 'common\IOUtils.pas',
D2D1 in 'win\D2D1.pas',
DxgiFormat in 'win\DxgiFormat.pas',
Wincodec in 'win\Wincodec.pas',
KnownFolders in 'win\KnownFolders.pas',
ObjectArray in 'win\ObjectArray.pas',
PropSys in 'win\PropSys.pas',
PropKey in 'win\PropKey.pas',
StructuredQuery in 'win\StructuredQuery.pas',
StructuredQueryCondition in 'win\StructuredQueryCondition.pas';
Program or unit 'Variants' recursively uses itself
is often caused by having the path to source/win32/rtl/sys in the Library search path of the project you are trying to build.
Goto (Delpi_Path)\source\Win32\rtl\sys, and then rename "Variants.pas" to anything, e.g "Variants.sav", then all are OK.
It's because Delphi can't find "Variants.pas" anywhere now, but it still can find a compiled dcu file named "Variants.dcu" somewhere, so that's it.
P.S. If Delphi can't find the dcu too, you should manually serch for "Variants.dcu", and then add the path in the "Tools -> Options" menu.

Resources