THE FOUNDER’S GUIDE:

How to Install C++ Programs From Source Code in WSL2

The condensed tutorial with instructions and screenshots

David Littlefield
5 min readNov 30, 2020
Image by Markus Spiske

The expanded version of this article explains each step with enough detail to learn what’s happening.

Open PowerShell:

  1. Press “⊞ Windows”
  2. Enter “PowerShell” into the search bar
  3. Right-click “Windows PowerShell”
  4. Click “Run as Administrator”

Open WSL:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
wsl

Set the Username Variable:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
username=$(wslvar USERNAME)

Open the Desktop Directory:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
cd /mnt/c/users/$username/desktop

Clone the Repository:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
git clone https://github.com/pjreddie/darknet

Open the Darknet Directory:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
cd darknet

Install the Dependencies:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
sudo apt-get install libopencv-dev

The following five steps are only necessary on computers that have a GPU — not just a CPU.

Open the MakeFile:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
powershell.exe -c 'notepad $home\desktop\darknet\makefile'

Enable CUDA:

  1. Find the arrow from below these instructions
  2. Copy the code to the left of the arrow
  3. Paste over the code in Notepad
  4. Click the “File” menu
  5. Click “Save”

Change the CUDA Paths:

  1. Find the arrows from below these instructions
  2. Copy the code to the left of the arrows
  3. Paste over the code into Notepad
  4. Click the “File” menu
  5. Click “Save”
  6. Click the “File” menu
  7. Click “Exit”

Open the Bash Configuration File:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
notepad //wsl$/Ubuntu-18.04/home/$USER/.bashrc

Edit the Bash Configuration File:

  1. Find the arrows from below these instructions
  2. Copy the code to the left of the arrow
  3. Paste the code into Notepad
  4. Click the “File” menu
  5. Click “Save”
  6. Click the “File” menu
  7. Click “Exit”

Install Dos2Unix:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
sudo apt-get install dos2unix

Convert the Configuration Files to Unix:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
dos2unix cfg/*

Convert the CoCo File to Unix:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
dos2unix data/coco.names

Run the MakeFile:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
make

Download the Weights:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
wget https://pjreddie.com/media/files/yolov3.weights

Run YoloV3:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg

Next Steps:

This article is part of a mini-series that helps readers set up everything they need to start using WSL2 for artificial intelligence, machine learning, deep learning, and or data science. It includes articles that contain instructions with copy and paste code and screenshots that help readers get the outcome as soon as possible. It also includes articles that contain instructions with explanations and screenshots that help readers process what’s happening.

01. Install Windows Subsystem for Linux 2 (WSL2)
02. Install the NVIDIA CUDA Driver and Toolkit in WSL2
03. Install Software From Source Code in WSL2
04. Install the Jupyter Notebook Home and Public Server in WSL2
05. Install Virtual Environments in Jupyter Notebook in WSL2
06. Install Programs With a Graphical User Interface in WSL2
07. Install Ubuntu Desktop With a Graphical User Interface in WSL2

Hopefully, this article helped everyone get the prize. If you want to help out then hold the “👋” and click “Follow” to get more content. Thanks for reading!

--

--

David Littlefield
David Littlefield

Written by David Littlefield

From: Non-Technical | To: Technical Founder | Writes: To Make It Easier For Everyone | Topics: #Startups #How-To #Coding #AI #Machine Learning #Deep Learning

No responses yet