* * *

Author Topic: Lazarus Cocoa build failed in Mac OS Mojave 10.14  (Read 733 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: 73
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: 2019
    • 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: 396
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: 7087
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.
inline variables like in D10.3 are a bit like Brexit: if you are given the wrong information it sounds like a good idea. Every kid loves candy, but it makes you fat and your teeth will disappear.

CCRDude

  • Sr. Member
  • ****
  • Posts: 396
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: 2019
    • 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: 396
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).

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus