Forum > Windows (32/64)

Installing Lazarus on WSL2?

(1/2) > >>

Wysardry:
I recently installed WSL2 (Debian) on my Windows 10 laptop and would like to install both Lazarus and FreePascal on it, but need some help on how to go about it.

For one thing, I'm confused about the difference between the "lazarus" and "lazarus-ide" packages, and whether the "fpc" package is automatically included with either of them.

Can anyone offer any advice on the easiest way to go about this? I don't need the most recent version, as I will be using it to compile the trunk code (after I've downloaded it).

PierceNg:
WSL2 is the Linux kernel running on / integrated into the Windows kernel. Running a WSL2 Linux distro is (conceptually) running Linux in a virtual machine on Windows.

In WSL2, GUI apps like Lazarus IDE and the Lazarus apps you build, whether Lazarus-GTK or Lazarus-Qt, run on X11. This means they need to connect to an X11 display server running on the Windows host. Windows 11 (even the lowly Home edition) comes with a built-in X11 server. For Windows 10, you need 3rd party software. The popular one is VcXsrv. I myself use Cygwin/X because I already use Cygwin.

Apparently WSL2 on Windows 11 also supports Wayland.

See also: https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps

As for FPC, they are command line tools, so just install from the .deb files.

Wysardry:
I'm using a Windows 10 build greater than 19044 so it should be able to run GUI apps via WSL2, according to the Microsoft page you linked to.

I was able to install (and run) X11 apps and GIMP without problems.

Leledumbo:

--- Quote from: Wysardry on September 13, 2023, 01:38:33 am ---For one thing, I'm confused about the difference between the "lazarus" and "lazarus-ide" packages, and whether the "fpc" package is automatically included with either of them.

--- End quote ---
Sounds like you're new to Linux especially Debian (derivatives) package management?
Here's a quick n dirty explanation:
lazarus is a dependency package, also called metapackage, acting as a disguise that always depends on whatever latest version is available in the repository. You can see in the "depends" section, that it currently depends on lazarus-2.2 package. So if you install this now, it will install lazarus-2.2 package as well. Some time later in the future, if say lazarus-2.4 comes out and becomes the latest, you don't have to manually install it, as it will be automatically installed due to this dependency.
lazarus-ide is another metapackage that also depends on the latest lazarus-ide, but it also provides selection of either lazarus-ide-gtk2-2.2 or lazarus-ide-qt5-2.2.
As of Debian customs, packages should be splitted according to its category. So other than the above two, lazarus has a bunch of other packages as well.
fpc is similar, with each package (in fpc sense) is a Debian package on its own. So, to answer the second question: no, fpc is not included per se, but it may well be a dependency.

PierceNg:

--- Quote from: Wysardry on September 13, 2023, 08:16:18 am ---I'm using a Windows 10 build greater than 19044 so it should be able to run GUI apps via WSL2, according to the Microsoft page you linked to.

I was able to install (and run) X11 apps and GIMP without problems.

--- End quote ---

Ah, nice, MS has incorporated built-in X server into latest Windows 10.

Here's one way to get FPC and Lazarus. I'm running Ubuntu 22.04 on WSL2. I have these .deb files downloaded previously:

* fpc-laz_3.2.2-210709_amd64.deb
* fpc-src_3.2.2-210709_amd64.deb
In WSL2 Ubuntu:

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$ sudo dpkg -i fpc-laz_3.2.2-210709_amd64.deb$ sudo dpkg -i fpc-src_3.2.2-210709_amd64.deb$ fpc -h
For Lazarus I prefer to build from source:

--- Code: Text  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$ sudo apt install libgtk2.0-dev$ echo Set up clean PATH without reference to /mnt/c, /mnt/d, etc which are the Windows C, D, ... drives$ git clone https://gitlab.com/freepascal.org/lazarus/lazarus$ cd lazarus$ make clean bigide$ ./startlazarus
Important: Set up clean PATH. Some notable bits before I did that:

* I also have Windows distribution of Lazarus installed in C:\pkg\lazarus. "make clean" ran /mnt/c/pkg/lazarus/.../rm.exe -rf ...
* rm.exe was slow in WSL2.
* The make run was slow too, compared to when the machine runs Linux. (My machine dual boots.)
* First run of make failed, because it tried to install the compiled units to /mnt/c/pkg/lazarus/fpc/3.2.2/... and got permission denied.With a clean PATH, the make run went much faster.

Edit: First thing I do booting up the Lazarus IDE is to install the anchordockingdsgn package. Well, on WSL2 using Windows 10's built-in X server, the "install/uninstall packages" dialog box comes up, but I can't click on it! I also can't cycle to it using alt-tab. Pressing esc makes the dialog box go away though.

Hmm, doesn't look usable like this...

Navigation

[0] Message Index

[#] Next page

Go to full version