Closed leet4tari closed 2 years ago
First problem ran into, is that doing a cargo build
on a vagrant synced folder, breaks mostly at the randomx compile.
error: failed to run custom build command for `randomx-rs v0.1.2`
Caused by:
process didn't exit successfully: `/vagrant/tari/target/release/build/randomx-rs-16788db1e04085a7/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Failed to clone RandomX: failed to mmap. Could not write data: Invalid argument; class=Os (2)', /home/vagrant/.cargo/registry/src/github.com-1ecc6299db9ec823/randomx-rs-0.1.2/build.rs:159:19
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed
Just build on the VM file system and not on a synced folder, until we find a fix.
Used https://github.com/Dentosal/rust_os/blob/master/Vagrantfile as a base to bootstrap a VM to do the basenode build for Ubuntu 18.04
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "generic/ubuntu1804"
# 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.define "ubuntu-build"
config.vm.hostname = "ubuntu-build"
config.vm.provider "virtualbox" do |vb|
vb.memory = "8192"
vb.cpus = "8" # makes the initial setup much faster
vb.name = "ubuntu-build"
end
config.vm.synced_folder "shared", "/vagrant", disabled: false
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.auto_detect = true # If you are using VirtualBox, you might want to enable NFS for shared folders
#config.cache.scope = :box
#config.cache.enable_nfs = true
end
# Install rust osdev toolkit and some standard utilities
# these run as user vagrant instead of root
config.vm.provision "shell", privileged: false, inline: <<-SHELL
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
# Fix grub update issue
sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install grub-pc
sudo apt-get upgrade -y
sudo apt-get --purge autoremove -y
sudo apt-get install python3.7 python3.7-dev python3-pip -y
sudo apt-get install vim git nasm -y
#sudo apt-get install xorriso -y
sudo apt-get install texinfo flex bison python-dev ncurses-dev -y
sudo apt-get install cmake libssl-dev -y
mkdir -p ~/.cache/pip/http
sudo python3.7 -m pip install --upgrade pip
sudo python3.7 -m pip install requests toml natsort
#curl -sf https://raw.githubusercontent.com/phil-opp/binutils-gdb/rust-os/build-rust-os-gdb.sh | sh
if hash rustup; then
rustup update
else
curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
fi
rustup component add rustfmt
export PATH="$HOME/.cargo/bin:$HOME/.bin:$PATH"
rustup component add rust-src
cargo install --force cargo-xbuild
git clone https://github.com/Dentosal/factory.git /tmp/factory || true
cd /tmp/factory
git pull
PYTHON_SYS_EXECUTABLE=python3.7 cargo install --path . --force
cd -
git clone https://github.com/Dentosal/constcodegen.git /tmp/constcodegen || true
cd /tmp/constcodegen
git pull
PYTHON_SYS_EXECUTABLE=python3.7 cargo install --path . --force
cd -
echo "export PATH="$HOME/.cargo/bin:$PATH"; cd /vagrant" >> $HOME/.bashrc
# tari build requires
sudo apt-get -y install pkg-config libssl-dev libsqlite3-dev clang cmake libc++-dev libc++abi-dev
SHELL
end
Create Ansible role to apply a security baseline.
Quick and easier ways to build. Closing issue.
Using vagrant to build and run a basenode, as cleanly as possible.