Development and Build Environment Setup for VESC Tool
This howto is unfortunately outdated and no longer works. Please see comments below.
This guide lists the steps necessary to produce a development and build environment for the VESC Tool application, including building the Android APK package.
The below steps describe how to:
- Create an Ubuntu Linux virtual machine
- Install the required development and build tools and their dependencies
- Deploy the VESC Tool project source code
- Produce a distributable Android installer package for the mobile VESC Tool app.
This guide roughly follows the currently incomplete notes at https://vesc-project.com/node/310
The vesc_tool source code can be found on Github at https://github.com/vedderb/vesc_tool
Create a Virtual Machine
- Deploy a standard Ubuntu 18.04 desktop virtual machine. See this howto guide if needed
- 4GB of RAM will suffice, 8GB is recommended
- The VESC Tool build environment will consume at least 25GB, so a 40GB virtual disk is recommended for your VM
- Ensure the VM has Internet access
- If you're using VirtualBox, it is recommended you install Guest Addons to enable shared folders and copy/paste via Devices -> Shared Clpboard -> Bidirectional
This guide is based on Ubuntu 18.04. After booting for the first time, you may be prompted to upgrade to Ubuntu 20.04 or later. While 20.04 is reported to work for building VESC Tool, it is recommended to remain on 18.04 to guarantee the steps in this guide work as expected. It is fine to apply all software updates available for 18.04 if prompted.
Set up the Build Environment
Install System Deps
- From within the VM, start a terminal and issue the following commands:
sudo add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
sudo apt update
sudo apt upgrade -y
sudo apt install -y build-essential openocd libudev-dev libqt4-dev gcc-arm-embedded libxcb-xinerama0 libxcb-xinerama0-dev openjdk-8-jdk git mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev
Install Qt 5.12.7
Get the open source QT Online installer by browsing to https://www.qt.io/download-qt-installer in your VM and clicking the "Download" link. As of this writing, the file will be named
Install the Qt tools by typing the following at the command prompt:
chmod +x qt*.run
A GUI Installer will appear. Proceed as follows:
- You will be prompted for your QT Account login. Create one if required and enter your credentials.
- Agree to the LGPL obligations as prompted.
- Respond to the "Contribute to Qt..." question as desired
- In the "Installation Folder" section:
/opt/Qt3as the installation directory
- Click "Custom Installation" checkbox
- Click Next
- In the "Select Components" section:
- Ensure "Archive" checkbox is selected
- Click the "Filter" button
- Expand the selection tree under "Qt" and click checkbox for "Qt 5.12.7"
- Click Next
- Agree to the license agreement, click Next
- Click Install
Qt components will now be downloaded and installed. This process may take several hours (experienced download speeds were in the range of 20kbps to 150kbps). Once done, click Next, Finish. QtCreator should now be installed and launchable from the menu.
Install Android SDK and NDK
- Launch QtCreator
- Go to: Tools -> Options -> Devices -> Android
- Click "Setup SDK", click "Yes" to install Android SDK to suggested default location (~/Android/Sdk), click "Yes" and "Ok" to install missing necessary packages.
- Click "Yes" to review Android SDK Licenses, click "Yes" to accept 6 licenses
- The following packages will be installed by the above process:
Android SDK Build-Tools 30.0.2
Android SDK Platform-Tools
NDK (Side by side) 21.3.6528147
Android SDK Command-line Tools (latest)
Android SDK Platform 30
- click "Ok" to close the Options and return to QtCreator main window
Download the latest VESC Tool source code
To obtain the VESC Tool project source code, type in a terminal:
git clone https://github.com/vedderb/vesc_tool.git
Build the VESC Tool
Building within QtCreator
- In QtCreator, click File -> Open File or Project -> open
vesc_tool.profrom the git project in the
- Click "Configure Project"
- Click Build -> Build Project "vesc_tool". The build should succeed.
Build the VESC Tool Android App from the CLI
This process uses the
build_android script provided in the VESC Tool source tree.
First, setup some directory dependencies expected by the build script:
ln -s /home/user/Android/Sdk/ndk/21.3.6528147 /home/user/Android/Latest/Ndk
ln -s /home/user/Android/Sdk /home/user/Android/Latest/Sdk
Run the build:
The build should succeed and final APK package will be written to
/home/user/development/vesc_tool/build/android/vesc_tool_android.zip. The zip will contain a file "vesc_tool_mobile.apk" that was successfully installed and tested on an Android 11 phone.