Perhaps I misunderstood something with regards to your 'problem' but the following post
I use VirtualBox on Windows and virtual machine with Linux.
Some time ago I was able to install Lazarus stable into folder inside of virtual machine.
Now I want to use "Shared Folders" feature of VirtualBox and install Lazarus into folder which is shared between Windows and Linux VM. Such way I can share same Lazarus installation between virtual machines. See settings for Shared Folder in screenshot.
combined with this post
goal is very obvious - I have many virtual machines and I need to work with different versions of Lazarus. One installation - uses about 1.8 Gb of space and takes many time. I will save many gigabytes of space!
Are you aware that those two quotes are a contradictio in terminis ?
No matter how you turn/twist it, Windows need a Windows version of Lazarus and Linux the Linux version of Lazarus etc. The whole IDE needs to be compiled for both (and/or all other) platforms (and so will all your Free Pascal units).
So when you say you want to save space, in reality your solution saved 0 bytes. I would even go beyond that and say that it will occupy even more bytes because of the different configurations that Lazarus would require you to maintain in such a case.
Even stronger, you'll introduce issues that are never meant to be solved (or are provided) by Lazarus as the use case is non-existent. Project files that get torn between different platforms and same for the IDE configuration/setup. That is not even considering the difference in file-systems.
That is why 'they' invented cross-compiling. That way you can do with a single installation of Lazarus and install cross-compilers to be able to target the other platforms. Ofc. the results can be put on a shared directory so that you can check/test/run the generated executable (directly) on your VM.
And yes, a full cross-platform installation requires several GB's (in my case for FPC alone it is several tens of GB's, then a couple of dozen GB's for Lazarus and a couple of GB's for all the binutils and system libraries that are required for cross-compiling). It is a small price to pay, especially when the price/GB is quite low.
If I've understood the thread correctly then I strongly believe you are trying to solve an issue that can not be solved the way you want to solve and even if you do will gain exactly nothing (at least not with regards to occupied disk space)