Windows Subsystem for Linux (WSL)
In Windows 10 and 11, the Windows Subsystem for Linux (WSL) can be enabled in Windows Features, or installed from Microsoft Store. WSL requires that virtualization is enabled in BIOS settings, and that virtual machine environment is enabled in the Windows Features. Supported Linux distributions, including Ubuntu, can then be installed from the Windows Store. This adds bash terminal to your Windows 10 platform, enabling you to compile and execute Linux CLI programs in it, and to execute bash scripts.
Notice that Windows disks and directories are found in Ubuntu under
For example, Windows folder
C:\Seafile can be accessed as
Processes like compilation that are highly dependent on time stamps should not be performed in
Windows disks to prevent "modification time is in future" errors. Use your Linux home directory
You can open a Windows File Explorer window directly in the current directory from within a Linux shell environment by typing the following command into the Bash shell:
You can work with files normally from here, even open them directly in Windows applications
to modify them.
File explorer shows the Windows folder where your Bash home directory is located in Windows,
for example folder
While editing files via File explorer is safe, other means for accessing the files from Windows
may not work well and edited files may seem to disappear from the Bash;
touch in Bash may reinstate the file, but safest option may be to copy file
to a temporary location for editing and then copy the edited file back to its position.
You can check which version of Ubuntu is installed with command:
When a new LTS release of Ubuntu is available, it can be updated with command:
In the Bash on Windows, go to your home directory, and list its contents:
cd ls -al
In the home directory (usually
/home/username) the hidden files
.profile contain settings that may need to be changed, but preferred method is to
leave these files as they are, and instead create a file
the required settings.
For example, with the following contents of
.bash_aliases you can modify
PATH so that it includes the path to the
TPCCLIB Linux binaries
(in your system the folder is probably different):
If Windows language is not English, you may also want set the language in bash to English:
, or in WSL shell with command:
sudo update-locale LANG=en_US.UTF8
You need to relaunch bash for these changes to take effect.
Configuration files can be viewed in Windows Explorer.
Compiling TPCCLIB in WSL
After installing the Bash on Windows, you will need to update it, and install the necessary toolchains:
sudo apt update sudo apt upgrade sudo apt dist-upgrade sudo apt install build-essential sudo apt install cmake sudo apt install doxygen
After that you can follow the general
instructions on compiling the TPCCLIB libraries
and executables. Makefile system generator does not need to be defined with CMake in WSL,
that is, option
-G is not necessary.
Compiling for Linux
In order to compile binaries for Linux, install for WSL, test, and make Linux binary package,
enter the following commands (changing paths as necessary), assuming that source codes are in path
cd ~/git/tpcclib/ mkdir build cd build cmake ../src make -j 4 install ctest --output-on-failure --parallel 4 make package
Cross-compiling for Windows
It is possible to cross-compile Windows binaries in WSL. To do so, you must first install mingw-w64 in WSL. Notice that it will take some time and over 1 Gb disk space.
sudo apt install mingw-w64 sudo apt install gcc-5-locales
CMake needs toolchain files, which are provided in the source package for 64-bit and 32-bit compilation. Example for building 64-bit binaries for Windows:
cd ~/git/tpcclib mkdir mw64 cd mw64 cmake -DCMAKE_TOOLCHAIN_FILE=../src/toolchain-cross-mingw64-linux.cmake ../src make -j 4 install make package
For building 32-bit binaries for Windows you just need to use different toolchain file:
cmake -DCMAKE_TOOLCHAIN_FILE=../src/toolchain-cross-mingw32-linux.cmake ../src
- Software development in TPC
- TPCCLIB development in Linux
- PET software
- List of TPCCLIB software
- TPCCLIB source codes
- Command-line interface (CLI)
Blum R, Bresnahan C. Linux Command Line and Shell Scripting Bible. 3rd ed., Wiley, 2015, ISBN: 978-1-118-98384-3.
Janssens J. Data Science at the Command Line. O'Reilly, 2014, ISBN 978-1-491-94785-2.
Pro Bash Programming (buy e-book from Apress)
van Vugt S: Beginning the Linux Command Line, 2nd edition. Apress, 2015. ISBN 978-1-4302-6829-1.
Wikibooks: Bash Shell Scripting
Updated at: 2021-10-20
Created at: 2016-08-03
Written by: Vesa Oikonen