DPK and $IFDEF targeting

Is anyone experiencing Delphi 12.3+latest patch compiler failures when trying to compile components that use $IFDEF targeting in their CONTAINS & REQUIRES blocks?

I am seeing invalid contains and requires errors when compiling components. If the offending DPKs/DPROJs are found in a groupproj file then they are automatically removed following the errors.

The fix seems to be making separate DPKs for each target and remove the $IFDEFs. This is a royal pain as almost all of the components on my workstation and any new ones I want to install use targeting.

Is this an Athens bug, deprecated syntax or am I going crazy?

Could you include the relevant parts of files and the actual errors?

The IDE has never coped well with IFDEF’s in the contains or requires blocks - it’s a known issue (can’t find the relevant bug report but there have been many over the years).

One thing you should check is that the line endings are consistent in the file - I have seen the IDE completely mess things up due to mixed line endings.

I concur, it has never worked for me properly. I used to replace the dpk file instead

Rohit

Sure. Note that this type of error happens with all DPKs that have embedded targeting. I think there may also be an issue with $I include files in DPKs - at least Remy Lebeau thinks so. :upside_down_face:

Here is the error message:

Here is the source. I got Indy fresh off of GitHub:

package IndyProtocols290;

{$R *.res}
{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO OFF}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION OFF}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DEFINE DEBUG}
{$DEFINE VER360}
{$ENDIF IMPLICITBUILDING}
{$DESCRIPTION 'Indy 10 Protocols'}
{$RUNONLY}
{$IMPLICITBUILD OFF}

// RLebeau: cannot use IdCompilerDefines.inc here!

{$DEFINE HAS_PKG_RTL}
{$IFDEF NEXTGEN}
  {$IFDEF IOS}
    // there is no RTL package available for iOS
    {$UNDEF HAS_PKG_RTL}
  {$ENDIF}
{$ENDIF}

requires
  {$IFDEF HAS_PKG_RTL}
  rtl,
  {$ENDIF}
  IndySystem290,
  IndyCore290;

{$IFNDEF WINDOWS}
  {$IFDEF MSWINDOWS}
    {$DEFINE WINDOWS}
  {$ENDIF}
{$ENDIF}

contains
  IdASN1Util in 'IdASN1Util.pas',
  IdAllAuthentications in 'IdAllAuthentications.pas',
  IdAllFTPListParsers in 'IdAllFTPListParsers.pas',
  IdAllHeaderCoders in 'IdAllHeaderCoders.pas',
  IdAttachment in 'IdAttachment.pas',
  IdAttachmentFile in 'IdAttachmentFile.pas',
  IdAttachmentMemory in 'IdAttachmentMemory.pas',
  IdAuthentication in 'IdAuthentication.pas',
  IdAuthenticationDigest in 'IdAuthenticationDigest.pas',
  IdAuthenticationManager in 'IdAuthenticationManager.pas',
  IdAuthenticationNTLM in 'IdAuthenticationNTLM.pas',
  {$IFDEF WINDOWS}
  IdAuthenticationSSPI in 'IdAuthenticationSSPI.pas',
  {$ENDIF}
  IdBlockCipherIntercept in 'IdBlockCipherIntercept.pas',
  IdChargenServer in 'IdChargenServer.pas',
  IdChargenUDPServer in 'IdChargenUDPServer.pas',
  IdCharsets in 'IdCharsets.pas',
  IdCoder in 'IdCoder.pas',
  IdCoder00E in 'IdCoder00E.pas',
  IdCoder3to4 in 'IdCoder3to4.pas',
  IdCoderBinHex4 in 'IdCoderBinHex4.pas',
  IdCoderHeader in 'IdCoderHeader.pas',
  IdCoderMIME in 'IdCoderMIME.pas',
  IdCoderQuotedPrintable in 'IdCoderQuotedPrintable.pas',
  IdCoderUUE in 'IdCoderUUE.pas',
  IdCoderXXE in 'IdCoderXXE.pas',
  IdCompressionIntercept in 'IdCompressionIntercept.pas',
  IdCompressorZLib in 'IdCompressorZLib.pas',
  IdConnectThroughHttpProxy in 'IdConnectThroughHttpProxy.pas',
  IdContainers in 'IdContainers.pas',
  IdCookie in 'IdCookie.pas',
  IdCookieManager in 'IdCookieManager.pas',
  IdCustomHTTPServer in 'IdCustomHTTPServer.pas',
  IdDICT in 'IdDICT.pas',
  IdDICTCommon in 'IdDICTCommon.pas',
  IdDICTServer in 'IdDICTServer.pas',
  IdDNSCommon in 'IdDNSCommon.pas',
  IdDNSResolver in 'IdDNSResolver.pas',
  IdDNSServer in 'IdDNSServer.pas',
  IdDateTimeStamp in 'IdDateTimeStamp.pas',
  IdDayTime in 'IdDayTime.pas',
  IdDayTimeServer in 'IdDayTimeServer.pas',
  IdDayTimeUDP in 'IdDayTimeUDP.pas',
  IdDayTimeUDPServer in 'IdDayTimeUDPServer.pas',
  IdDiscardServer in 'IdDiscardServer.pas',
  IdDiscardUDPServer in 'IdDiscardUDPServer.pas',
  IdEMailAddress in 'IdEMailAddress.pas',
  IdEcho in 'IdEcho.pas',
  IdEchoServer in 'IdEchoServer.pas',
  IdEchoUDP in 'IdEchoUDP.pas',
  IdEchoUDPServer in 'IdEchoUDPServer.pas',
  IdExplicitTLSClientServerBase in 'IdExplicitTLSClientServerBase.pas',
  IdFIPS in 'IdFIPS.pas',
  IdFSP in 'IdFSP.pas',
  IdFTP in 'IdFTP.pas',
  IdFTPBaseFileSystem in 'IdFTPBaseFileSystem.pas',
  IdFTPCommon in 'IdFTPCommon.pas',
  IdFTPList in 'IdFTPList.pas',
  IdFTPListOutput in 'IdFTPListOutput.pas',
  IdFTPListParseAS400 in 'IdFTPListParseAS400.pas',
  IdFTPListParseBase in 'IdFTPListParseBase.pas',
  IdFTPListParseBullGCOS7 in 'IdFTPListParseBullGCOS7.pas',
  IdFTPListParseBullGCOS8 in 'IdFTPListParseBullGCOS8.pas',
  IdFTPListParseChameleonNewt in 'IdFTPListParseChameleonNewt.pas',
  IdFTPListParseCiscoIOS in 'IdFTPListParseCiscoIOS.pas',
  IdFTPListParseDistinctTCPIP in 'IdFTPListParseDistinctTCPIP.pas',
  IdFTPListParseEPLF in 'IdFTPListParseEPLF.pas',
  IdFTPListParseHellSoft in 'IdFTPListParseHellSoft.pas',
  IdFTPListParseIEFTPGateway in 'IdFTPListParseIEFTPGateway.pas',
  IdFTPListParseKA9Q in 'IdFTPListParseKA9Q.pas',
  IdFTPListParseMPEiX in 'IdFTPListParseMPEiX.pas',
  IdFTPListParseMVS in 'IdFTPListParseMVS.pas',
  IdFTPListParseMicrowareOS9 in 'IdFTPListParseMicrowareOS9.pas',
  IdFTPListParseMusic in 'IdFTPListParseMusic.pas',
  IdFTPListParseNCSAForDOS in 'IdFTPListParseNCSAForDOS.pas',
  IdFTPListParseNCSAForMACOS in 'IdFTPListParseNCSAForMACOS.pas',
  IdFTPListParseNovellNetware in 'IdFTPListParseNovellNetware.pas',
  IdFTPListParseNovellNetwarePSU in 'IdFTPListParseNovellNetwarePSU.pas',
  IdFTPListParseOS2 in 'IdFTPListParseOS2.pas',
  IdFTPListParsePCNFSD in 'IdFTPListParsePCNFSD.pas',
  IdFTPListParsePCTCP in 'IdFTPListParsePCTCP.pas',
  IdFTPListParseStercomOS390Exp in 'IdFTPListParseStercomOS390Exp.pas',
  IdFTPListParseStercomUnixEnt in 'IdFTPListParseStercomUnixEnt.pas',
  IdFTPListParseStratusVOS in 'IdFTPListParseStratusVOS.pas',
  IdFTPListParseSuperTCP in 'IdFTPListParseSuperTCP.pas',
  IdFTPListParseTOPS20 in 'IdFTPListParseTOPS20.pas',
  IdFTPListParseTSXPlus in 'IdFTPListParseTSXPlus.pas',
  IdFTPListParseTandemGuardian in 'IdFTPListParseTandemGuardian.pas',
  IdFTPListParseUnisysClearPath in 'IdFTPListParseUnisysClearPath.pas',
  IdFTPListParseUnix in 'IdFTPListParseUnix.pas',
  IdFTPListParseVM in 'IdFTPListParseVM.pas',
  IdFTPListParseVMS in 'IdFTPListParseVMS.pas',
  IdFTPListParseVSE in 'IdFTPListParseVSE.pas',
  IdFTPListParseVxWorks in 'IdFTPListParseVxWorks.pas',
  IdFTPListParseWfFTP in 'IdFTPListParseWfFTP.pas',
  IdFTPListParseWinQVTNET in 'IdFTPListParseWinQVTNET.pas',
  IdFTPListParseWindowsNT in 'IdFTPListParseWindowsNT.pas',
  IdFTPListParseXecomMicroRTOS in 'IdFTPListParseXecomMicroRTOS.pas',
  IdFTPListTypes in 'IdFTPListTypes.pas',
  IdFTPServer in 'IdFTPServer.pas',
  IdFTPServerContextBase in 'IdFTPServerContextBase.pas',
  IdFinger in 'IdFinger.pas',
  IdFingerServer in 'IdFingerServer.pas',
  IdGlobalProtocols in 'IdGlobalProtocols.pas',
  IdGopher in 'IdGopher.pas',
  IdGopherConsts in 'IdGopherConsts.pas',
  IdGopherServer in 'IdGopherServer.pas',
  IdHL7 in 'IdHL7.pas',
  IdHMAC in 'IdHMAC.pas',
  IdHMACMD5 in 'IdHMACMD5.pas',
  IdHMACSHA1 in 'IdHMACSHA1.pas',
  IdHTTP in 'IdHTTP.pas',
  IdHTTPHeaderInfo in 'IdHTTPHeaderInfo.pas',
  IdHTTPProxyServer in 'IdHTTPProxyServer.pas',
  IdHTTPServer in 'IdHTTPServer.pas',
  IdHash in 'IdHash.pas',
  IdHashCRC in 'IdHashCRC.pas',
  IdHashElf in 'IdHashElf.pas',
  IdHashMessageDigest in 'IdHashMessageDigest.pas',
  IdHashSHA in 'IdHashSHA.pas',
  IdHeaderCoder2022JP in 'IdHeaderCoder2022JP.pas',
  IdHeaderCoderBase in 'IdHeaderCoderBase.pas',
  IdHeaderCoderIndy in 'IdHeaderCoderIndy.pas',
  IdHeaderCoderPlain in 'IdHeaderCoderPlain.pas',
  IdHeaderList in 'IdHeaderList.pas',
  IdIMAP4 in 'IdIMAP4.pas',
  IdIMAP4Server in 'IdIMAP4Server.pas',
  IdIPAddrMon in 'IdIPAddrMon.pas',
  IdIPWatch in 'IdIPWatch.pas',
  IdIRC in 'IdIRC.pas',
  IdIdent in 'IdIdent.pas',
  IdIdentServer in 'IdIdentServer.pas',
  IdIrcServer in 'IdIrcServer.pas',
  IdLPR in 'IdLPR.pas',
  IdMailBox in 'IdMailBox.pas',
  IdMappedFTP in 'IdMappedFTP.pas',
  IdMappedPOP3 in 'IdMappedPOP3.pas',
  IdMappedPortTCP in 'IdMappedPortTCP.pas',
  IdMappedPortUDP in 'IdMappedPortUDP.pas',
  IdMappedTelnet in 'IdMappedTelnet.pas',
  IdMessage in 'IdMessage.pas',
  IdMessageBuilder in 'IdMessageBuilder.pas',
  IdMessageClient in 'IdMessageClient.pas',
  IdMessageCoder in 'IdMessageCoder.pas',
  IdMessageCoderBinHex4 in 'IdMessageCoderBinHex4.pas',
  IdMessageCoderMIME in 'IdMessageCoderMIME.pas',
  IdMessageCoderQuotedPrintable in 'IdMessageCoderQuotedPrintable.pas',
  IdMessageCoderUUE in 'IdMessageCoderUUE.pas',
  IdMessageCoderXXE in 'IdMessageCoderXXE.pas',
  IdMessageCoderYenc in 'IdMessageCoderYenc.pas',
  IdMessageCollection in 'IdMessageCollection.pas',
  IdMessageHelper in 'IdMessageHelper.pas',
  IdMessageParts in 'IdMessageParts.pas',
  IdMultipartFormData in 'IdMultipartFormData.pas',
  IdNNTP in 'IdNNTP.pas',
  IdNNTPServer in 'IdNNTPServer.pas',
  IdNTLM in 'IdNTLM.pas',
  IdNetworkCalculator in 'IdNetworkCalculator.pas',
  IdOSFileName in 'IdOSFileName.pas',
  IdOTPCalculator in 'IdOTPCalculator.pas',
  IdPOP3 in 'IdPOP3.pas',
  IdPOP3Server in 'IdPOP3Server.pas',
  IdQOTDUDP in 'IdQOTDUDP.pas',
  IdQOTDUDPServer in 'IdQOTDUDPServer.pas',
  IdQotd in 'IdQotd.pas',
  IdQotdServer in 'IdQotdServer.pas',
  IdRSH in 'IdRSH.pas',
  IdRSHServer in 'IdRSHServer.pas',
  IdRemoteCMDClient in 'IdRemoteCMDClient.pas',
  IdRemoteCMDServer in 'IdRemoteCMDServer.pas',
  IdReplyFTP in 'IdReplyFTP.pas',
  IdReplyIMAP4 in 'IdReplyIMAP4.pas',
  IdReplyPOP3 in 'IdReplyPOP3.pas',
  IdReplySMTP in 'IdReplySMTP.pas',
  IdResourceStringsOpenSSL in 'IdResourceStringsOpenSSL.pas',
  IdResourceStringsProtocols in 'IdResourceStringsProtocols.pas',
  IdResourceStringsSSPI in 'IdResourceStringsSSPI.pas',
  IdResourceStringsUriUtils in 'IdResourceStringsUriUtils.pas',
  IdRexec in 'IdRexec.pas',
  IdRexecServer in 'IdRexecServer.pas',
  IdSASL in 'IdSASL.pas',
  IdSASLAnonymous in 'IdSASLAnonymous.pas',
  IdSASLCollection in 'IdSASLCollection.pas',
  IdSASLDigest in 'IdSASLDigest.pas',
  IdSASLExternal in 'IdSASLExternal.pas',
  IdSASLLogin in 'IdSASLLogin.pas',
  IdSASLOAuth in 'IdSASLOAuth.pas',
  IdSASLOTP in 'IdSASLOTP.pas',
  IdSASLPlain in 'IdSASLPlain.pas',
  IdSASLSKey in 'IdSASLSKey.pas',
  IdSASLUserPass in 'IdSASLUserPass.pas',
  IdSASL_CRAMBase in 'IdSASL_CRAMBase.pas',
  IdSASL_CRAM_MD5 in 'IdSASL_CRAM_MD5.pas',
  IdSASL_CRAM_SHA1 in 'IdSASL_CRAM_SHA1.pas',
  IdSMTP in 'IdSMTP.pas',
  IdSMTPBase in 'IdSMTPBase.pas',
  IdSMTPRelay in 'IdSMTPRelay.pas',
  IdSMTPServer in 'IdSMTPServer.pas',
  IdSNMP in 'IdSNMP.pas',
  IdSNPP in 'IdSNPP.pas',
  IdSNTP in 'IdSNTP.pas',
  IdSSL in 'IdSSL.pas',
  IdSSLOpenSSL in 'IdSSLOpenSSL.pas',
  IdSSLOpenSSLHeaders in 'IdSSLOpenSSLHeaders.pas',
  {$IFDEF WINDOWS}
  IdSSPI in 'IdSSPI.pas',
  {$ENDIF}
  IdServerInterceptLogBase in 'IdServerInterceptLogBase.pas',
  IdServerInterceptLogEvent in 'IdServerInterceptLogEvent.pas',
  IdServerInterceptLogFile in 'IdServerInterceptLogFile.pas',
  IdSocksServer in 'IdSocksServer.pas',
  IdStrings in 'IdStrings.pas',
  IdSysLog in 'IdSysLog.pas',
  IdSysLogMessage in 'IdSysLogMessage.pas',
  IdSysLogServer in 'IdSysLogServer.pas',
  IdSystat in 'IdSystat.pas',
  IdSystatServer in 'IdSystatServer.pas',
  IdSystatUDP in 'IdSystatUDP.pas',
  IdSystatUDPServer in 'IdSystatUDPServer.pas',
  IdTelnet in 'IdTelnet.pas',
  IdTelnetServer in 'IdTelnetServer.pas',
  IdText in 'IdText.pas',
  IdTime in 'IdTime.pas',
  IdTimeServer in 'IdTimeServer.pas',
  IdTimeUDP in 'IdTimeUDP.pas',
  IdTimeUDPServer in 'IdTimeUDPServer.pas',
  IdTrivialFTP in 'IdTrivialFTP.pas',
  IdTrivialFTPBase in 'IdTrivialFTPBase.pas',
  IdTrivialFTPServer in 'IdTrivialFTPServer.pas',
  IdURI in 'IdURI.pas',
  IdUnixTime in 'IdUnixTime.pas',
  IdUnixTimeServer in 'IdUnixTimeServer.pas',
  IdUnixTimeUDP in 'IdUnixTimeUDP.pas',
  IdUnixTimeUDPServer in 'IdUnixTimeUDPServer.pas',
  IdUriUtils in 'IdUriUtils.pas',
  IdUserAccounts in 'IdUserAccounts.pas',
  IdUserPassProvider in 'IdUserPassProvider.pas',
  IdVCard in 'IdVCard.pas',
  IdWebDAV in 'IdWebDAV.pas',
  IdWhoIsServer in 'IdWhoIsServer.pas',
  IdWhois in 'IdWhois.pas',
  IdZLib in 'IdZLib.pas',
  IdZLibCompressorBase in 'IdZLibCompressorBase.pas',
  IdZLibConst in 'IdZLibConst.pas',
  IdZLibHeaders in 'IdZLibHeaders.pas';

end.

And the IDE Version info:

Thanks for the tip. I will check for line endings, but I thought that the IDE was supposed to automatically set them to CR/LF if it found an unexpected ending.