|
| 1 | +# Building (Windows WSL) |
| 2 | + |
| 3 | +## Requirements |
| 4 | + |
| 5 | +* Windows 10 or Windows 11 with installed WSL2 and Ubuntu WSL |
| 6 | + |
| 7 | +## Workarounds to make it work |
| 8 | + |
| 9 | +#### WSL adds Windows paths to the Linux path variable |
| 10 | + |
| 11 | +``` |
| 12 | +wsl@PC:~$ echo $PATH |
| 13 | +/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/snap/bin |
| 14 | +``` |
| 15 | + |
| 16 | +This breaks the build and leads to unpredictable problems. |
| 17 | + |
| 18 | +To disable that behavior you need to create a file at your Ubuntu WSL `/etc/wsl.conf` and add these options to disable. Afterwards you need to reboot WSL or your system. |
| 19 | + |
| 20 | +``` |
| 21 | + [interop] |
| 22 | + enabled=false # enable launch of Windows binaries |
| 23 | + appendWindowsPath=false # append Windows path to $PATH variable |
| 24 | +``` |
| 25 | + |
| 26 | +#### Building at the native NTFS formatted storage (C:/; D:/ ...) is dead slow |
| 27 | + |
| 28 | +To interoperate with your Windows Desktop you want the git tree accessible from Windows.\ |
| 29 | +So you clone the Git Tree to a location at windows and try to use it at WSL. |
| 30 | + |
| 31 | +For this example the Git Tree is cloned at `D:\WSL\LE` - `/mnt/d/WSL/LE`. \ |
| 32 | +If you start building the build folder would be located at `D:\WSL\LE\build.YOURPROJECT` . |
| 33 | + |
| 34 | +To change the path for the build files you need to add some options to the LibreELEC options file `/home/YOURUSER/.libreelec/options` . |
| 35 | + |
| 36 | +``` |
| 37 | +BUILD_DIR=/home/YOURUSER/LEbuild |
| 38 | +``` |
| 39 | + |
| 40 | +After adding this line to the options file every build is now located at this folder. |
| 41 | + |
| 42 | +The /home folder is located at the WSL ext4.vhdx and not at the native NTFS storage. |
| 43 | + |
| 44 | +#### Optional: Move your WSL file to another location |
| 45 | + |
| 46 | +There are several ways in moving your WSL file, the easiest solution is the dedicated tool [LxRunOffline](https://github.com/DDoSolitary/LxRunOffline#install) . The version 3.5.0 is not supporting the current Windows Version so you need to use a more recent version or a development build. |
| 47 | + |
| 48 | +`lxrunoffline move -n Ubuntu-20.04 -d d:\wsl` |
0 commit comments