Skip to content

Commit 18c1d1c

Browse files
Add LPython installation procedure in Docs
co-authored-by: Anurag Bhat <[email protected]>
1 parent 8fa533a commit 18c1d1c

File tree

1 file changed

+61
-1
lines changed

1 file changed

+61
-1
lines changed

doc/src/installation.md

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ First we have to install dependencies, for example using Conda:
4141
conda create -n lf python cmake llvmdev
4242
conda activate lf
4343
```
44-
Then download a tarball from
44+
Then download a tarball from
4545
[https://lfortran.org/download/](https://lfortran.org/download/),
4646
e.g.:
4747
```bash
@@ -122,6 +122,66 @@ 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+
conda init bash # (shell name)
137+
```
138+
* This adds all requirements used by Conda in the `.bashrc` file.
139+
* After that, close the existing terminal and open a new one.
140+
* Run the following
141+
```bash
142+
conda create -n lp -c conda-forge llvmdev=11.0.1 bison=3.4 re2c python cmake make toml clangdev git
143+
conda activate lp
144+
```
145+
* Note that Conda is slow for installing packages with specified versions.
146+
* Instead use Mamba for faster installation, with the following commands (this is optional; if the above command works without any lag, then proceed to the next step):
147+
```bash
148+
conda create -n lp -c conda-forge re2c python cmake make toml numpy mamba clangdev git
149+
mamba install llvmdev=11.0.1 bison=3.4
150+
conda activate lp
151+
```
152+
* Run the following to install other required packages:
153+
```bash
154+
sudo apt update
155+
sudo apt-get install build-essential binutils-dev
156+
sudo apt-get install zlib1g-dev
157+
```
158+
* You can change the directory to a Windows location using `cd /mnt/[drive letter]/[windows location]`.
159+
* e.g. `cd mnt/c/Users/name/source/repos/`
160+
161+
* Now clone the LPython git repository
162+
```bash
163+
git clone https://github.com/lcompilers/lpython.git
164+
cd lpython
165+
```
166+
167+
* Run the following commands to build the project:
168+
```bash
169+
./build0.sh
170+
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_LLVM=yes -DCMAKE_INSTALL_PREFIX=`pwd`/inst .\
171+
make -j8
172+
```
173+
174+
* If everything compiles, you can use LPython as follows
175+
```bash
176+
./src/bin/lpython examples/expr2.py
177+
```
178+
179+
* Run tests
180+
```bash
181+
ctest
182+
./run_tests.py
183+
```
184+
125185
## Enabling the Jupyter Kernel
126186

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

0 commit comments

Comments
 (0)