Recent

Author Topic: Lazarus Cocoa build failed in Mac OS Mojave 10.14  (Read 1912 times)

mohsenti

  • Jr. Member
  • **
  • Posts: 56
Lazarus Cocoa build failed in Mac OS Mojave 10.14
« on: October 27, 2018, 02:10:46 pm »
Hi
I'm a new MacOS user and I have compile FPC and Lazarus in MacOS 10.14.
FPC x86_64 and cross compile i386 built successful but Lazarus building with cocoa platform failed with below errors
Code: Pascal  [Select]
  1. cocoaprivate.pas(189,14) Error: There is no method in an ancestor class to be overridden: "acceptsFirstResponder:Boolean;"
  2. cocoaprivate.pas(195,14) Error: There is no method in an ancestor class to be overridden: "acceptsFirstMouse(NSEvent):Boolean;"
  3. cocoaprivate.pas(189,14) Error: Objective-C messages require their Objective-C selector name to be specified using the "message" directive.
  4. cocoaprivate.pas(195,14) Error: Mismatch between number of declared parameters and number of colons in message string.
  5. cocoaprivate.pas(254,14) Error: There is no method in an ancestor class to be overridden: "acceptsFirstResponder:Boolean;"
  6. cocoaprivate.pas(254,14) Error: Objective-C messages require their Objective-C selector name to be specified using the "message" directive.
  7. cocoaprivate.pas(273,14) Error: There is no method in an ancestor class to be overridden: "acceptsFirstResponder:Boolean;"
  8. cocoaprivate.pas(280,14) Error: There is no method in an ancestor class to be overridden: "acceptsFirstMouse(NSEvent):Boolean;"
  9. cocoaprivate.pas(273,14) Error: Objective-C messages require their Objective-C selector name to be specified using the "message" directive.
  10. cocoaprivate.pas(280,14) Error: Mismatch between number of declared parameters and number of colons in message string.
  11. cocoaprivate.pas(314,14) Error: There is no method in an ancestor class to be overridden: "acceptsFirstResponder:Boolean;"
  12. cocoaprivate.pas(325,14) Error: There is no method in an ancestor class to be overridden: "acceptsFirstMouse(NSEvent):Boolean;"
  13. cocoaprivate.pas(314,14) Error: Objective-C messages require their Objective-C selector name to be specified using the "message" directive.
  14. cocoaprivate.pas(325,14) Error: Mismatch between number of declared parameters and number of colons in message string.
  15. cocoaprivate.pas(366,1) Fatal: There were 14 errors compiling module, stopping
  16. Fatal: Compilation aborted
  17.  

And I built lazarus with
Quote
make LCL_PLATFORM="cocoa"
command.

Anyone have any solution for this problem ?
« Last Edit: October 27, 2018, 04:32:06 pm by mohsenti »

ChrisR

  • Jr. Member
  • **
  • Posts: 75
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #1 on: October 27, 2018, 04:18:51 pm »
I have 10.13, not 10.14, but I just built the latest SVN using the following commands:

$ svn up
Updating '.':
U    lcl/interfaces/cocoa/cocoawinapi.inc
U    lcl/interfaces/cocoa/cocoagdiobjects.pas
U    lcl/interfaces/cocoa/cocoautils.pas
Updated to revision 59373.
$make LCL_PLATFORM=cocoa CPU_TARGET=x86_64 clean bigide
...
$startlazarus

mohsenti

  • Jr. Member
  • **
  • Posts: 56
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #2 on: October 27, 2018, 04:33:30 pm »
Thank you ChrisR,
I test your solution but it's not work in MacOS 10.14.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2039
    • havefunsoft.com
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

mohsenti

  • Jr. Member
  • **
  • Posts: 56
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #4 on: October 28, 2018, 10:58:15 am »
thank you skalogryz.

I think after Dark mode theme added  to MacOS, they change cocoa api and this changes break LCL cocoa platform.

CCRDude

  • Sr. Member
  • ****
  • Posts: 468
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #5 on: October 31, 2018, 01:14:00 pm »
I've got the same problem; trunk both fpc & Lazarus, cross-compiling from Windows.

The link by @skalogryz is not helpful here; the error appears in CocoaPrivate.pas, which is part of the LCL; but it refers to ancestors in NSControl -> NSView -> NSResponder, which are defined in FPC package cocoaint.

Digging further, the return type of these two functions is bad. In FPC, it's BOOL = boolean8; in LCL, it's Boolean.

So break is totally within the FPC/Lazarus world, not Dark Mode / Mojave related.

Thaddy

  • Hero Member
  • *****
  • Posts: 7337
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #6 on: October 31, 2018, 01:22:05 pm »
There are currently more problems with 32 bit targets due to FPC rev 39986.
Brexit. My Indonesian and Dutch friends know what " Tempo doeloe" means....There is no empire.

CCRDude

  • Sr. Member
  • ****
  • Posts: 468
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #7 on: October 31, 2018, 02:02:34 pm »
Good that I haven't tried 32 bit yet :D

For the issue of the OP, I have tried to replace boolean with boolean8 in the LCL units. It will compile after replacing quite a bunch, but I guess that was a bit too simple. My compiled application does not accept keyboard input into an InputQuery, which I could imagine - based on the affected methods - might be a result of this.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2039
    • havefunsoft.com
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #8 on: October 31, 2018, 02:39:47 pm »
.. trunk .. fpc
...
In FPC, it's BOOL = boolean8; in LCL, it's Boolean.
:'(  :'(  :'(
source level compatibility is broken.

is it possible to use 3.0.4 ? (3.0.4a?)
« Last Edit: October 31, 2018, 02:43:36 pm by skalogryz »
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

CCRDude

  • Sr. Member
  • ****
  • Posts: 468
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #9 on: November 02, 2018, 09:49:19 am »
Just wanted to add that my keyboard issues were coming from the compiled file running in terminal. Once wrapped into a .app, everything works fine. Which means the workaround mentioned is working on x86_64-darwin (not tested other modes).

MISV

  • Sr. Member
  • ****
  • Posts: 493
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #10 on: November 27, 2018, 01:33:46 am »
I have now reported the cocoaprivate issue here: https://bugs.freepascal.org/view.php?id=34609

Hopefully someone will roll back the changes or fix this - but at least now the problem has been reported :(

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2039
    • havefunsoft.com
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #11 on: December 05, 2018, 04:58:09 pm »
Could anyone test r59725, please?
The fix needs to go with the Lazarus release.
It's quite important for LCL to compile with both 3.0.4 (the latest stable FPC) release as well as with FPC trunk (as the most proper compiler version for mac)
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

josh

  • Hero Member
  • *****
  • Posts: 700
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #12 on: December 05, 2018, 07:35:07 pm »
Just tried install of cocoa 64 bit on trunk lap and fpc.
but get error
Code: [Select]
/Users/josh/lazarus_trunk_cocoa/lazarus/lcl/interfaces/./cocoa/cocoatextedits.pas(585,8) Warning: (4040) Class types "NSTextDelegateProtocol" and "NSObject" are not related
/Users/josh/lazarus_trunk_cocoa/lazarus/lcl/interfaces/./cocoa/cocoatextedits.pas(592,40) Warning: (4040) Class types "NSTextDelegateProtocol" and "NSObject" are not related
(3104) Compiling ./cocoa/cocoawindows.pas
/Users/josh/lazarus_trunk_cocoa/lazarus/lcl/interfaces/./cocoa/cocoawindows.pas(403,41) Error: (3069) Call by var for arg no. 3 has to match exactly: Got "Boolean8" expected "Boolean"
cocoawindows.pas(1339) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
cocoawindows.pas(1339) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: /Users/josh/lazarus_trunk_cocoa/fpc/bin/x86_64-darwin/ppcx64 returned an error exitcode
Error: (lazarus) Compile package LCL 2.1: stopped with exit code 256
Error: (lazarus) [TLazPackageGraph.CompileRequiredPackages] "Exit code 256"
Error: (lazarus) Building IDE: Compile AutoInstall Packages failed.
make: *** [useride] Error 2
fpcupdeluxe: ERROR: LazarusNativeInstaller (BuildModuleCustom: UserIDE): make returned error code #512
fpcupdeluxe: ERROR: LazarusNativeInstaller (BuildModuleCustom: UserIDE): make returned error code #512


ERROR: Fpcupdeluxe fatal error !

Does that help.

I will try a fresh install
« Last Edit: December 05, 2018, 07:36:39 pm by josh »
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

CCRDude

  • Sr. Member
  • ****
  • Posts: 468
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #13 on: December 05, 2018, 07:41:02 pm »
I was trying fpcupdeluxe with trunk/trunk as well as fixes3.2/trunk on macOS High Sierra today and got:
Quote
/Developer/lazarus/lazarus/lcl/interfaces/./cocoa/cocoawindows.pas(403,41) Error: (3069) Call by var for arg no. 3 has to match exactly: Got "Boolean8" expected "Boolean"
cocoawindows.pas(1339) Fatal: (10026) There were 1 errors compiling module, stopping

Same on Windows 10 cross-compiling for Darwin/Cocoa with trunk/trunk.

CCRDude

  • Sr. Member
  • ****
  • Posts: 468
Re: Lazarus Cocoa build failed in Mac OS Mojave 10.14
« Reply #14 on: December 05, 2018, 07:45:30 pm »
This does not seem trivial to fix, since LclObjCBoolean is defined in CocoaPrivate, but required in the interface of CocoaUtils, causing a circular unit reference.

Furthermore, Cocoa_Extra already has an 8 bit ObjCBool. Two different boolean types in two different units with different prefixes do not look like a good idea.