Compiling for other OS's

Everything else that doesn't fall into one of the other PB categories.
Hydrate
Enthusiast
Enthusiast
Posts: 436
Joined: Mon May 16, 2005 9:37 pm
Contact:

Compiling for other OS's

Post by Hydrate »

Well, I have had purebasic for quite some time now, and I know very well that I can download the versions for other OS's, but im curious, do I need the version of purebasic for that operating system in order to compile them? Or can I use the windows version of the compiler for MacOS and Linux? If so, how can I?
.::Image::.
User avatar
Azul
Enthusiast
Enthusiast
Posts: 109
Joined: Fri Dec 29, 2006 9:50 pm
Location: Finland

Post by Azul »

Windows version compiles for windows, linux for linux, etc ..

there has been several discussions about cross compiling (like windows -> linux) but I don't know does PB support it in future.
Brice Manuel

Post by Brice Manuel »

PureBasic doesn't support cross-compiling like GLBasic or RealBasic.

With PB, if you want to compile programs for OSX, you need a MAC with OSX installed and the OSX version of PB. If you want to compile programs for Linux, you need a PC running Linux and the Linux version of PB installed.
Hydrate
Enthusiast
Enthusiast
Posts: 436
Joined: Mon May 16, 2005 9:37 pm
Contact:

Post by Hydrate »

Well that sucks majorly, i dont have a mac pc to compile on... il have to emulate it or something now... thanks for the help.
.::Image::.
Brice Manuel

Post by Brice Manuel »

PB may not have a couple of features of some competitors, but overall, PB still blows away the competition. :wink:
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

Brice Manuel wrote:PB may not have a couple of features of some competitors, but overall, PB still blows away the competition. :wink:
Yes, but cross cimpiling could be a very interesting point.
merihevonen
Enthusiast
Enthusiast
Posts: 326
Joined: Mon Jan 01, 2007 7:20 pm

Post by merihevonen »

Well.. you could emulate Linux in QEMU if you want to compile your software for Linux, but then to compile for Mac OS X, you need to take some $$$..
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

An i-mac can be bought for about £100 on ebay. Not an x86 version, but still able to compile PureBasic programs on.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
merihevonen
Enthusiast
Enthusiast
Posts: 326
Joined: Mon Jan 01, 2007 7:20 pm

Post by merihevonen »

But let's be realistic: It would be cool to "compile for all" from just one Operating System, so you wouldn't need to go through the hassle of creating an eBay account and buying stuff that you probably won't use much :wink:

But a Compile-To-Linux-From-PureBasic-For-Windows function would be very positive to build, because I don't see anything to come in way :roll:
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

merihevonen wrote:But let's be realistic: It would be cool to "compile for all" from just one Operating System, so you wouldn't need to go through the hassle of creating an eBay account and buying stuff that you probably won't use much :wink:

But a Compile-To-Linux-From-PureBasic-For-Windows function would be very positive to build, because I don't see anything to come in way :roll:
Yes, afaik FASM can do it, but Fred can't as he said.
bye,
Daniel
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

To cross-compile, you need:
  • A cross-platform assembler (the smallest problem)
  • A cross-platform linker
  • All libraries needed to link for all OS (here it gets tough)
The last one is the biggest problem. Not only would we need to include all PureLibraries 3x
in the package, but also all OS libs. Now for windows this is easy, they are
included in the package anyway, but to compile on windows for linux for example, we would
have to include the libraries for the glibc, gtk (including all depencancies), sdl etc
in the windows version as well.
Apart from the fact that this is much to big a hassle for us to set up and maintain,
the next update would probably be about a hundred megs in size.

Cross-Compiling makes sense for languages who base their commands on their
own crossplatform toolkit, so there is only one big library to link in and thats it.
PureBasic uses directly the API of each OS, giving your program a native
look and feel on every OS with a very low executable size, but the price to pay are the dependencies on
the OS libraries (or on linux 3rd party toolkits like gtk) that make cross-compiling a nightmare (if not impossible)

Another effect of this is that the program might react a little different on each OS,
due to the usual differences between the OS.
(for example the default font size with gtk is usually much larger than the windows one)
So it is not a good idea to blindly compile a program for linux once it runs
on windows without even a single short test on the target OS.
Well, and if you need the OS for tests anyway, you can as well compile the program there.

This of course is different if a language uses its own toolkit
with the same font, same sizes etc on each OS and especially
with only minimal dependancies on other OS-specific libs.
That is where cross-compiling makes sense, but this is simply not what PB
is supposed to be.

To sum it up:
Due to the way PB is designed, cross-compiling does not really make sense.
quidquid Latine dictum sit altum videtur
Hydrate
Enthusiast
Enthusiast
Posts: 436
Joined: Mon May 16, 2005 9:37 pm
Contact:

Post by Hydrate »

Testing isnt an issue, I can send the compiled program with me to college and use the iBooks there, im running Ubuntu linux as it is so linux isnt an issue, but as I said im trying to compile for Mac, cant be done from windows = major problems. Can i emulate mac in any way if I can get my hands on a legal OS for it?
.::Image::.
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

There is the pearpc emulator: http://pearpc.sourceforge.net/
Also qemu can emulate a ppc processor: http://fabrice.bellard.free.fr/qemu/index.html

I did not try any of them though.
Remember that OSX 10.2 is the minimum requirement for PB if you try to get a cheap old version.
quidquid Latine dictum sit altum videtur
Post Reply