Recent

Author Topic: OSX 64bit [SOLVED]  (Read 9089 times)

kevin.black

  • Full Member
  • ***
  • Posts: 122
OSX 64bit [SOLVED]
« on: January 11, 2019, 01:23:02 am »
Firstly the blow smoke - I have always been impressed at the effort, complexity, simplicity put into this project basically as a free environment - it is nothing short of amazing. Was a Lazarus developer many years ago, moved to Delphi.

Please bear with me.

Background:

I am coming from the Delphi world after converting an application and DLLs to FMX then trying to port to OSX. There is no 64bit compiler in Delphi. The experience on the Mac side has been frustrating and what should have been a fairly simple conversion has turned into a mini-nightmare wasting several weeks and getting nowhere. Sometimes the code works, then I get, for example, and Access Violation at load time (DYLIB loads, simple test app generates AV). There is essentially no debug info and I don't even get the log.d statement from the Application Initialize Block.  OK I get it TL;DR

So, many year ago i was a Lazarus guy and went over to commercial Delphi. I am now thinking I should be back in the Lazarus camp, you operate native on OSX. That's great, but my knowledge is limited. Because I will be writing DYLIBs that need to be accessed by other developers using ObjectiveC and SWIFT, I need 64 bit DYLIBs and apps. Delphi does not have a 64 bit compiler and not due until whenever (taken off the roadmap).

Pardon my ignorance, but I see comments like ... yes, Lazarus is 64 bit, but not for LCL? I thought the LCL was the basis of Lazarus (as is VCL/FMX for Delphi). What does this even mean?

FWIW, I'm running High Sierra and Xcode 9.4.1 because Delphi doesn't run on Mojave and it has issues with SDK 14 (which is the only option if you install Xcode 10), all on a Parallels VM.

Questions:

I guess my initial question is quite simple, can I build 64bit apps on their OSX deployed version of Lazarus?

Do I need to do anything to invoke the 64bit compiler or is that what will be used if I build on OSX?

I converted my Apps/DLLs/DYLIBs to FMX for the cross-platform options, meh. I see comments like the converter will not convert FMX only VCL.

How do you recommend that I do the conversion, do I just plunk the code into a Lazarus library or unit and build removing errors one by one?

I have some libraries where there are Lazarus equivalents (TMS FMX/VCL/LCL Cloud Pack, the TMS people are unhelpful if you do anything like put their units in a DLL/DYLIB - we have never done that, we have had no demand, it's too complicated....), and some where there are not, for example I use TMutithread in a DLL/DYLIB. I am hoping there are LCL equivalents.

I am sure I will have many other questions, but for now...

Thanks,
Kevin
« Last Edit: January 14, 2019, 04:41:26 am by kevin.black »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5404
    • wiki
Re: OSX 64bit
« Reply #1 on: January 11, 2019, 02:24:10 am »
I can only answer some of this, since I am not using Mac myself...

The " Lazarus is 64 bit, but not for LCL" is probably from a bit ago.

Lazarus used to have only lcl-carbon (32bit) but not lcl for cocoa (64bit).
In recent month lcl for cocoa made huge progress.  Lazarus 2.0 has cocoa support included.
Though it is still all new, and the need for more fixes will have to be expected.

So yes, if you install the 2.0RC3 you have 32 and 64 bit compiler included. And you can choose in your project settings which one you are building.  (LCL for both)

I am not sure if the IDE is prebuild 64 or 32 bit. If you do a lot of 64 bit you may want to rebuild the IDE (if indeed needed).
Especially because the 32 bit IDE has issues debugging 64 bit targets (but the 64bit IDE should do fine with 64 and 32 bit targets. Saying that the debugger is also brand new. Well there is the old one too.
- The old one based on gdb, needs some work to setup (self build of gdb and codesign).
- The new one works with lldb, you only need to make 2 config entries (choose the lldb debugger (lldb+fpdebug), and tell it where your lldb is /usr/bin/lldb )

The other questions I have to leave to others to answer.

Wallaby

  • New member
  • *
  • Posts: 20
Re: OSX 64bit
« Reply #2 on: January 11, 2019, 05:10:46 am »
I believe FPC was able to generate 64-bit macOS binaries a long time ago, including DYLIBs. I am myself moving away from Delphi and their CrappyMonkey framework.

Just recently I was able to produce a GUI app for Windows 32/64, Linux 32/64 and macOS 32/64. The latter is built on Cocoa, which seems to be fairly stable in the upcoming 2.0 release.

All in all you should have no problems with 64-bit macOS binaries, though like you guessed things may get complicated with putting third-party stuff in DYLIBs.

kevin.black

  • Full Member
  • ***
  • Posts: 122
Re: OSX 64bit
« Reply #3 on: January 11, 2019, 06:14:48 am »
@Martin_fr Thank you. That answers the basic question which is does this do 64Bit and the answer is yes, job done

     So yes, if you install the 2.0RC3 you have 32 and 64 bit compiler included. And you can choose in your project settings which one you are building.  (LCL for both)

I did install 2.0RC3 and got confused with the instructions to install GDB (which it looks like aren't necessary). Again thanks....

@wallaby

     I am myself moving away from Delphi and their CrappyMonkey framework.

I quite like Delphi and I don't really hav an issue with FMX other than it doesn't work (I suppose that's a big enough issue) with OSX. Any DYLIB I had cashed with unable to Register FMXApplicationDelegate. Embarcadero said it was an Apple bug, great, I'll just get Tim Cook to fix up his crap OS so I can build my software. Every time I make a break through (like for instance Authenticating Dropbox on OSX) I get things like the AV issue or the other one I'm getting is TWebBrowser is already registered. These seem like simple issues, but I am literally wasting weeks trying to overcome them. The apps build and run fine on Win32 and Win64 (the whole point was a cross-platform development), but there is grief with OSX. Look thanks for responding, provides me with some encouragement to sink the time and effort into lazarus.

So it looks like I'm in a similar position to you and now that

zeljko

  • Hero Member
  • *****
  • Posts: 1045
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: OSX 64bit
« Reply #4 on: January 11, 2019, 09:36:24 am »
If you need stable OSX 64bit application then you can use Qt5 for mac until cocoa 64bit is mature - I'm using Qt5 on mac for my commercial applications and it works like a charm.

kevin.black

  • Full Member
  • ***
  • Posts: 122
Re: OSX 64bit
« Reply #5 on: January 12, 2019, 02:57:03 am »
@zeljko,

Thank you for the advice, I will certainly give it a go.

I note the earlier comment:

        So yes, if you install the 2.0RC3 you have 32 and 64 bit compiler included. And you can choose in your project settings which one you are building.  (LCL for both).

Firstly, is it as simple as a compiler setting to switch to QT5 as suggested above and secondly: I have looked at the project settings and (may be I'm just super dumb) I cannot find anywhere where you specify the compiler (32/64 bit)? Can you advise which actual setting?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5404
    • wiki
Re: OSX 64bit
« Reply #6 on: January 12, 2019, 01:39:47 pm »
Firstly, is it as simple as a compiler setting to switch to QT5 as suggested above and secondly: I have looked at the project settings and (may be I'm just super dumb) I cannot find anywhere where you specify the compiler (32/64 bit)? Can you advise which actual setting?

Project > Project Options
then "Config and Target", choose the "cpu familly" x86_64

Click "select lcl widgetset" and set it to cocoa or qt

zeljko

  • Hero Member
  • *****
  • Posts: 1045
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: OSX 64bit
« Reply #7 on: January 12, 2019, 03:35:38 pm »
@zeljko,

Thank you for the advice, I will certainly give it a go.

I note the earlier comment:

        So yes, if you install the 2.0RC3 you have 32 and 64 bit compiler included. And you can choose in your project settings which one you are building.  (LCL for both).

Firstly, is it as simple as a compiler setting to switch to QT5 as suggested above and secondly: I have looked at the project settings and (may be I'm just super dumb) I cannot find anywhere where you specify the compiler (32/64 bit)? Can you advise which actual setting?

Martin answered about compiler switch, but you should choose qt5 not qt widgetset. Before that you must download Qt5 libs for mac and build libQt5Pas.framework. I'm using Qt5-5.9.6 LTS (not 5.12.0 LTS which will be first choice in qt5 downloads - do not use it yet).
1.Download Qt5-5.9.6 and double click dmg file, install it in your home.
2.svn co lazarustrunk
3.go to lcl/interfaces/qt5/cbindings and
  1. /Users/USERNAME/Qt5-5.9.6/5.9.6/clangx64/bin/qmake -query
     * see output if everything is correct
  2./Users/USERNAME/Qt5-5.9.6/5.9.6/clangx64/bin/qmake
    * now Makefile is created
  3.make && make install

4.Now your libQt5Pas.framework is in /Users/USERNAME/Qt5-5.9.6/5.9.6/lib and you must copy it to the /Library/Frameworks

5.sudo copy -aR Qt5Pas.framework /Library/Frameworks

That's it. Now you can build your app against qt5. Now when your qt5 app is compileable you can rebuild complete IDE against qt5 - it'll work out of the box.
For deployment I'm using macqtdeploy.sh from qt5-5.9.6 installation so I don't need to install Qt5 on client machine, all needed gui libs are inside project bundle.



VTwin

  • Hero Member
  • *****
  • Posts: 665
  • Former Turbo Pascal 3 user
Re: OSX 64bit
« Reply #8 on: January 12, 2019, 05:00:43 pm »
I have been using 64 bit cocoa extensively, there have been many advances recently. I am using 2.0.0R3 on svn fixes and regularly check for updates. The cocoa IDE still has some shortcomings (for which I have posted bug reports), but is in pretty good shape.

I tried Qt as zeljko suggests, but decided to stick with cocoa.

For Windows and Linux I am still using 1.8.4 64 bit on VirtualBox.
« Last Edit: January 12, 2019, 05:14:45 pm by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.11.6: Lazarus 2.1.0 svn 61357M (64 bit Cocoa trunk)
Ubuntu 18.04.2: Lazarus 2.0.0 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.0 (64 bit on VBox)

dsiders

  • Full Member
  • ***
  • Posts: 208
Re: OSX 64bit
« Reply #9 on: January 12, 2019, 05:32:58 pm »
I tried Qt as zeljko suggests, but decided to stick with cocoa.

QT5 on Windows? If yes, can you suggest the steps needed to get a working QT5 setup?
Lazarus 2.0.2 / FPC 3.0.4 / Windows 8.1 64-bit

VTwin

  • Hero Member
  • *****
  • Posts: 665
  • Former Turbo Pascal 3 user
Re: OSX 64bit
« Reply #10 on: January 12, 2019, 06:59:40 pm »
I tried Qt as zeljko suggests, but decided to stick with cocoa.

QT5 on Windows? If yes, can you suggest the steps needed to get a working QT5 setup?

No, I do not use Qt at all. I use the default widget sets on Windows and Linux. I experimented with Qt, but found it overly complicated (for me at least) to set up, and the native widget set works fine (for me anyway).
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.11.6: Lazarus 2.1.0 svn 61357M (64 bit Cocoa trunk)
Ubuntu 18.04.2: Lazarus 2.0.0 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.0 (64 bit on VBox)

Trenatos

  • Hero Member
  • *****
  • Posts: 501
  • Software developer - Open source contributor
    • MarcusFernstrom.com
Re: OSX 64bit
« Reply #11 on: January 12, 2019, 08:26:24 pm »
My main computer is a MacBook Pro.

I use FPC and Lazarus to build x64 applications for OSX, Windows, and Linux (I cross compile from the mac).

Both GUI and terminal applications, btw.

I set it up with FPCUpDeluxe (Grab the x64 Cocoa version) and add cross compiler using that too.

I USUALLY go with Trunk for both FPC and Laz, but once in a while something is out of whack and broken, so I have to go with some other version, or even stable.

zeljko

  • Hero Member
  • *****
  • Posts: 1045
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: OSX 64bit
« Reply #12 on: January 12, 2019, 09:06:25 pm »
I tried Qt as zeljko suggests, but decided to stick with cocoa.

QT5 on Windows? If yes, can you suggest the steps needed to get a working QT5 setup?

For windows: just install Qt5-5.9.6 on your devel machine and pick up libQt5Pas1.dll from lazarus binaries. Copy libQt5Pas1.dll into directory where Qt5 installed it's dll's , usually it's C:\PATHTOQT5\mingw32\lib and add such directory to the path. Now you can build qt5 binaries ...
NOTE: if you decide to move qt5 dll-s into separate directory do not forget to copy plugins directory otherwise Qt5 app won't start , error message will be "cannot load platform plugin" (or something like that).

dsiders

  • Full Member
  • ***
  • Posts: 208
Re: OSX 64bit
« Reply #13 on: January 12, 2019, 09:15:10 pm »
QT5 on Windows? If yes, can you suggest the steps needed to get a working QT5 setup?

For windows: just install Qt5-5.9.6 on your devel machine and pick up libQt5Pas1.dll from lazarus binaries. Copy libQt5Pas1.dll into directory where Qt5 installed it's dll's , usually it's C:\PATHTOQT5\mingw32\lib and add such directory to the path. Now you can build qt5 binaries ...
NOTE: if you decide to move qt5 dll-s into separate directory do not forget to copy plugins directory otherwise Qt5 app won't start , error message will be "cannot load platform plugin" (or something like that).

Thanks. I'll try this when I can.
Lazarus 2.0.2 / FPC 3.0.4 / Windows 8.1 64-bit

kevin.black

  • Full Member
  • ***
  • Posts: 122
Re: OSX 64bit
« Reply #14 on: January 14, 2019, 01:37:49 am »
@Trenatos,

I set it up with FPCUpDeluxe (Grab the x64 Cocoa version) and add cross compiler using that too.

I USUALLY go with Trunk for both FPC and Laz, but once in a while something is out of whack and broken, so I have to go with some other version, or even stable.
Again, pardon the simplistic questions from a newbie to Lazarus and note I'm running this from macOS  High Sierra:

From what you post, the FPCUPDelux is a GUI way to keep lazarus updated with the latest releases, is that correct?

So to use these features:
  • I download the source and build the FPCUPDelux project
  • I then run the App which updates Lazarus/FPC

When I try to build the project (i386/Carbon) I get an error because of a missing inc file ({$I message.inc}). If I switch to x86-64 with Cocoa, it builds for a while and then comes up with the same error in Unit fpcdeluxemainfom. I have searched the complete download and there is definitely no message.inc file. I can create a dummy file, but I'm thinking message.inc probably has useful messages.

For a newbie, this makes it difficult.

Can you suggest where/how the message.inc file is or possibly even send me a copy?

Thanks...