Jump to content
PeaShooter_OMO

Ugrading Indy on Delphi 11. Error: F2051 Unit IdThread was compiled with a different version of IdGlobal.IdDisposeAndNil

Recommended Posts

I removed the standard Indy from Delphi 11. I used the Clean_Alexandria.cmd batch file and also went through all files and folders on my PC to remove any Indy*.bpl, dclIndy*.bpl, Id*.dcu, Id*.pas files that may exist. I removed all previous Library and Browsing Paths.

 

I then downloaded Indy from the Git repository (Commit: b994412). I opened the project group for Delphi 11 (280) and changed each package's "Unit Output Directory" to (one for each, related to its functionality - System, Core, Protocols):

 

..\..\..\Delphi 11\DCU\System\$(Platform)\$(Config)
or
..\..\..\Delphi 11\DCU\Core\$(Platform)\$(Config)
or
..\..\..\Delphi 11\DCU\Protocols\$(Platform)\$(Config)

 

I made sure to enable "Explicit Rebuild" for all packages.
I made sure the DPK files did not get corrupted and that they looked the same as the originals after changing project options. I did also try with the {$IMPLICITBUILD OFF} directive.

 

I then built and added Library paths, Browsing Paths and Debug DCU paths for Win32 and Win64 to Delph Options:

 

Debug DCU:
c:\<..........>\Delphi 11\DCU\System\$(Platform)\Debug
c:\<..........>\Delphi 11\DCU\Core\$(Platform)\Debug
c:\<..........>\Delphi 11\DCU\Protocols\$(Platform)\Debug


Library:
c:\<..........>\Delphi 11\DCU\System\$(Platform)\Release
c:\<..........>\Delphi 11\DCU\Core\$(Platform)\Release
c:\<..........>\Delphi 11\DCU\Protocols\$(Platform)\Release


Browsing:
c:\<..........>\Source\System
c:\<..........>\Source\Core
c:\<..........>\Source\Protocols

 

I obviously copied all *.pas and *.inc files to the related Source folders I added to Browsing paths.
I also copied all the *.res files to the related DCU folders I outputted the units to just for incase.

 

When I create a blank project and add a IdTCPServer to the form and run it works fine. The moment I enable "Use Debug .DCUs" and try to build it gives the F2051 error:
[dcc32 Fatal Error] Project11.dpr(5): F2051 Unit IdThread was compiled with a different version of IdGlobal.IdDisposeAndNil

 

I am sure I am missing something here. I have upgraded Indy many times before in Delphi XE3 but this one stumps me.

Share this post


Link to post

Debug Builds then Release Builds
If I build the Indy projects' Debug Builds first then the Release Builds then the test project will fail to build on its Debug Build with "Use Debug .DCUs" is enabled.

 

Release Builds then Debug Builds
If I build the Indy projects' Release Builds first then the Debug Builds then the test project will fail to build on its Release Build

 

Inline Directive
If I remove the inline directive from IdGlobal.IdDisposeAndNil then the test project will build and run successfully on both of its Debug and Release builds and also stepping into the code will work if "Use Debug .DCUs" is enabled.

 

The inline directive is used in many places in the code and I do not want to remove them just to get this working. How can this be fixed then? Surely there is a way because the standard Indy that is shipped with Delphi works 100%.

 

I cannot just go back to the standard Indy with Delphi because I need to check if a newer release of Indy has fixed certain bugs.

Share this post


Link to post

I don't really have an answer for you. All I can think of right now is either 1) maybe you still have old files on your system somewhere, or 2) maybe you didn't recompile/separate everything when switching between release and debug builds.

 

Share this post


Link to post
On 12/1/2023 at 6:27 PM, Remy Lebeau said:

I don't really have an answer for you. All I can think of right now is either 1) maybe you still have old files on your system somewhere, or 2) maybe you didn't recompile/separate everything when switching between release and debug builds. 

 

 

Point #1

Before I started with the upgrade I seached for all Indy related files and and I searched all my drives. Before each Indy build I would also go and delete all DCUs, DCPs and BPLs.

 

Point #2

You made me think about what was happening so this weekend I realized that because I use a Build Group and each project in the Project group first builds the Debug then the Release I realized that because after each build per $(Config) the DCPs and BPLs are replaced. I am not sure which carries the signatures for the units. So obviously what would happen is that for instance IndySystem's DEBUG gets build then its RELEASE. So when it is IndyCore's turn its DEBUG gets build but references IndySystem's RELEASE DCP/BPL. Thats when the problem starts. So now I first finish building all the DEBUGS for all the projects first then I build the RELEASES for them and it works perfectly.

 

Thanks for your help and thanks for injecting some perspective here to guide me to the answer.

  • Like 1

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
×