Recent

Author Topic: Compiling from windows to Mac OS  (Read 1310 times)

BornAgain

  • New Member
  • *
  • Posts: 20
Compiling from windows to Mac OS
« on: November 22, 2020, 08:55:56 pm »
I have written a Lazarus program on a Windows machine. My friend wants to use it on a Mac. I have never had the need to do this before, but I know Lazarus is supposed to permit compiling across platforms, but when I go to Project -> Project Options -> Config and Target, and choose MacOS from the scroll options under Target OS-T, I get the following message:

"The current FPC has no config file. It will probably miss some units. Check your installation of fpc," with OK and Ignore as the two options.

If I click on OK, I get the following message:

"The project uses target OS-macros and CPU=x86_64. The system.ppu for this target was not found in the FPC binary directories. Make sure fpc is installed correctly for this target and the fpc.cfg containss the right directories."

I don't know why fpc would not be intalled correctly. This is a new installation of Lazarus (Version 2.0.10, with FPC Version 3.2.0.

I would appreciate any help.

mr-highball

  • Full Member
  • ***
  • Posts: 217
    • Highball Github
Re: Compiling from windows to Mac OS
« Reply #1 on: November 23, 2020, 04:23:46 am »
You'll need to install a cross compiler (that's what the missing config is talking about). You should use fpcupdeluxe since it's very easy to use and setup all the cross compilers you want
https://github.com/LongDirtyAnimAlf/fpcupdeluxe

As far as the win -> mac I'm not sure if there are any special code signing processes involved to get a binary to run since I don't own a Mac, but the fp wiki has articles covering the steps
https://wiki.lazarus.freepascal.org/Portal:Mac

BornAgain

  • New Member
  • *
  • Posts: 20
Re: Compiling from windows to Mac OS
« Reply #2 on: November 23, 2020, 06:09:06 am »
Thank you. I will check them out.

BornAgain

  • New Member
  • *
  • Posts: 20
Re: Compiling from windows to Mac OS
« Reply #3 on: November 24, 2020, 12:58:58 am »
When I ran fpcupdeluxe, I am getting the following error message (attached). When I hit OK, the execution stops. I don't understand what this error means. I was hoping that executing fpcupdeluxe would provide the utility to install the compiler for mac OS, but I can't seem to get to that stage.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6818
  • Debugger - SynEdit - and more
    • wiki
Re: Compiling from windows to Mac OS
« Reply #4 on: November 24, 2020, 03:13:09 am »
I dont think it will work from a Windows PC.

According to the wiki, you must have XCode (afaik: assembler and linker, maybe some libs). The wiki gives some steps, how to get them copied to a Linux install (well some Linux distros, might not even work with others).
I doubt you will get them for Windows.

You can install a Linux virtual machine on your Win PC.
But you still must own a Mac, so you have access to XCode.

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1388
Re: Compiling from windows to Mac OS
« Reply #5 on: November 24, 2020, 07:52:24 am »
For sure you can cross from Windows to Mac. All fpcupdeluxe binaries are build on a Windows machine, including those for Mac.

About the fpcupdeluxe error.
I just have released a new version of fpcupdeluxe. This version should solve the issue you encountered.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/latest

A piece of advice.
Please install a win32 bit version of FPC and Lazarus when you want to cross-compile. This will give better results on other x86_64 systems due to some FPU-issues that find their cause on win64. Besides, you can easily build win64 binaries by using this win32 install.

https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2e/fpcupdeluxe-i386-win32.exe
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2e/fpcupdeluxe-x86_64-darwin-cocoa.zip

BornAgain

  • New Member
  • *
  • Posts: 20
Re: Compiling from windows to Mac OS
« Reply #6 on: November 24, 2020, 05:53:39 pm »
Thanks very much, @DonAlfredo. I will try them out.

BornAgain

  • New Member
  • *
  • Posts: 20
Re: Compiling from windows to Mac OS
« Reply #7 on: November 24, 2020, 09:52:32 pm »
I downloaded the revised fpcupdeluxe and tried to run it. This is the error I'm getting now (attached). It stops at Line #469: ($i secrets.inc).

BornAgain

  • New Member
  • *
  • Posts: 20
Re: Compiling from windows to Mac OS
« Reply #8 on: November 24, 2020, 10:02:09 pm »
A friend suggested that I save a blank file named secrets.inc and save it in the root of the fpcupdeluxe-1.8.2e folder. i did that and ran it again. It is running now! Will let you know if any errors pop up. Interesting that the blank file trick at least removed a hurdle and made it continue to execute. Don't know what other problems it might create..

BornAgain

  • New Member
  • *
  • Posts: 20
Re: Compiling from windows to Mac OS
« Reply #9 on: November 24, 2020, 10:31:41 pm »
OK, I thought the blank secrets.inc file trick was too good to be true. The program actually ran fine and gave me the options to choose my CPU (x86_64) and the OS I want to install the compiler for (Linux, because I didn't find an option for Mac OS-10). I then got a series of errors. Please see attachments named "revised fpcupdeluxe error" (1 through 4).

Was it the blank secrets.inc file? Help, please.

AL

  • Full Member
  • ***
  • Posts: 211
Re: Compiling from windows to Mac OS
« Reply #10 on: November 25, 2020, 02:51:24 am »
In your first post you mentionned you want to cross compile for MacOS.
Your atempt to install the cross compiler are for Linux.
You should select DARWIN from the CROSS menu in FpcUpDeluxe.
Also I have experienced strange errors when using FpcUpDeluxe with an existing Lazarus installation.
Try to install (with FpcUpDeluxe) a brand new set of Lazarus, FPC, and your Cross compiler (Darwin).
« Last Edit: November 25, 2020, 02:54:12 am by AL »
Laz 2.1.0, fpc 3.3.1, Win10
Laz 2.1.0, fpc 3.3.1, Mac OS Mojave running on VMWare
Laz 2.1.0  fpc 3.3.1 Ubuntu 20.04

BornAgain

  • New Member
  • *
  • Posts: 20
Re: Compiling from windows to Mac OS
« Reply #11 on: November 25, 2020, 05:01:45 am »
Yes, i could not find macOS. I suspected it might be Darwin, but since I want to cross compile to Linux also, I thought I'd try that anyway.

OK, I will uninstall my existing Lazarus, and try again. Thanks.

zoltanleo

  • Sr. Member
  • ****
  • Posts: 289
Re: Compiling from windows to Mac OS
« Reply #12 on: November 25, 2020, 08:41:01 am »
Hi BornAgain/

I tried to install the Darwin crosscompiler on Windows using fpcupDeluxe. But I got a message that it could not be installed.
So I installed the Darwin image on a virtual machine (vmware) and compile the projects there.

For Linux, the crosscompiler is installed and works correctly
Win10 LTSC x64/Deb 10 amd64/Darwin Cocoa:
Lazarus x32/x64 2.1(r.64226); FPC 3.3.1 (r.47808), FireBird 3.0.7

Sorry for my bad English, I'm using translator ;)

Seenkao

  • Full Member
  • ***
  • Posts: 115
Re: Compiling from windows to Mac OS
« Reply #13 on: November 25, 2020, 05:44:17 pm »
Ну а работоспособность как проверять?
Для этого всё равно нужен будет MacOS. Почему тогда на него не установить Lazarus?

google translate:
and how to check the performance?
For this, you will still need macOS. Why not install Lazarus on it then?

BornAgain

  • New Member
  • *
  • Posts: 20
Re: Compiling from windows to Mac OS
« Reply #14 on: November 25, 2020, 11:32:00 pm »
Thanks, @Zoltanleo. I can try I guess, but all this is going to be a first for me, unfortunately. Also, it does not appear that the crosscompiler for Linux is installed (in my version of Lazarus, anyway v 2.0.10), and i have had problems trying to install a compiler for Linux using fpcupdeluxe (as mentioned in my posts above).

So are you saying that you simply went to Project -> Project Options -> Config and Target, and choose "Linux" from the scroll options under Target OS-T, and you did not get any error? That's what I tried, but it gave me errors (as mentioned in my very first post).

If someone has any thoughts on the error messages I received (all in above post, but i can mention them again, if needed), I would appreciate it.

By the way, your translation service seems to work perfectly!
« Last Edit: November 25, 2020, 11:39:24 pm by BornAgain »

 

TinyPortal © 2005-2018