Compile for foreign systems.
Compile for foreign systems.
At the moment i must run purebasic in the os-version, which i want to use. But it would be very usefull, when i coul compile a linux, macos, win64-Version under Win32.
Simple example - i have a programm for all this os - now i found a bug and it could be simple solved by a additional if-statement - nothing os specific code. But now i musst start every os, that i want support.
Or i want support macos - i found someone with a mac and he will test for me - but i cant create a testversion.
Simple example - i have a programm for all this os - now i found a bug and it could be simple solved by a additional if-statement - nothing os specific code. But now i musst start every os, that i want support.
Or i want support macos - i found someone with a mac and he will test for me - but i cant create a testversion.
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Compile for foreign systems.
I would like to be able to do so too, but I think it is just far too big a task for PB, especially given that all the OS's are moving targets. It's pretty well impossible to have 'neutral' code to suit all platforms anyway, you generally have to supplement your core code with platform specific bits and pieces to get it just right.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
Re: Compile for foreign systems.
simple use compilerif #pb_compiler_os=#pb_compiler_os_windos (maybe the constant have other names) and you can specific code for the diffrent systems. Big parts of my code is os-independent - when i change something in this part, i must always boot the needed os...
Re: Compile for foreign systems.
Sorry, not going to happen.
To be able to do this, every PB installation would need to include:
- the compiled libraries for all target platforms (simple, only takes some disk space)
- the pbcompiler with backends for all target platforms (again, rather simple)
- a cross-assembler for the target platforms (simple for linux as fasm can do this, not so simple for OSX)
- a cross-linker for the target platforms (didn't look into that one honestly)
- all required OS libraries of the target platforms to link against
The last one is the problematic one.
Lets take OSX:
We cannot ship OSX libraries with PureBasic for Windows because they are proprietary software. I don't think Apple would like that very much.
And Linux:
While this should be possible in theory its pretty much impossible in practice: We would need to include all binaries for gtk, sdl, libc, and many more including all dependencies in the PureBasic package. Not to speak of the fact, that these libraries don't exist in a cross-compilation ready fashion afaik. So while possible in the pure theory, we would be talking about a huge nightmare for us and a resulting PB installation that requires a DVD to fit, all so you can compile an executable that you cannot even test because you don't have the OS to run it on. That would be insane.
True cross-compilers generally only exist for embedded or mobile systems. I never saw one that can create GUI applications for a desktop system. The languages that do allow this are all using some form of bytecode-interpretion and do not produce native binaries as output.
You can run your target OS in a virtual machine, develop on Windows and even use the Windows debugger to connect to the program in the virtual machine. All you have to do is compile and run your program in the VM. Today's computers are fast enough for this and virtual machine software is available for free. I don't see the big problem in that.
To be able to do this, every PB installation would need to include:
- the compiled libraries for all target platforms (simple, only takes some disk space)
- the pbcompiler with backends for all target platforms (again, rather simple)
- a cross-assembler for the target platforms (simple for linux as fasm can do this, not so simple for OSX)
- a cross-linker for the target platforms (didn't look into that one honestly)
- all required OS libraries of the target platforms to link against
The last one is the problematic one.
Lets take OSX:
We cannot ship OSX libraries with PureBasic for Windows because they are proprietary software. I don't think Apple would like that very much.
And Linux:
While this should be possible in theory its pretty much impossible in practice: We would need to include all binaries for gtk, sdl, libc, and many more including all dependencies in the PureBasic package. Not to speak of the fact, that these libraries don't exist in a cross-compilation ready fashion afaik. So while possible in the pure theory, we would be talking about a huge nightmare for us and a resulting PB installation that requires a DVD to fit, all so you can compile an executable that you cannot even test because you don't have the OS to run it on. That would be insane.
True cross-compilers generally only exist for embedded or mobile systems. I never saw one that can create GUI applications for a desktop system. The languages that do allow this are all using some form of bytecode-interpretion and do not produce native binaries as output.
You can run your target OS in a virtual machine, develop on Windows and even use the Windows debugger to connect to the program in the virtual machine. All you have to do is compile and run your program in the VM. Today's computers are fast enough for this and virtual machine software is available for free. I don't see the big problem in that.
quidquid Latine dictum sit altum videtur
Re: Compile for foreign systems.
I believe RealBasic cross-compiles. How do they do it? http://www.realsoftware.com/
BTW, I am not promoting RealBasic. I chose PureBasic over RealBasic as when I took a look at it several years ago because IMO I found several issues with RealBasic: big executables, buggy environment, expensive to license.
BTW, I am not promoting RealBasic. I chose PureBasic over RealBasic as when I took a look at it several years ago because IMO I found several issues with RealBasic: big executables, buggy environment, expensive to license.
Re: Compile for foreign systems.
RealBasic creates no native exes, it is a form of bytecode-interpreter, big slow filesUSCode wrote:I believe RealBasic cross-compiles. How do they do it?

PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: Compile for foreign systems.
I noticed Realbasic has been working on an llvm front end but I have no idea if they've done it.
Apple are far to restrictive there goes the ihope and iwish
FYI I am writing a PB cross compiler, the code gen is 90% done and I'm just starting on wiring it into the parser
it will probably be a few months before its self hosting though.
Apple are far to restrictive there goes the ihope and iwish
FYI I am writing a PB cross compiler, the code gen is 90% done and I'm just starting on wiring it into the parser
it will probably be a few months before its self hosting though.
Windows 11, Manjaro, Raspberry Pi OS


Re: Compile for foreign systems.
As I explained, its not the compilation that is the real problem. If you want to do more than just printing stuff on the console, you are going to need libraries from the target OS to link against.
quidquid Latine dictum sit altum videtur
Re: Compile for foreign systems.
Yes it's not generally useful in itself and is generally used for targeting embedded platforms, for which you have the libs.
Apple have at least got it right with their tool chain.
Apple have at least got it right with their tool chain.
Windows 11, Manjaro, Raspberry Pi OS


Re: Compile for foreign systems.
That's not what they advertise: http://www.realsoftware.com/realstudio/qualityapps.phpts-soft wrote:RealBasic creates no native exes, it is a form of bytecode-interpreter, big slow filesUSCode wrote:I believe RealBasic cross-compiles. How do they do it?
"Real Studio also compiles your code to native machine code for fast execution and to protect your intellectual property."
Re: Compile for foreign systems.
All native exe i can pack with for example UPX, but not the exe comes from RealBasic.
It is big, slow and not to pack with exe packers. I would not say the exe is nativ at all.
Many Text with object description in the exe ...
It is big, slow and not to pack with exe packers. I would not say the exe is nativ at all.
Many Text with object description in the exe ...
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: Compile for foreign systems.
The link above for RealBasic also states: "Real Studio applications do not have an interpreter or virtual machine, as its compiler generates machine code. This means that applications will look and act like native applications because they are, even if you created a Windows application from start to finish on your Mac."
So, assuming that's true, they probably had to pay a massive license fee (millions of dollars?) for each OS to allow it. I doubt Fred and Co have that kind of money to waste. And as Freak said, why code for Mac on a PC, if you don't have a real Mac to test it on? Nobody in their right mind would release a Mac app without actually testing it on a real Mac. That's just asking for trouble from your customers:
Customer: "Your app isn't doing what it's supposed to".
You: "Sorry, I haven't tested it on a real Mac, so I can't help."
Yeah, that's going to give you a great reputation as a coder/company.
Supporting cross-compilation sounds good "on paper" (ie. RealBasic's advertising), but in reality it's pointless.
So, assuming that's true, they probably had to pay a massive license fee (millions of dollars?) for each OS to allow it. I doubt Fred and Co have that kind of money to waste. And as Freak said, why code for Mac on a PC, if you don't have a real Mac to test it on? Nobody in their right mind would release a Mac app without actually testing it on a real Mac. That's just asking for trouble from your customers:
Customer: "Your app isn't doing what it's supposed to".
You: "Sorry, I haven't tested it on a real Mac, so I can't help."
Yeah, that's going to give you a great reputation as a coder/company.

Supporting cross-compilation sounds good "on paper" (ie. RealBasic's advertising), but in reality it's pointless.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Compile for foreign systems.
Please excuse me, I have a sudden strong urge to barf.RealBasic Website wrote:Real Studio Desktop Edition enables you to build stand-alone, native applications for Mac OS X, Windows & Linux. The drag and drop interface and object-oriented language abstract you from the code, letting you focus on building your application. You can even do a lot of your development without writing any code at all.
BERESHEIT
Re: Compile for foreign systems.
Please excuse me, I have a sudden strong urge to barf.

Windows 11, Manjaro, Raspberry Pi OS


- freepurebasic
- Enthusiast
- Posts: 123
- Joined: Fri Sep 24, 2010 12:02 pm
- Location: world wide web
Re: Compile for foreign systems.
did you try guys to use:
lazarus
delphi 7 (still working on win 7/64 i already tested )
and freebasic (http://freebasic.net/) ????
i already tested all these and all works
lazarus
delphi 7 (still working on win 7/64 i already tested )
and freebasic (http://freebasic.net/) ????
i already tested all these and all works