Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add basic clean virtualised linux install and build notes #784

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions buildtools/build-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
## Build Notes we don't want to lose?

Build options:
- Native
- Docker
- Virtualised
- Emulated

# Building Linux x86_64 & ARM64

Using Vagrant and VirtualBox has a baseline for building needs, including tools, libs and testing

Linux ARM64 can be built using Vagrant and VirtualBox or Docker and cross

# Prep Ubuntu for development
# From - https://github.com/tari-project/tari-dan/blob/development/scripts/install_ubuntu_dependencies.sh
```bash
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \
apt-transport-https \
ca-certificates \
curl \
gpg \
openssl \
libssl-dev \
pkg-config \
libsqlite3-dev \
git \
cmake \
dh-autoreconf \
libc++-dev \
libc++abi-dev \
libprotobuf-dev \
protobuf-compiler \
libncurses5-dev \
libncursesw5-dev \
build-essential \
zip
```

# Install rust
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
# or unattended rust install
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
```

```bash
source "$HOME/.cargo/env"
```

# Install wasm prerequisite
```bash
rustup target add wasm32-unknown-unknown
```

# Install nodejs prerequisite
```bash
export NODE_MAJOR=20
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | \
sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | \
sudo tee /etc/apt/sources.list.d/nodesource.list

sudo apt-get update

sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \
nodejs
```

# Prep Ubuntu for cross-compile aarch64/arm64 on x86_64
```bash
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \
pkg-config-aarch64-linux-gnu \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu
```

# Prep rust for cross-compile aarch64/arm64 on x86_64
```bash
rustup target add aarch64-unknown-linux-gnu
rustup toolchain install stable-aarch64-unknown-linux-gnu
```

# Check was tools chains rust has in place
```bash
rustup target list --installed
rustup toolchain list
```

# get/git the code base
```bash
mkdir -p ~/src
cd ~/src
git clone [email protected]:tari-project/tari-dan.git
cd tari-dan
```

# Build Testing
```bash
cargo build \
--target aarch64-unknown-linux-gnu \
--bin tari_dan_wallet_cli
```

# Build target Release
```bash
cargo build --locked --release \
--target aarch64-unknown-linux-gnu
```

# Using a single command line build using Docker
```bash
cross build --locked --release \
--target aarch64-unknown-linux-gnu
```
2 changes: 2 additions & 0 deletions buildtools/vagrant/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vagrant
*.log
41 changes: 41 additions & 0 deletions buildtools/vagrant/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
config.vm.box_check_update = false

# https://subscription.packtpub.com/book/virtualization_and_cloud/9781786464910/1/ch01lvl1sec12/enabling-virtualbox-guest-additions-in-vagrant
# vagrant vbguest --status
# vagrant vbguest --do install
if Vagrant.has_plugin?("vagrant-vbguest") then
config.vbguest.auto_update = false
end

# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"

# virtualbox settings
config.vm.provider :virtualbox do |vb|
vb.cpus = 4
vb.memory = 6*1024
vb.gui = false
vb.linked_clone = true
end

# Enable provisioning with a shell script. Additional provisioners such as
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
end
20 changes: 20 additions & 0 deletions scripts/install_ubuntu_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apt-get install --no-install-recommends --assume-yes \
apt-transport-https \
ca-certificates \
curl \
gpg \
openssl \
libssl-dev \
pkg-config \
libsqlite3-dev \
git \
cmake \
dh-autoreconf \
libc++-dev \
libc++abi-dev \
libprotobuf-dev \
protobuf-compiler \
libncurses5-dev \
libncursesw5-dev \
build-essential \
zip
Loading