Skip to content

Commit 7739a2a

Browse files
committed
Docs for Wsl
1 parent 8fa533a commit 7739a2a

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

doc/src/installation.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,77 @@ Before the first build you have to set up the `ZLib`-pathes: Go to the CMake-Set
122122

123123
Then you can generate the CMake-Cache and build the project.
124124

125+
## Build from Git on Windows with WSL
126+
* In windows search "turn windows features on or off".
127+
* Tick Windows subsystem for Linux.
128+
* Press OK and restart computer.
129+
* Go to Microsoft store and download Ubuntu 22.04, and launch it.
130+
* Run the following commands.
131+
132+
```bash
133+
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh -O miniconda.sh
134+
bash miniconda.sh -b -p $HOME/conda_root
135+
export PATH="$HOME/conda_root/bin:$PATH"
136+
```
137+
* Now do the following to configure the path
138+
```bash
139+
sudo nano .bashrc
140+
```
141+
* Then go to the bottom of the file and paste the following
142+
```bash
143+
export PATH="$HOME/conda_root/bin:$PATH"
144+
```
145+
* Then press ctrl + O (save), Enter (confirm), ctrl + X (exit)
146+
* After that restart Ubuntu
147+
* Run the following
148+
```bash
149+
conda create -n lp -c conda-forge llvmdev=11.0.1 bison=3.4 re2c python cmake make toml
150+
conda init bash
151+
```
152+
* Note that Conda is slow for installing packages with specified versions.
153+
* Instead use Mamba for faster installation, with the following commands
154+
```bash
155+
conda create -n lp -c conda-forge re2c python cmake make toml numpy
156+
conda install mamba -c conda-forge
157+
mamba install llvmdev=11.0.1 bison=3.4
158+
conda init bash
159+
```
160+
* Restart Ubuntu again
161+
```bash
162+
conda activate lp
163+
sudo apt update
164+
sudo apt-get install build-essential
165+
sudo apt-get install zlib1g-dev
166+
sudo apt install clang
167+
```
168+
* You can change the directory to a Windows location using `cd /mnt/[drive letter]/[windows location]`.
169+
* e.g. `cd mnt/c/Users/name/source/repos/`
170+
171+
* Now clone the Lpython git repository
172+
```bash
173+
git clone https://github.com/lcompilers/lpython.git
174+
cd lpython
175+
```
176+
177+
* Run the following commands
178+
```bash
179+
conda activate lp
180+
./build0.sh
181+
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_LLVM=yes -DCMAKE_INSTALL_PREFIX=`pwd`/inst .\
182+
make -j8
183+
```
184+
185+
* If everything compiles, you can use Lpython as follows
186+
```bash
187+
./src/bin/lpython examples/expr2.py
188+
```
189+
190+
* Run tests
191+
```bash
192+
ctest
193+
./run_tests.py
194+
```
195+
125196
## Enabling the Jupyter Kernel
126197

127198
To install the Jupyter kernel, install the following Conda packages also:

0 commit comments

Comments
 (0)