Page 1 of 2

Gambas on Windows

Posted: Friday 17th January 2020 4:17pm
by cogier
Gambas running in Windows 10 next to Visual Studio
Image

Re: Gambas on Windows

Posted: Friday 17th January 2020 10:46pm
by Got2BeFree
How'd you manage that? Were you using a VM?

Re: Gambas on Windows

Posted: Saturday 18th January 2020 12:26pm
by jornmo
Cygwin

Re: Gambas on Windows

Posted: Saturday 18th January 2020 12:32pm
by cogier
No this is not done with a VM or Cygwin.

I followed instructions on the Gambas mailing list, copied below, thanks go to 'Admin' in Russia for this work.
Ok, so what you basically do is go to Microsoft Store which is in a start menu under the letter M obviously.

You probably already have an account if you got Windows installed, but if not, it will ask you to register, it's simple - just provide any email and password.

There just type Ubuntu in search bar and install Ubuntu app in one (or maybe two) click(s)

What will happen is you will have compact distribution of Ubuntu installed in Windows, it's a standard feature there nowadays. There's also Debian and it already has Gambas in repo, but it doesn't work, qt5 dependency is broken.

Now, when Ubuntu is installed, you will have Ubuntu app icon in Start menu, wich is basically a bash shell chrooted to Programm Files directory where your Ubuntu infrastructure is installed. When it would be first run it'll ask you to enable Windows Subsystem For Linux (WSL) and tell you exactly how to do it, also one click more or less.

Everything else is just installing Gambas (or anything else) in Ubuntu, so you add a PPA, then "apt-get update" then "apt install gambas3" and you are ready to go, console Gambas apps will now work if you run them from this bash console or by typing "wls <programm>.gambas" in windows cmd or anywhere else in Windows, even from .bat or .cmd file, or another program capable of "shell" operator.

Gambas in Ubuntu (at lease in Windows' repository) seems to be linked to QT4, and GTK3 is also there by default, so you can create and run those types of apps. And, as I've already said, you can run cli apps without any additional moves.

To run any graphical Linux program in Windows 10 you need an X server. Just google, download and install Xming, it's free and easy to install. There's also an X server in Microsoft Store but it's 50 bucks so no thanks.

When XMing is installed what I do is run a configurator that creates an Xlaunch file. So I tell it to not create a root window, just to be ready to serve apps without authentication, and then i put this xlauch file in Autorun in Start menu

So now you can either specify DISPLAY=:0 in bash cli and run any program from now on, or just create a basic windows shortcut with a line that I already provided before.

For example I have a app icon for Gambas on my desktop. The command it executes on double click is:

C:\Windows\System32\wsl.exe DISPLAY=:0 LANG=ru_RU.UTF-8 gambas3

it sets DISPLAY environment to work with Xmin and it sets my native locale, so I can see Gambas IDE in my native language.

That's it. Any software then written in gambas is run from such shortcuts with the same scheme: C:\Windows\System32\wsl.exe DISPLAY=:0 LANG=ru_RU.UTF-8 myprogramm.gambas

BTW the very same way you can ran, say, Firefox, or Chrome, or any other Linux version of graphical software that you install with apt in your pseudo Ubuntu. It works in Windows 10 just like that.

RedHat's Cygwin did this for years, but now Windows 10 just officially supports Linux binaries through WSL, so no need for any additional software. If you want to, say, run Apache or any other Linux non-graphical software - you don't even need Xming? just install Ubuntu, apt install your app and you are good to go. Even sshd works, but you have to remember that Windows 10 also has it's own SSH, so you have to disable it first.

Oh, and keep in mind that you can't mount anything and /dev is just empty, but your Windows drives are already in /mnt, so you still see all your Windows infrastructure and you can run Windows software from inside of this Linux chroot if you will
My experience with MS Shop was not good and I had to search the web to get MS Shop to point to the correct page. You will need to switch Win 10 to Developers Mode. It is Ubuntu that gives you Linux and Xming that gives you the X server. If you look at the picture above you will see a big 'X' on the taskbar which is Xming. Once Xming is running you can add a 'Shortcut' to the Win 10 Desktop to run Gambas or whatever Linux program you like. I discovered that if you need a special font, as I did, just create a '.fonts' folder in your Home folder and drop the font in there and the system will pick it up. Not everything is going to work, Nemo (file manager) does not do much. Some clever Linux man needs to create a distro with all the necessary included and I am sure someone will.

Re: Gambas on Windows

Posted: Saturday 18th January 2020 10:46pm
by jornmo
Thanks! I had a lot of success with VcXsrv too. This seems to be more up to date than xmings, and it is free too. (The up to date versions of xming is £10 per year.)

In Ubuntu do this

Code: Select all

$ cd ~
$ nano .bashrc
Go to the last line and write this :

Code: Select all

export DISPLAY=:0.0
Restart ubuntu, start Xlaunch from Windows (chose client), and then type gambas3.

Re: Gambas on Windows

Posted: Saturday 18th January 2020 10:47pm
by jornmo
I tried Gambas under Cygwin many times before, but it always chrashed. This seems stable so far.

Re: Gambas on Windows

Posted: Sunday 19th January 2020 1:16pm
by cogier
Yes VcXsrv is better as it allows windows to resize in real time.

Re: Gambas on Windows

Posted: Sunday 19th January 2020 6:13pm
by jornmo
Did you manage to create a shortcut to start Gambas directly from Win Desktop with VcXsrv, as described in your post with Xming?

Re: Gambas on Windows

Posted: Monday 20th January 2020 3:32pm
by cogier
Did you manage to create a shortcut to start Gambas directly from Win Desktop with VcXsrv, as described in your post with Xming?
It works the same way, once VcXsrv is running (Big 'X' in the System Tray). My shortcut to Gambas3 is: -

Code: Select all

C:\Windows\System32\wsl.exe DISPLAY=:0 gambas3

Re: Gambas on Windows

Posted: Monday 20th January 2020 9:48pm
by jornmo
Hmm 🤔

With me I just get a terminal window making a millisecond appearance...