Skip to content

Instantly share code, notes, and snippets.

@Luv2C0d3
Last active August 18, 2022 22:07
Show Gist options
  • Save Luv2C0d3/f6fa55dbb1a3155c8233c1bfd2308a9c to your computer and use it in GitHub Desktop.
Save Luv2C0d3/f6fa55dbb1a3155c8233c1bfd2308a9c to your computer and use it in GitHub Desktop.
Configure LLVM development environment in several WSL flavors
Objective: Install llvm toolchain + voltron for debugging
Voltron source: https://github.com/snare/voltron.git
For voltron, I needed to install:
* Modify the script a little. -- Will fork and add that change.
* python3, tmux
* Need to fix the library paths for llvm libraries
* python3-lldb site package
Ubuntu 22.04:
In Ubuntu, I needed to create a link such that lldb would see properly the lldb python site-packages
I got the hint here -> https://github.com/llvm/llvm-project/issues/55575
```
sudo apt install git-core tmux
sudo apt install clang lldb lld llvm-runtime llvm14-dev
sudo mkdir -p /usr/lib/local/lib/python3.10
sudo ln -s /usr/lib/llvm-14/lib/python3.10/dist-packages /usr/lib/local/lib/python3.10/dist-packages
git clone https://github.com/snare/voltron.git
cd voltron
./install.sh -b lldb
#
# lldb-mi install needed for VSCode debugging
#
git clone https://github.com/lldb-tools/lldb-mi.git
cd lldb-mi/
cmake .
cmake --build .
mv src/lldb-mi ~/.local/bin/
#
# Need to find lldb-server which lldb-mi needs.
#
ln -s /usr/bin/lldb-server ~/.local/bin/lldb-server-14.0.0
```
Oracle Linux 8.06:
* I needed Modify the script a little. -- Will fork and add that change.??
* For VSCode, this one seem still broken, whether using clang or gcc
```
$ sudo dnf install git-core tmux
$ sudo dnf install python3-devel
$ sudo dnf install python3-setuptools python3-yaml python3-pip
$ sudo dnf install clang lldb lld llvm llvm-devel
$ git clone https://github.com/snare/voltron.git
$ cd voltron
$ ./install.sh -b lldb
#
# cmake needed to build lldb-mi
#
sudo dnf install cmake lldb-devel
git clone https://github.com/lldb-tools/lldb-mi.git
cd lldb-mi/
cmake .
cmake --build .
```
OpenSUSE Tumbleweed:
* Needed to install `gcc` so that the include / lib files where available.
* Needed to add $HOME/.local/bin to the command path to find voltron.
* Need to build lldb-mi from sources and then move it to a location.
* Need to configure VSCode CLang configuration's miDebuggerPath to point to lldb-mi.
```
$ sudo zypper in gcc git-core tmux
$ sudo zypper in clang14 llvm14 lld14 lldb14 llvm14-devel python3-lldb
$ git clone https://github.com/snare/voltron.git
$ cd voltron
$ ./install.sh -b lldb
#
# lldb-mi install needed for VSCode debugging
#
sudo zypper in lldb14-devel
git clone https://github.com/lldb-tools/lldb-mi.git
cd lldb-mi/
cmake .
cmake --build .
mv src/lldb-mi ~/.local/bin/
```
Debugging commands:
A few commands help:
$ python3 -c 'import platform; print(".".join(platform.python_version_tuple()[:2]))'
$ lldb -P
$ llvm-config --cxxflags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment