Skip to content

ops@wsl

odalet edited this page Nov 22, 2020 · 3 revisions

Visual Studio + Linux, WSL tips

Linux

WSL

Ubuntu meta-package for WSL

Offline installs

Uninstalling

Development tools

On Ubuntu 18.04; installed:

  • build-essential
  • cmake

See below:

$ sudo apt install -y build-essential
$ gcc --version
    gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0
    Copyright (C) 2017 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ sudo apt install -y gdbserver
$ sudo apt install -y cmake
$ cmake --version
    cmake version 3.10.2
$ sudo apt install -y openssh-server
$ sudo nano /etc/ssh/sshd_config
    --> make sure PasswordAuthentication is yes
$ sudo ssh-keygen -A

VSCode

See https://nickjanetakis.com/blog/using-wsl-and-mobaxterm-to-create-a-linux-dev-environment-on-windows

First installed x11-apps to test the X11 server in mobaxterm

sudo apt-get install libgtk2.0-0 libxss1 libasound2
sudo dpkg -i <the_file_you_just_downloaded>.deb
sudo apt-get install -f
  • This does not work... Dependencies are missing:
$ sudo dpkg -i code_1.24.1-1528912196_amd64.deb
Selecting previously unselected package code.
(Reading database ... 52408 files and directories currently installed.)
Preparing to unpack code_1.24.1-1528912196_amd64.deb ...
Unpacking code (1.24.1-1528912196) ...
dpkg: dependency problems prevent configuration of code:
    code depends on libnotify4; however:
    Package libnotify4 is not installed.
    code depends on libnss3; however:
    Package libnss3 is not installed.
    code depends on libgconf-2-4; however:
    Package libgconf-2-4 is not installed.
    code depends on libsecret-1-0; however:
    Package libsecret-1-0 is not installed.

dpkg: error processing package code (--install):
    dependency problems - leaving unconfigured
Processing triggers for mime-support (3.60ubuntu1) ...
Errors were encountered while processing:
    code
  • Fixing:
$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
    at-spi2-core dconf-gsettings-backend dconf-service gconf-service gconf-service-backend gconf2-common glib-networking glib-networking-common
    glib-networking-services gsettings-desktop-schemas libatk-bridge2.0-0 libatspi2.0-0 libcairo-gobject2 libcolord2 libdbus-glib-1-2 libdconf1
    libegl-mesa0 libegl1 libepoxy0 libgbm1 libgconf-2-4 libglapi-mesa libglvnd0 libgtk-3-0 libgtk-3-bin libgtk-3-common libjson-glib-1.0-0
    libjson-glib-1.0-common liblcms2-2 libnotify4 libnspr4 libnss3 libproxy1v5 librest-0.7-0 libsecret-1-0 libsecret-common libsoup-gnome2.4-1
    libsoup2.4-1 libwayland-client0 libwayland-cursor0 libwayland-egl1-mesa libwayland-server0 libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0
    libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxkbcommon0 libxshmfence1 libxtst6 notification-daemon
Suggested packages:
    colord gvfs liblcms2-utils
The following NEW packages will be installed:
    at-spi2-core dconf-gsettings-backend dconf-service gconf-service gconf-service-backend gconf2-common glib-networking glib-networking-common
    glib-networking-services gsettings-desktop-schemas libatk-bridge2.0-0 libatspi2.0-0 libcairo-gobject2 libcolord2 libdbus-glib-1-2 libdconf1
    libegl-mesa0 libegl1 libepoxy0 libgbm1 libgconf-2-4 libglapi-mesa libglvnd0 libgtk-3-0 libgtk-3-bin libgtk-3-common libjson-glib-1.0-0
    libjson-glib-1.0-common liblcms2-2 libnotify4 libnspr4 libnss3 libproxy1v5 librest-0.7-0 libsecret-1-0 libsecret-common libsoup-gnome2.4-1
    libsoup2.4-1 libwayland-client0 libwayland-cursor0 libwayland-egl1-mesa libwayland-server0 libx11-xcb1 libxcb-dri2-0 libxcb-dri3-0
    libxcb-present0 libxcb-sync1 libxcb-xfixes0 libxkbcommon0 libxshmfence1 libxtst6 notification-daemon
0 upgraded, 52 newly installed, 0 to remove and 99 not upgraded.
1 not fully installed or removed.
Need to get 6,763 kB of archives.
After this operation, 30.4 MB of additional disk space will be used.
Do you want to continue? [Y/n]
  • It works!

Qt

Download:

$ wget http://download.qt.io/official_releases/qt/5.11/5.11.1/qt-opensource-linux-x64-5.11.1.run

Other tools

  • xterm
  • konsole

Docker

https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly

VS + Linux

Extensions

CMake

Git

Have Git show correct status

git config core.autocrlf true
git config core.filemode false

Beware: autocrlf might be dangerous for repos shared between Windows / Linux; however, if not set, each time one issues git status (as is done by the bash prompt extension), git outputs warnings about CRLF being changed to LF...

Upgrade Git

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

Configure Git diff tool

This allows to associate a Windows-gui diff/merge tool with Linux's git.

Misc (non-WSL)

Enable Windows Console to display VT100 escape codes (colors)

  • Only works in Windows 10...
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Console]
"VirtualTerminalLevel"=dword:00000001
Clone this wiki locally