Skip to content

Commit 110192b

Browse files
authored
Merge pull request #4110 from canonical/platform-build-instructions
Reorganize platform build instructions
2 parents 81b4c05 + 35f7e43 commit 110192b

File tree

4 files changed

+181
-103
lines changed

4 files changed

+181
-103
lines changed

BUILD.linux.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Build instructions for Linux
2+
3+
## Environment Setup
4+
5+
### Build dependencies
6+
7+
```
8+
cd <multipass>
9+
sudo apt install devscripts equivs
10+
mk-build-deps -s sudo -i
11+
```
12+
13+
## Building
14+
15+
First, go into the repository root and get all the submodules:
16+
17+
```
18+
cd <multipass>
19+
git submodule update --init --recursive
20+
```
21+
22+
If building on arm, s390x, ppc64le, or riscv, you will need to set the `VCPKG_FORCE_SYSTEM_BINARIES` environment
23+
variable:
24+
25+
```
26+
export VCPKG_FORCE_SYSTEM_BINARIES=1
27+
```
28+
29+
Then create a build directory and run CMake.
30+
31+
```
32+
mkdir build
33+
cd build
34+
cmake ../
35+
```
36+
37+
This will fetch all necessary content, build vcpkg dependencies, and initialize the build system. You can also specify
38+
the `-DCMAKE_BUILD_TYPE` option to set the build type (e.g., `Debug`, `Release`, `Coverage`, etc.).
39+
40+
Finally, to build the project, run:
41+
42+
```
43+
cmake --build . --parallel
44+
```
45+
46+
Please note that if you're working on a forked repository that you created using the "Copy the main branch only" option,
47+
the repository will not include the necessary git tags to determine the Multipass version during CMake configuration. In
48+
this case, you need to manually fetch the tags from the upstream by running
49+
`git fetch --tags https://github.com/canonical/multipass.git` in the `<multipass>` source code directory.
50+
51+
## Run the Multipass daemon and client
52+
53+
First, install Multipass's runtime dependencies. On AMD64 architecture, you can do this with:
54+
55+
```
56+
sudo apt update
57+
sudo apt install libgl1 libpng16-16 libqt6core6 libqt6gui6 \
58+
libqt6network6 libqt6widgets6 libxml2 libvirt0 dnsmasq-base \
59+
dnsmasq-utils qemu-system-x86 qemu-utils libslang2 iproute2 \
60+
iptables iputils-ping libatm1 libxtables12 xterm
61+
```
62+
63+
Then run the Multipass daemon:
64+
65+
```
66+
sudo <multipass>/build/bin/multipassd &
67+
```
68+
69+
Copy the desktop file that Multipass clients expect to find in your home:
70+
71+
```
72+
mkdir -p ~/.local/share/multipass/
73+
cp <multipass>/data/multipass.gui.autostart.desktop ~/.local/share/multipass/
74+
```
75+
76+
Optionally, enable auto-complete in Bash:
77+
78+
```
79+
source <multipass>/completions/bash/multipass
80+
```
81+
82+
Now you can use the `multipass` command from your terminal (for example
83+
`<multipass>/build/bin/multipass launch --name foo`) or launch the GUI client with the command
84+
`<multipass>/build/bin/multipass.gui`.

BUILD.osx.md renamed to BUILD.macOS.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,48 @@ Build instructions for Mac OS
33

44
Environment Setup
55
-----------------
6+
67
### XCode
7-
Can be installed via the App Store. Once this is done, you may need to install the command line tooling too, to do this run:
8+
9+
Can be installed via the App Store. Once this is done, you may need to install the command line tooling too, to do this
10+
run:
811

912
xcode-select --install
1013

11-
Ensure you have development Frameworks for at least OS X 10.8 installed, with the typical compiler toolchain and "git". Avoid the version of cmake supplied, we need a newer one (see later).
14+
Ensure you have development Frameworks for at least OS X 10.8 installed, with the typical compiler toolchain and "git".
15+
Avoid the version of cmake supplied, we need a newer one (see later).
1216

1317
### Qt6
18+
1419
#### Option 1: Using Qt official sources
20+
1521
Install the latest stable version of Qt6 LTS (6.2.4 at the moment): <http://www.qt.io/download-open-source/>.
1622

17-
If it tells you that XCode 5.0.0 needs to be installed, go to XCode > Preferences > Locations and make a selection in the _Command Line Tools_ box.
23+
If it tells you that XCode 5.0.0 needs to be installed, go to XCode > Preferences > Locations and make a selection in
24+
the _Command Line Tools_ box.
1825

1926
Add Qt6 to your PATH environment variable, adding to your `.bash_profile` file the following line:
2027

2128
export PATH=$PATH:~/Qt/6.2.4/clang_64/bin
2229

2330
Adjust accordingly if you customized the Qt install directory.
2431

25-
#### Option 2: Using Homebrew
32+
#### Option 2: Using Homebrew
33+
2634
Install Qt6:
2735

2836
brew install qt6
2937

3038
### Cmake/OpenSSL
31-
Building a Multipass package requires cmake 3.9 or greater. OpenSSL is also necessary at build time. The most convenient means to obtain these dependencies is with Homebrew <https://brew.sh/>.
39+
40+
Building a Multipass package requires cmake 3.9 or greater. OpenSSL is also necessary at build time. The most convenient
41+
means to obtain these dependencies is with Homebrew <https://brew.sh/>.
3242

3343
brew install cmake openssl@3
3444

3545
Building
3646
---------------------------------------
47+
3748
cd <multipass>
3849
git submodule update --init --recursive
3950

@@ -45,7 +56,8 @@ Alternatively if using Qt6 from Homebrew, do
4556

4657
cmake -Bbuild -H. -GNinja -DCMAKE_PREFIX_PATH=/usr/local/opt/qt6
4758

48-
or, if on Apple silicon, brew will store the Qt binaries in a different location. Additionally, OpenSSL will be in a similar location; `/opt/homebrew/Cellar/openssl@3`, which can be set in the project level `CMakeLists.txt` file.
59+
or, if on Apple silicon, brew will store the Qt binaries in a different location. Additionally, OpenSSL will be in a
60+
similar location; `/opt/homebrew/Cellar/openssl@3`, which can be set in the project level `CMakeLists.txt` file.
4961

5062
cmake -Bbuild -H. -GNinja -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt6
5163

@@ -54,11 +66,15 @@ Then start the build with:
5466
cd build/
5567
ninja
5668

57-
Take care to adjust the `CMAKE_PREFIX_PATH` to the location you installed Qt above, or else cmake will complain about missing Qt6.
69+
Take care to adjust the `CMAKE_PREFIX_PATH` to the location you installed Qt above, or else cmake will complain about
70+
missing Qt6.
5871

5972
Building in QtCreator
6073
---------------------
61-
QtCreator will be missing all the environment adjustments made above. To get cmake to successfully configure, open the project and adjust the Build Environment (click the "Projects" icon of the left pane, scroll down). Then add the entries to the $PATH as above, and add the variables reported by `opem config env`. CMake should now succeed, and QtCreator allow you to edit the project files.
74+
QtCreator will be missing all the environment adjustments made above. To get cmake to successfully configure, open the
75+
project and adjust the Build Environment (click the "Projects" icon of the left pane, scroll down). Then add the entries
76+
to the $PATH as above, and add the variables reported by `opem config env`. CMake should now succeed, and QtCreator
77+
allow you to edit the project files.
6278

6379

6480
Creating a Package

BUILD.windows.md

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,54 @@ Build instructions for Windows 10
33

44
Environment Setup
55
-----------------
6+
67
### Chocolatey
8+
79
Install chocolatey, a package manager, to download the rest of the dependencies: <https://chocolatey.org/>
810

9-
Press Windows Key+X and Run Windows PowerShell(Admin) then follow the chocolatey instructions to "Install with Powershell.exe"
11+
Press Windows Key+X and Run Windows PowerShell(Admin) then follow the chocolatey instructions to "Install with
12+
Powershell.exe"
1013

1114
After chocolatey is installed you can now install the rest of the dependencies:
1215

1316
choco install visualstudio2019buildtools visualstudio2019-workload-vctools cmake ninja cmder qemu-img openssl -yfd
1417

15-
You may have to disable Windows Defender Real-time protection if you want the packages to install quicker.
16-
Search for Windows Defender Security Center, go to Virus & threat protection, then Virus and thread protection settings, disable Real-time protection.
18+
You may have to disable Windows Defender Real-time protection if you want the packages to install quicker. Search for
19+
Windows Defender Security Center, go to Virus & threat protection, then Virus and thread protection settings, disable
20+
Real-time protection.
1721

18-
NOTE: visualcpp-build-tools is only the installer package. For this reason, choco cannot detect any new compiler tool updates so choco upgrade
19-
will report no new updates available. To update the compiler and related tooling, you will need to search for "Add or remove programs",
20-
find "Microsoft Visual Studio Installer" and click "Modify".
22+
NOTE: visualcpp-build-tools is only the installer package. For this reason, choco cannot detect any new compiler tool
23+
updates so choco upgrade will report no new updates available. To update the compiler and related tooling, you will need
24+
to search for "Add or remove programs", find "Microsoft Visual Studio Installer" and click "Modify".
2125

2226
### Git
23-
You need to enable symlinks in Windows Git, have a look at [the git-for-windows docs](https://github.com/git-for-windows/git/wiki/Symbolic-Links).
27+
28+
You need to enable symlinks in Windows Git, have a look at
29+
[the git-for-windows docs](https://github.com/git-for-windows/git/wiki/Symbolic-Links).
2430

2531
### Qt6
32+
2633
Install the latest stable version of Qt6 (6.2.4 at the moment): <https://www.qt.io/download-thank-you?os=windows/>.
2734

2835
In the online installer, under Qt, select MSVC 2019 64-bit.
2936

3037
If you already have Qt installed, run the MaintenanceTool included in the Qt directory to update to the latest version.
3138

32-
Alternatively, download the [qtbase archive](https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt6_624/qt.qt6.624.win64_msvc2019_64/6.2.4-0-202203140926qtbase-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64.7z) and extract it to `C:\Qt` (so it ends up in `C:\Qt\6.2.4`).
39+
Alternatively, download the
40+
[qtbase archive](https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt6_624/qt.qt6.624.win64_msvc2019_64/6.2.4-0-202203140926qtbase-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64.7z)
41+
and extract it to `C:\Qt` (so it ends up in `C:\Qt\6.2.4`).
3342

3443
### Path setup
44+
3545
You'll have to manually add CMake and Qt to your account's PATH variable.
3646

37-
Search for "Edit environment variables for your account" then edit your Path variable.
38-
Add the following:
39-
`C:\Program Files\CMake\bin`
40-
`C:\Qt\6.2.4\msvc2019_64\bin`
47+
Search for "Edit environment variables for your account" then edit your Path variable. Add the following:
48+
49+
- `C:\Program Files\CMake\bin`
50+
- `C:\Qt\6.2.4\msvc2019_64\bin`
4151

4252
### Cmder setup
53+
4354
Cmder is a sane terminal emulator for windows, which includes git and SSH support among other things.
4455

4556
The following will setup a task that you can use to build things with the VS2019 compiler toolchain.
@@ -48,10 +59,10 @@ Run cmder which should be installed by default on C:\tools\cmder\Cmder.exe
4859
Click on the green "+" sign on the right lower corner of cmder
4960
Select "Setup tasks..."
5061
Click the "+" button to add a new task
51-
In the task parameters box add (basically copying from cmd:Cmder task):
52-
``/icon "%CMDER_ROOT%\icons\cmder.ico"``
62+
In the task parameters box add (basically copying from cmd:Cmder task):
63+
``/icon "%CMDER_ROOT%\icons\cmder.ico"``
5364
In the commands box, add:
54-
``cmd /k ""%ConEmuDir%\..\init.bat" && "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64" -new_console:d:%USERPROFILE%``
65+
``cmd /k ""%ConEmuDir%\..\init.bat" && "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64" -new_console:d:%USERPROFILE%``
5566

5667
Give the task a name (first box), such as vs2019 and click Save Settings.
5768

@@ -94,24 +105,28 @@ Running multipass
94105
---------------------------------------
95106

96107
### Enable Hyper-V
108+
97109
Before starting multipassd, you'll have to enable the Hyper-V functionality in Windows 10 Pro.
98110
See: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v
99111

100112
Press Windows Key + X, Select Windows PowerShell (Admin)
101113
Run "Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All"
102114

103115
### Start the daemon (multipassd)
116+
104117
Press Windows Key + X, Select Windows PowerShell (Admin)
105118
Run multipassd (for example: multipassd --logger=stderr)
106119
Alternatively, you can install multipassd as a Windows Service (Run "multipassd /install")
107120
To stop and uninstall the Windows service, Run "multipassd /uninstall"
108121

109122
### Run multipass
123+
110124
With the multipassd daemon now running on another shell (or as a windows service) you can now run multipass.
111125
Press Windows Key + X, Select Windows PowerShell, or alternatively run cmd.exe on the search bar
112126
Try "multipass help"
113127

114128
### Permissions/privileges for multipassd
129+
115130
multipassd needs Administrator privileges in order to create symlinks when using mounts and to manage Hyper-V instances.
116131

117132
If you don't need symlink support you can run multipassd on a less privileged shell but your user account

0 commit comments

Comments
 (0)