Compile for one platform from another

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Compile for one platform from another

Post by Saki »

Look, the event handling under Windows is different than under Mac and Linux.
There are codes that give you output on Windows, but no output on Linux and Mac, or it hangs, or is incomplete.
This is not a bug of PB.
You don't ask for a feature, you ask for things that don't work, since the OS internally work differently !

Another thing, for example.
Linux has gtk3, which technically can never be absolutely compatible with Mac or Windows, because it works completely different.
Now comes gtk4, which makes the gap even wider.
That's why there is now qt for PB, but that's not a solution for the future either.
The OS will become further and further apart:
And then try marrying a fox to a duck :wink:


Best regards Saki
地球上の平和
User avatar
the.weavster
Addict
Addict
Posts: 1537
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Re: Compile for one platform from another

Post by the.weavster »

Saki wrote:Look, the event handling under Windows is different than under Mac and Linux.
There are codes that give you output on Windows, but no output on Linux and Mac, or it hangs, or is incomplete.
This is not a bug of PB.
You don't ask for a feature, you ask for things that don't work, since the OS internally work differently !

Another thing, for example.
Linux has gtk3, which technically can never be absolutely compatible with Mac or Windows, because it works completely different.
Now comes gtk4, which makes the gap even wider.
That's why there is now qt for PB, but that's not a solution for the future either.
The OS will become further and further apart:
And then try marrying a fox to a duck :wink:


Best regards Saki
I'm asking to be able to cross-compile not for Linux executables to magically run on Windows.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Compile for one platform from another

Post by Saki »

But that doesn't make sense if you can't test the codes on every OS.
And there is no difference between testing and compiling.
地球上の平和
deeproot
Enthusiast
Enthusiast
Posts: 271
Joined: Thu Dec 17, 2009 12:00 pm
Location: Llangadog, Wales, UK
Contact:

Re: Compile for one platform from another

Post by deeproot »

the.weavster wrote:Oh, OK then... perhaps Fred should just shut down the Feature Requests and Wishlists section of the forum <eye-roll>
I don't see anything wrong with making a Request, including this one. Some things may be easy, other things not possible. At the very least requests bring an awareness and discussion of peoples wishes and needs. Even if a request is never fulfilled, other good things may spin out of it. Only my opinion!

Personally I'm already happy with the results from working on three platforms, but always there could be scope for further improvements.
User avatar
the.weavster
Addict
Addict
Posts: 1537
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Re: Compile for one platform from another

Post by the.weavster »

Saki wrote:But that doesn't make sense if you can't test the codes on every OS.
And there is no difference between testing and compiling.
Actually it's what you thought I meant that didn't make any sense - why would I want to run a Linux executable on Windows when I could just compile a Windows executable?

Cross-compiling is a perfectly reasonable request and it's not something novel or extraordinary.

@Tenaja gave a very clear explanation of why Fred might see it as too burdensome and I appreciate the point.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Kompilieren für eine Plattform von einer anderen

Post by Saki »

There are licensing problems and it is not possible for technical reasons.
There is nothing more to say about this.

Best Regards Saki
地球上の平和
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: Compile for one platform from another

Post by Tenaja »

the.weavster wrote:
Tenaja wrote:Technically, it's possible. It seems he finds the maintenance overwhelming, which is understandable. He'd have to port the generation libraries to every platform, do there'd be nine instead of three... And if you add the recently promised arm output, it will be sixteen instead of four. Or, cumbersome #CompilerIfPlatform=TheRightOne statements.
Thanks for the perspective.

mk-soft wrote:We should be happy with what we have with Purebasic.
Oh, OK then... perhaps Fred should just shut down the Feature Requests and Wishlists section of the forum <eye-roll>
You are not the first to request this, and also not the first to get it denied--and probably also not the last. Just because this one request is not honored is no reason to Throw the Baby Out With the Bathwater.

My guess is mk-soft is referring to the fact that we have the best and most long-standing cross-platform compiler, and we are blessed that most code compiles on all three platforms with very few edits. With a fourth on the horizon, Fred is undertaking his largest project yet (probably even larger than Spider Basic), and he's unlikely to stop and make a change that won't improve the code output
User avatar
mk-soft
Always Here
Always Here
Posts: 5406
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Compile for one platform from another

Post by mk-soft »

If you want an application to run on all OS, you need a common framework, which also runs on all OS. (Just like JAVA runtime environment).
But for the application to run, the huge framework must first be installed.

I think we don't want that either.

There is a project somewhere, where a Windows version is compiled under Linux. But for this you have to install the runtime environment for Windows (Wine). With macOS it won't work that way, because there is no such thing.
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
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Compile for one platform from another

Post by Saki »

However, Wine must then also be 100% compatible.
It simply doesn't make sense, then you can compile on Wine,
because you have to check if the code of both OS are working properly anyway.
地球上の平和
User avatar
Tenaja
Addict
Addict
Posts: 1949
Joined: Tue Nov 09, 2010 10:15 pm

Re: Compile for one platform from another

Post by Tenaja »

Saki wrote:However, Wine must then also be 100% compatible.
It simply doesn't make sense, then you can compile on Wine,
because you have to check if the code of both OS are working properly anyway.
Has anybody tried their wsl for pb?
User avatar
the.weavster
Addict
Addict
Posts: 1537
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

Re: Compile for one platform from another

Post by the.weavster »

mk-soft wrote:But for this you have to install the runtime environment for Windows (Wine). With macOS it won't work that way, because there is no such thing.
WineHQ wrote:Wine (originally an acronym for "Wine Is Not an Emulator") is a compatibility layer capable of running Windows applications on several POSIX-compliant operating systems, such as Linux, macOS, & BSD..
https://www.winehq.org/



* edit *
If you have an Android smartphone with an intel processor you can use the Wine app to run windows programs on that too:
https://dl.winehq.org/wine-builds/android/
Marc56us
Addict
Addict
Posts: 1479
Joined: Sat Feb 08, 2014 3:26 pm

Re: Compile for one platform from another

Post by Marc56us »

Tenaja wrote:Has anybody tried their wsl for pb?
Yes

Code: Select all

C:\>wsl
$:/mnt/c$

$:/mnt/c$ uname -a
Linux HPM 4.4.0-18362-Microsoft #836-Microsoft Mon May 05 16:04:00 PST 2020 x86_64 GNU/Linux

$:/mnt/c$ cd /tmp
$:/tmp$

$:/tmp$ curl -O https://www.purebasic.com/download/purebasic-demo_x64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 37.0M  100 37.0M    0     0  5615k      0  0:00:06  0:00:06 --:--:-- 8970k

$:/tmp$ ls -l
total 38016
-rw-rw-rw- 1 marc marc 38875885 Jun 24 11:32 purebasic-demo_x64.tar.gz

$:/tmp$ tar xvzf purebasic-demo_x64.tar.gz
purebasic_demo/
purebasic_demo/README
purebasic_demo/launch.sh
...

$:/tmp$ cd cd purebasic_demo/compilers/

$:/tmp/purebasic_demo/compilers$ ./pbcompiler
PureBasic 5.72 (Linux - x64) Free - (c) 2020 Fantaisie Software
A filename must be specified.
pbcompiler -h for help.

$:/tmp$ vi Hello.pb
PrintN("Hello World in WSL")
<Esc>:wq

$:/tmp/purebasic_demo/compilers$ ./pbcompiler Hello.pb

******************************************
PureBasic 5.72 (Linux - x64) Free
******************************************

Loading external modules...
Error: Can't load OS libraries, please re-install PureBasic.

pfff...
:(

But I think it should work (at least for console applications) if you make some adjustments.
:wink:
Post Reply