Recent

Author Topic: Cocoa build hangs when choosing FPC sources  (Read 6166 times)

Clemens

  • New Member
  • *
  • Posts: 21
Cocoa build hangs when choosing FPC sources
« on: May 30, 2016, 06:13:04 pm »
Hi!

Thanks for the great work you are doing with Free Pascal and Lazarus.

I just used FPC 3.0+fixes to build Lazarus-trunk for Cocoa, which worked nicely.  I used this command:

Code: Pascal  [Select]
  1. make -j 1 bigide   INSTALL_PREFIX=~/src/fpc/lazarus-trunk-cocoa LCL_PLATFORM=cocoa

When I open startlazarus.app or lazarus.app, there is a problem, however.  Lazarus asks for the FPC sources on startup, but it hangs as shown in the screenshot.  None of the buttons or fields works, and I cannot quit it either.

I would like to use the 64bit version, because I want to link my program to a 64bit library.  I am very happy with Carbon Lazarus so far!

Cheers,
Clemens

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2269
    • havefunsoft.com
Re: Cocoa build hangs when choosing FPC sources
« Reply #1 on: May 30, 2016, 06:37:48 pm »
You can still Carbon Lazarus to building Cocoa-64 bit application - all you need is to switch Widgetset type in your project to "Cocoa", as well as CPU target to 64-bit.

There might be a problem with Cocoa LCL at the moment, that's causing Cocoa-IDE to hang.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

Clemens

  • New Member
  • *
  • Posts: 21
Re: Cocoa build hangs when choosing FPC sources
« Reply #2 on: May 30, 2016, 09:14:58 pm »
Thanks for the quick reply!

The good news is that building with
Code: Pascal  [Select]
  1. lazbuild --cpu=x86_64 --widgetset=cocoa Reconstructor.lpi
works.

The bad news is that setting the compiler options in Lazarus (32bit) does not work according to the instructions in the wiki.
Quote
a.) Choose the Project/ProjectOptions menu item
b.) In the CompilerOptions/CompilerCommands set the Compiler Command field to "/usr/local/bin/ppcx64"
c.) For CompilerOptions/ConfigAndTarget set the "Target CPU family" to "x86_64"
d.) For CompilerOptions/AdditionsAndOverrides store the "LCLWidgetType := cocoa" in the LPI

The reason is that in the form for "Compiler Commands", the file chooser doesn't work (although I can enter text); the form "Additions and Overrides" doesn't work at all.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2269
    • havefunsoft.com
Re: Cocoa build hangs when choosing FPC sources
« Reply #3 on: May 30, 2016, 09:18:28 pm »
Hmm... instructions seems to be outdated.

Specifically for the step b) you shouldn't need to specify "/usr/local/bin/ppcx64", instead you should be using "/usr/local/bin/fpc" at all time.

For the rest it looks good.

Since, building Cocoa-64 apps works for my Carbon-32  Lazarus, it should work for you either :)
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

Clemens

  • New Member
  • *
  • Posts: 21
Re: Cocoa build hangs when choosing FPC sources
« Reply #4 on: May 30, 2016, 09:23:45 pm »
Ok, I see regarding (b).

The show stopper for me is (d).  This form doesn't work for me at all (1.6 built for Carbon).

Alternatively, I could put the right lines into the lpi file, I guess, but what should I put there?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2269
    • havefunsoft.com
Re: Cocoa build hangs when choosing FPC sources
« Reply #5 on: May 30, 2016, 09:42:45 pm »
The show stopper for me is (d).  This form doesn't work for me at all (1.6 built for Carbon).
Could you please show what "doesn't work" actually mean?
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

ChrisR

  • Jr. Member
  • **
  • Posts: 84
Re: Cocoa build hangs when choosing FPC sources
« Reply #6 on: May 30, 2016, 10:18:08 pm »
You are right, the Additions and Overrides does not work correctly on 1.6 for OSX. You can hack it to work by pressing the widgetset button, pressing the down arrow a couple times and then hitting the return key, if you are lucky it will say "Cocoa', but if it says something else like "QT" you can click on the "QT" and use your keyboard to change the text.

By the way, this particular problem is fixed in the SVN trunk build. So one option is to use that. There are a couple patches that have been proposed but not yet entered into the SVN trunk. You may want to try these out regardless of whether you are using 1.6 or the SVN trunk.

TrackBar Patch http://bugs.freepascal.org/view.php?id=29089

Button Patch http://bugs.freepascal.org/view.php?id=30131

El Capitan (OSX 10.11) requires fps 3.0.2 to build 64-bit http://bugs.freepascal.org/view.php?id=30183

Clemens

  • New Member
  • *
  • Posts: 21
Re: Cocoa build hangs when choosing FPC sources
« Reply #7 on: May 30, 2016, 11:48:59 pm »
Thanks, I just compiled Lazarus-trunk and I nearly got it to work.  The file chooser in "Compiler Commands" and the whole "Additions and Overrides" work now in Lazarus-trunk.   8-)

So I changed the compiler command to my "fpc" (still 3.0.fixes); target CPU family (-P) to "x86_64", and the widget type to Carbon in "Additions and Overrides".

The lazbuild command works, but when I build from Lazarus itself I get errors in carbonproc.pp, see screenshot.


Clemens

  • New Member
  • *
  • Posts: 21
Re: Cocoa build hangs when choosing FPC sources
« Reply #8 on: May 30, 2016, 11:55:48 pm »
Thanks for the hint with El Capitan and 3.0.2.  I just checked the link and cannot reproduce the bug.  So my FPC 3.0.fixes is fine.   8-)

Clemens

  • New Member
  • *
  • Posts: 21
Re: Cocoa build hangs when choosing FPC sources
« Reply #9 on: May 31, 2016, 12:04:01 am »
My bad, I made a mistake in the settings.  Everything works from Lazarus trunk itself as it should.  Please ignore the last screenshot.   :)

Thanks!

Clemens

  • New Member
  • *
  • Posts: 21
Re: Cocoa build hangs when choosing FPC sources
« Reply #10 on: May 31, 2016, 05:36:04 pm »
Should I try to remove item (b) from the instructions in the wiki above?  I just checked that (b) is not needed.

Clemens

  • New Member
  • *
  • Posts: 21
Re: Cocoa build hangs when choosing FPC sources
« Reply #11 on: June 04, 2016, 05:37:43 pm »
I edited the cross-compiling instructions in the wiki and removed step (b).  Works for me.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1032
    • formatio reticularis
Re: Cocoa build hangs when choosing FPC sources
« Reply #12 on: June 04, 2016, 06:18:26 pm »
Thanks for updating the wiki.  :)
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.0.2 | FPC 3.0.4 | PPC, Intel, ARM | macOS, Windows, Linux