IndySockets / Indy

Indy - Internet Direct
https://www.indyproject.org
460 stars 155 forks source link

Lazarus compile errors when using FPC 3.0.4a (last and most common stable) #274

Closed TommySlokky closed 1 year ago

TommySlokky commented 4 years ago

After having updated to Catalina + newest Cocoa source, I updated Indy as well (due to strange new errors with TSLV1 I did not experience on Mojave, so wondering if something changed regarding that in Catalina besides notarization/entitlements/symlink issues... but that is for another post if problems persists updating and researching further) and encountered some compile time errors inside IdGlobal.pas ...

Quote IdGlobal.pas(4607,57) Error: Typecast has different size (4 -> 8 ) in assignment at

Code: Pascal [Select] {$IFDEF THANDLE_64} Result := THandle(InterlockedExchange64(Int64(VTarget), Int64(AValue))); {$ENDIF}

and two of this

Quote IdGlobal.pas(8523,17) Error: Identifier not found "PRawByteString" at

Code: Pascal [Select] SetCodePage(PRawByteString(@Result)^, GetEncodingCodePage(ADestEncoding), False);

...

When I run "svn up" on my fprsrc directory it says 43661

---Speculation--

I believe this is because Indy assumes one is using FPC trunk? (where PRawByteString is defined) And not the stable 3.0.4a release. I am a bit hesitant upgrading FPC to a non-stable release...

The PRawByteString is an easy "hotfix" oneself, but if Indy now assumes {$IFDEF THANDLE_64} (maybe this changed in FPC 3.2.x / 3.3.x ?)

I guess that could leave to unforseen problems (by me) if not "hotfixed" correctly. Assuming this is a wontfix but I am not prepared to upgrade non-stable FPC, do you have recommendation if it is necessary to fix the define itself? Or just this one place in code?

Bi0T1N commented 4 years ago

I assume you've a 64bit CPU while your FPC version is 32bit. Is this correct? Maybe it's an issue with old FPC + Catalina? Or caused by the new IFDEF added from EMBT? Please post the output from fpc -vc.

TommySlokky commented 4 years ago

Been generating 64bit MacOS executables for a couple of years with my 64bit Mac computer using FPC/Lazarus. (Otherwise I would not even be able to run my apps on Catalina + not get 32bit warnings with my release builds. Apple started warning consumers about 32bit builds long time ago and AFAIK Catalina wont even run them.)

However, I found this post https://bugs.freepascal.org/view.php?id=21669 where THandle is still 32bit even if FPC compiler is for 64bit (and it seems to be on purpose, i.e. not an error that THandle is still 32bit there...)

That currently breaks with FPC64 on Mac, because THandle is not 64-bit.

Also just "Trunked" FPC source - same issue. I will post output later when on Mac, but my guess is IFDEF added from EMBT? is the culprit :)

Bi0T1N commented 4 years ago

That currently breaks with FPC64 on Mac, because THandle is not 64-bit.

Also just "Trunked" FPC source - same issue. I will post output later when on Mac, but my guess is IFDEF added from EMBT? is the culprit :)

The Compiler defines during compilation page from FPC says Mac OS is defined by BSD, DARWIN, UNIX which means that not directly the EMBT changes broke it but the following tweaks by defining {$DEFINE OSX}. Before BSD always defined {$DEFINE THANDLE_32} if not IOS.

TommySlokky commented 4 years ago

fpc/bin/x86-64-darwin/ directory fpc -vc

Macro defined: DARWIN Macro defined: UNIX Macro defined: BSD Macro defined: HASUNIX Macro defined: FPC_HAS_WINLIKERESOURCES Macro defined: CONSOLE Macro defined: DARWIN Macro defined: FPC Macro defined: VER3 Macro defined: VER3_0 Macro defined: VER3_0_4 Macro defined: RESSTRSECTIONS Macro defined: FPC_HASFIXED64BITVARIANT Macro defined: FPC_HASINTERNALOLEVARIANT2VARIANTCAST Macro defined: FPC_HAS_VARSETS Macro defined: FPC_HAS_VALGRINDBOOL Macro defined: FPC_HAS_STR_CURRENCY Macro defined: FPC_REAL2REAL_FIXED Macro defined: FPC_STRTOCHARARRAYPROC Macro defined: FPC_STRTOSHORTSTRINGPROC Macro defined: FPC_OBJFPC_EXTENDED_IF Macro defined: FPC_HAS_OPERATOR_ENUMERATOR Macro defined: FPC_HAS_CONSTREF Macro defined: FPC_STATICRIPFIXED Macro defined: FPC_VARIANTCOPY_FIXED Macro defined: FPC_DYNARRAYCOPY_FIXED Macro defined: FPC_HAS_INTERNAL_ABS_LONG Macro defined: FPC_HAS_INTERNAL_ABS_INT64 Macro defined: FPC_HAS_UNICODESTRING Macro defined: FPC_RTTI_PACKSET1 Macro defined: FPC_HAS_CPSTRING Macro defined: FPC_HAS_RIP_RELATIVE Macro defined: FPC_HAS_CEXTENDED Macro defined: FPC_HAS_RESSTRINITS Macro defined: FPC_HAS_INTERNAL_ROX Macro defined: FPC_HAS_INTERNAL_SAR Macro defined: FPC_HAS_MEMBAR Macro defined: FPC_SETBASE_USED Macro defined: INTERNAL_BACKTRACE Macro defined: STR_CONCAT_PROCS Macro defined: REGCALL Macro defined: FPC_HAS_FEATURE_SUPPORT Macro defined: CPUX86_64 Macro defined: CPUAMD64 Macro defined: CPU64 Macro defined: CPUX64 Macro MAC_OS_X_VERSION_MIN_REQUIRED set to 1080 Macro defined: ENDIAN_LITTLE Macro defined: FPC_LITTLE_ENDIAN Macro defined: FPC_ABI_DEFAULT Free Pascal Compiler version 3.0.4-r37149 [2019/01/29] for x86_64 Copyright (c) 1993-2017 by Florian Klaempfl and others

fpcsrc directory svn up

At revision 43671

(which should be trunk revision AFAIK)

... If/when a new Indy version is released I will make sure to test it and report back :)

TommySlokky commented 4 years ago

I would love to confirm it works after making the change myself. But now I am getting the following error in idStackunix.pas (701,21) Error. Identfier not found "FIONBIO". Line: fpioctl(Result, FIONBIO, @LValue); -- not sure if the error is related to the change in IDCompilerDefines.inc or just another error I have not discovered before

Bi0T1N commented 4 years ago

I would love to confirm it works after making the change myself. But now I am getting the following error in idStackunix.pas (701,21) Error. Identfier not found "FIONBIO". Line: fpioctl(Result, FIONBIO, @lvalue); -- not sure if the error is related to the change in IDCompilerDefines.inc or just another error I have not discovered before

Are you using the latest version of Indy? Should have been fixed with #273

rlebeau commented 4 years ago

I checked in a fix for the THANDLE_32 issue.

rlebeau commented 4 years ago

Is this still an open issue, or can it be closed now?