Recent

Author Topic: Cross compiling from OSX 10.11 El Capitan / x86_64 to other CPU driven OSX-es  (Read 5237 times)

TCH

  • Full Member
  • ***
  • Posts: 200
I would like to know, how can i cross-compile for ARM64, i386, PowerPC and PowerPC64. Currently:

- AMD64: Works perfectly.
- ARM64: Seems to work, the executable is created, but of course i cannot run it. Any ideas how to test, if that worked?
- i386: Error: ld: framework not found Cocoa Does it need a 32-bit version of Cocoa? Or maybe for i386, Carbon is the choice? If i set the widgetset to Carbon, then: Error: ld: framework not found Carbon Any idea what to do?
- PowerPC / PowerPC64: An error dialog saying fpc does not suppot powerpc-darwin / powerpc64-darwin. This is where FPC Deluxe comes into the picture? How? Any tutorials, tops on that?

Thanks in advance.
« Last Edit: October 10, 2023, 09:14:39 pm by TCH »

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1060
I would like to know, how can i cross-compile for ARM64, i386, PowerPC and PowerPC64. Currently:

- AMD64: Works perfectly.
- ARM64: Seems to work, the executable is created, but of course i cannot run it. Any ideas how to test, if that worked?
Only by running the binary on an ARM64 Mac. I'm not sure how you are compiling for ARM64 on a standard install of OS X 10.11/El Capitan though. It does not come with an SDK for macOS/ARM64. Maybe you meant macOS 11.0 instead?

Quote
- i386: Error: ld: framework not found Cocoa Does it need a 32-bit version of Cocoa? Or maybe for i386, Carbon is the choice? If i set the widgetset to Carbon, then: Error: ld: framework not found Carbon Any idea what to do?
If you are using macOS 11.0: that OS no longer comes with 32 bit libraries since it doesn't support 32 bit binaries. Install an SDK for macOS 10.14 or earlier from https://github.com/phracker/MacOSX-SDKs/releases and point FPC to it using the -XR command line parameter when compiling for i386
If you are using OS X 10.11: this suggests you did not install the command line tools as instructed in the "Getting Started" document shipped with the FPC installer and as mentioned on the download pages for FPC (e.g. https://sourceforge.net/projects/freepascal/files/Mac%20OS%20X/3.2.2/ ). After installing them, reinstall FPC.

Quote
- PowerPC / PowerPC64: An error dialog saying fpc does not suppot powerpc-darwin / powerpc64-darwin. This is where FPC Deluxe comes into the picture? How? Any tutorials, tops on that?
There are official FPC cross-compilers for those targets on the download pages. Additionally, you will need an SDK that still supports those architectures (e.g. the 10.4u or 10.5 SDKs from https://github.com/phracker/MacOSX-SDKs/releases ), and you will need Xcode command line tools that support those architectures (and then tell FPC where to find them with the -FD command line parameter). I don't know where you can still find those. They used to be distributed in packages called "cctools-old".

TCH

  • Full Member
  • ***
  • Posts: 200
Only by running the binary on an ARM64 Mac. I'm not sure how you are compiling for ARM64 on a standard install of OS X 10.11/El Capitan though. It does not come with an SDK for macOS/ARM64. Maybe you meant macOS 11.0 instead?
I meant OSX 10.11. I do not know, how the ARM64 binary was built, but it was built. I do not know if it is OK, or not.
If you are using OS X 10.11: this suggests you did not install the command line tools as instructed in the "Getting Started" document shipped with the FPC installer and as mentioned on the download pages for FPC (e.g. https://sourceforge.net/projects/freepascal/files/Mac%20OS%20X/3.2.2/ ). After installing them, reinstall FPC.
I did install the command line tools via xcode-select --install and it installed them, they are in Library/Developer/CommandLineTools. I tried to do sudo xcodebuild -license accept too, but it gave me back the error message of:
Code: [Select]
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instanceIf that was not the way it should be done, then i am open to suggestion how to properly install XCode 8.2.1. I cannot make an Apple ID, because it requires a phone number. Red flag.

But nowhere else i could find it. I've only found one torrent file, but no one seeds that.
There are official FPC cross-compilers for those targets on the download pages. Additionally, you will need an SDK that still supports those architectures (e.g. the 10.4u or 10.5 SDKs from https://github.com/phracker/MacOSX-SDKs/releases ), and you will need Xcode command line tools that support those architectures (and then tell FPC where to find them with the -FD command line parameter). I don't know where you can still find those. They used to be distributed in packages called "cctools-old".
Thanks, i'll look into this deeper.

TCH

  • Full Member
  • ***
  • Posts: 200
Okay, i retract this and apologise. It seems that somehow my machine updated itself to 11.0 Big Sur... The guy who gave me this laptop installed El Capitan on it. Great. Now i have to downgrade somehow.

dbannon

  • Hero Member
  • *****
  • Posts: 2854
    • tomboy-ng, a rewrite of the classic Tomboy
Okay, i retract this and apologise. It seems that somehow my machine updated itself to 11.0 Big Sur... The guy who gave me this laptop installed El Capitan on it. Great. Now i have to downgrade somehow.
If you downgrade to El Capitan, then you will no be able to build the Arm64 Apple Silicon binary. While I don't know what you are doing, I'd suggest the Apple Silicon binary is a lot more useful to you that the PowerPC or the i386 ones. But of course, you may have your reasons to think otherwise.

If you really need to support those old OS (Apple most certainly does not) then it sounds like a case for Virtual Machines on your Big Sur. You can get the Install kits from Apple Support (anything from 5G to 15G each), convert them to ISO files and use them to install VMs. The i386 one will run on your Mac under Virtual Box but I suggest you will need QEMU to run the PowerPC.  I have run PowerEL QEMU VMs on my reasonably gutsy Linux PC, not sure how you will go on your hardware. You do only need the command line to build but testing is another issue....

Maybe the early Intel OS had support for PowerPC ? It could run PowerPC binaries through an emulator. Be heaps easier if you could run Intel code in Virtual Box.

David
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

TCH

  • Full Member
  • ***
  • Posts: 200
I see. Then High Sierra it will be. Thanks for enlightening me.

I am just trying to support all existing Mac platforms as far i am capable of. I actually have PowerPC Macs here (a G4 and a G5) and a Tiger, but my flat is a mess now, i cannot really use them. This is why i try to do this from an intel Mac; i've read that Lazarus can actually compile for all five architectures. The ARM64 compiling was seemingly working, the i386 did not, but it turned out that because my machine upgraded itself somehow.
I've heard of FPCDeluxe, maybe i can do cross-compiling with that for PowerPC both 32 and 64-bit.

TRon

  • Hero Member
  • *****
  • Posts: 2679
I've heard of FPCDeluxe, maybe i can do cross-compiling with that for PowerPC both 32 and 64-bit.
I am not commenting on fpcupdeluxe as that is really not my area of expertise but I cross compile from intel 64 bit to arm, powerpc, m68k and z80 without issues. The problem is more in the availability of the required (bin)tools which usually depend on the target platform. If you can compile those for your host (and use them) then you there should be no problem. My experience with cross compiling for mac is literally none so i have no idea what tools are required (and if they compile for other hosts).

dbannon

  • Hero Member
  • *****
  • Posts: 2854
    • tomboy-ng, a rewrite of the classic Tomboy
FPCDeluxe is an installer, it will install the same compiler as you have now. If there is any sort of current cross compiler Intel to PowerPC it would install that for you too but you can do the same thing yourself.

There is "fpc-3.2.2.intel-macosx.cross.powerpc-macosx.dmg : FPC cross-compilers from Intel to 32 and 64 bit PowerPC" which may be what you want, might be worthwhile downloading and seeing what its readme files have to say. If its available, I guess the necessary tool chain exists.

https://sourceforge.net/projects/freepascal/files/Mac%20OS%20X/3.2.2/

Lazarus should be able to handle its part of a Cross Compile from Intel to PowerPC, but I bet no one has tried for some time.
 
But I'd be digging out that old hardware but there of course you will have to build your own Lazarus, again, should work, I had one going recently on IBM's PowerPC (ppc64el). But who knows ?

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Seenkao

  • Hero Member
  • *****
  • Posts: 552
    • New ZenGL.
У меня не утанавливались FPC/Lazarus на чистую машину, используя FPCUPDeluxe, до тех пор пока я не установил версию скачав установочные пакеты с SourceForge.

Google translate:
I didn't install FPC/Lazarus on a clean machine using FPCUPDeluxe until I installed the version by downloading the installation packages from SourceForge.
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

TCH

  • Full Member
  • ***
  • Posts: 200
All right, thanks for the tips everyone; currently High Sierra is installed and it can compile for both x86_64 and i386 and both works.

I've installed the cross-compile FPC for PowerPC, but when i try to compile the project, it says:
Code: [Select]
Error: /usr/local/bin/ppcppc can't be executed, error message: Failed to execute "/usr/local/bin/ppcppc", error code: -13Of course i've tried to run it from terminal and it did work. Both as root and regular user. I also tried to look up the net about what is error code -13, but found nothing.

As for ARM64, it fails with the error messages of
Code: [Select]
Error: clang: error: invalid Darwin version number: macosx11.0.0
Error: clang: error: invalid version number in '--target=arm64-apple-macosx11.0.0'
lazaruspackageintf.pas(104,0) Error: Error while assembling exitcode 1
I thought FreePascal compiles almost API-independent binaries, carrying everything within the binary. Is it possible to compile for a newer OSX, than i have, or i have to make my machine dual booting?

dbannon

  • Hero Member
  • *****
  • Posts: 2854
    • tomboy-ng, a rewrite of the classic Tomboy
....
As for ARM64, it fails with the error messages of
Code: [Select]
Error: clang: error: invalid Darwin version number: macosx11.0.0
Error: clang: error: invalid version number in '--target=arm64-apple-macosx11.0.0'
lazaruspackageintf.pas(104,0) Error: Error while assembling exitcode 1
I thought FreePascal compiles almost API-independent binaries, carrying everything within the binary. Is it possible to compile for a newer OSX, than i have, or i have to make my machine dual booting?
You definitely need, in Apple's opinion, Big Sur to compile to Apple Silicon. The FPC will do its bit but there is a lot more going on, particularly in xcode. Someone who knows more about Mac's might be be able to tell us how you can force a later xcode onto High Sierra but its way beyond me.

I recently picked up an old Mac Mini that can run Monterey because of exactly that ! This was after trying every trick in the book to make a VM with Big Sur and failing miserably. I want it for nothing more that the occasional build of the Apple versions of my app. Sigh....

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

TCH

  • Full Member
  • ***
  • Posts: 200
I see, it is not Lazarus, but XCode what is unable to build the binary for ARM. Thanks. Well, then dual boot it is.

TCH

  • Full Member
  • ***
  • Posts: 200
I've managed to do the dual boot setup: now i have High Sierra for making i386 binaries and Big Sur for making aarch64 ones, and x86_64 executables of course can be made on both systems...but the PowerPC building is still failing with error -13. What is that error? I found no docs on that. The crosscompilers are installed on both systems and if i call them manually from terminal, they print out their options.

Any ideas?

Josh

  • Hero Member
  • *****
  • Posts: 1304
i thought either leopard or snow leopard was the last mac os that supported powerpc g4etc, and xcode 3.?.? or was it 4. was the last xcode that compiled for it also.
I could be wrong but it must have been at least 10 years ago when i last tried it.
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

TCH

  • Full Member
  • ***
  • Posts: 200
I try to do cross-compiling. There is a PPC crosscompiler version of FPC for x86 Macs: http://downloads.freepascal.org/fpc/dist/3.2.2/i386-macosx/fpc-3.2.2.intel-macosx.cross.powerpc-macosx.dmg

BTW, can anyone confirm, that this ARM64 Mac binary runs on an ARM64 macOS? http://oscomp.hu/depot/testapp-big_sur-aarch64-crosscompiled.zip (Just an empty form for test. I can compile to Aarch64 on Big Sur, but i cannot run and test it.)

 

TinyPortal © 2005-2018