Developing with WSL - VowpalWabbit/vowpal_wabbit GitHub Wiki
The following will run your through how to build and then debug the VW executable from scratch. [Windows/WSL/VSCode] indicates where this step needs to be done. A lot of these instructions are also relevant when working directly in Ubuntu and other distros.
- [Windows] Install WSL
- [Windows] Install Ubuntu from Windows Store
- [Windows] Install VSCode
- [VSCode] Open VSCode and install "Remote - WSL" extension (
ms-vscode-remote.remote-wsl) - [WSL] Install dependencies
- Using
apt-get:# System deps sudo apt install git cmake g++ gdb # VW deps sudo apt install libboost-dev libboost-thread-dev libboost-program-options-dev libboost-system-dev libboost-math-dev libboost-test-dev zlib1g-dev
- Using
- [WSL] Clone VW:
git clone https://github.com/VowpalWabbit/vowpal_wabbit.git - [WSL] Open VSCode from WSL to start a remote session connected to this directory -
code vowpal_wabbit- On the first launch it should tell you that it is installing the VSCode remote server
- [VSCode] There should now be a VSCode window open and in the bottom left it should indicate it is connected to
WSL: Ubuntu - [VSCode] In the open VSCode window connected to the remote install the following two extensions:
- "C/C++' (
ms-vscode.cpptools) - "Cmake Tools" (ms-vscode.cmake-tools) - [VSCode]
Ctrl+Shift+P->Cmake: Scan for kits - [VSCode]
Ctrl+Shift+P->Cmake: Select a kit-> select one that saysUsing compilers: C = ..., CXX = ... - [VSCode]
Ctrl+Shift+P->Cmake: build - [VSCode] You can also change this information along the bottom of the window
- [VSCode]
Ctrl+Shift+P->Cmake: Set debug target->vw-bin - [VSCode]
Ctrl+Shift+P->Cmake: Debug
How to change current working directory and command line arguments
- [VSCode]
Ctrl+Shift+P->Preferences: Open Settings (JSON) - [VSCode] Add the following to your preferences:
cwdcan be changed to whatever is needed, but${workspaceFolder}/test/is useful as that is the cwd when debugging a test failure.argsis an array of strings, you'll need to convert from the raw command line you'd like to use
{
// ...
"cmake.debugConfig": {
"cwd": "${workspaceFolder}/test/",
"args": [
"-d",
"./train-sets/rcv1_small.dat",
]
}
}
How to enable pretty printing of v_array
Replace path/to/ with the absolute path to the base of the cloned VW repo and run the following:
# example: export VW_BASE_DIR=/home/jack/vowpal_wabbit
export VW_BASE_DIR=<change_this_value>
echo "python exec(open('${VW_BASE_DIR}/vowpalwabbit/gdb_pretty_printers.py').read())" >> ~/.gdbinit