Is it possible to build a universal binary using exported C code?

Mac OSX specific forum
mrbungle
Enthusiast
Enthusiast
Posts: 112
Joined: Wed Dec 30, 2020 3:18 am

Is it possible to build a universal binary using exported C code?

Post by mrbungle »

For the Mac, is it possible to use the C output and actually import it into XCode and build it as a Universal binary or does there need to be additional work?

Thank you in advance.
Fred
Administrator
Administrator
Posts: 16617
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Is it possible to build a universal binary using exported C code?

Post by Fred »

You should be able to create universal binary using 2 different executables, I don't think you will need XCode
mrbungle
Enthusiast
Enthusiast
Posts: 112
Joined: Wed Dec 30, 2020 3:18 am

Re: Is it possible to build a universal binary using exported C code?

Post by mrbungle »

I see, so you are saying the ARM version of the Mac PB compiler will do this for you.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Is it possible to build a universal binary using exported C code?

Post by mk-soft »

I don't have a Mac with M1, so I can't compile programmes for M1.

To compile Universal programs, the Purebasic libraries would have to be compiled for Universal as well.
It would be nice to have the option for macOS to compile for Intel, M1 or Universal.
But for this, the Purebasic libraries would also have to be available in Intel, M1 and Universal.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
mrbungle
Enthusiast
Enthusiast
Posts: 112
Joined: Wed Dec 30, 2020 3:18 am

Re: Is it possible to build a universal binary using exported C code?

Post by mrbungle »

Thank you for clarifying. Happy to see that PB 6 is in beta for the M1. I don't have an M1 either but I am due for a computer upgrade later next year.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Is it possible to build a universal binary using exported C code?

Post by mk-soft »

mrbungle wrote: Thu Dec 02, 2021 2:40 pm Thank you for clarifying. Happy to see that PB 6 is in beta for the M1. I don't have an M1 either but I am due for a computer upgrade later next year.
There will be no upgrade for the time being, as I still need Intel. Virtualisation of Windows and Linux via Parallels.
My Mac Mini 2018 will have to stay with me for a very long time.

Info:
If you have a Mac with M1, you can install both PB v6.00 versions and compile them for Intel and M1.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Bitblazer
Enthusiast
Enthusiast
Posts: 732
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: Is it possible to build a universal binary using exported C code?

Post by Bitblazer »

Does anybody have experience with one of the virtual M1 server offers already? See for example https://www.computerworld.com/article/3 ... -hour.html
webpage - discord chat links -> purebasic GPT4All
Fred
Administrator
Administrator
Posts: 16617
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Is it possible to build a universal binary using exported C code?

Post by Fred »

I didn't tried yet, but according to this article, you should be able to create an universal binary with the lipo tool:

https://developer.apple.com/documentati ... cos-binary

Code: Select all

 lipo -create -output universal_app x86_app arm_app
User avatar
fsw
Addict
Addict
Posts: 1572
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Re: Is it possible to build a universal binary using exported C code?

Post by fsw »

If you have a Mac with M1, you can install both PB v6.00 versions and compile them for Intel and M1.
Would be nice to have 1 PB install but a compiler switch for all 3 binaries (Intel/AppleARM/Universal).

I am to provide the public with beneficial shocks.
Alfred Hitshock
User avatar
deseven
Enthusiast
Enthusiast
Posts: 362
Joined: Wed Jan 12, 2011 3:48 pm
Location: Serbia
Contact:

Re: Is it possible to build a universal binary using exported C code?

Post by deseven »

mk-soft wrote: Thu Dec 02, 2021 5:27 pmThere will be no upgrade for the time being, as I still need Intel. Virtualisation of Windows and Linux via Parallels.
My Mac Mini 2018 will have to stay with me for a very long time.
Well, Parallels 16 and 17 fully support M1 and you can install both Windows and Linux with it. ARM versions only, of course, but ARM version of Windows can run x86 executables just fine, some people even manage to game that way with a pretty decent experience, even on the slowest MacBook Air (for example check out this). I'd say you should be able to safely migrate to the new architecture in a couple of years without losing anything important.

(sorry for the off-topic)
Post Reply