I like to work in evergui/evergui24:latest (everpanel deployable, ubuntu24, shows up on your browser with https and gptcp1 port. Password is default)
Of course, this is done on a disposable instance, so there's probably security risks of doing this on your personal computer. Only do it in a virtual machine that u don't care about
Code: Select all
#!/usr/bin/env bash
set -Eeuo pipefail
# ============================================================
# Sashimono development environment setup
# Ubuntu / Debian
#
# Installs:
# - C/C++ build tools
# - CMake / Git
# - Boost / libsodium / OpenSSL / SQLite / zlib
# - Clang / LLD
# - WABT: wasm2wat, wat2wasm, wasm-objdump
# - Node.js / npm
# - @vercel/ncc
# - CLI11 2.4.2
# - jsoncons 1.4.1
# - moodycamel concurrentqueue
# - moodycamel readerwriterqueue
# - plog 1.1.5
# - wasienv / wasmcc
# - RichardAH/hook-cleaner-c
#
# Does NOT clone/build Sashimono.
#
# Run as your NORMAL user:
# bash ./sashimono-dev-deps-fixed.sh
#
# Do NOT run the whole script with sudo.
# ============================================================
if [[ "${EUID}" -eq 0 ]]; then
echo "ERROR: Run this as your normal development user, not root."
exit 1
fi
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
echo "=========================================="
echo "1. Installing system dependencies"
echo "=========================================="
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
cmake \
git \
curl \
wget \
ca-certificates \
pkg-config \
python3 \
python3-pip \
python3-venv \
libsodium-dev \
libssl-dev \
libsqlite3-dev \
libboost-all-dev \
zlib1g-dev \
jq \
wabt \
clang \
lld
echo
echo "=========================================="
echo "2. Setting up local PATH"
echo "=========================================="
mkdir -p "$HOME/.local/bin"
LOCAL_PATH_LINE='export PATH="$HOME/.local/bin:$PATH"'
grep -Fqx "$LOCAL_PATH_LINE" "$HOME/.bashrc" 2>/dev/null || \
echo "$LOCAL_PATH_LINE" >> "$HOME/.bashrc"
export PATH="$HOME/.local/bin:$PATH"
echo
echo "=========================================="
echo "3. Installing CLI11 2.4.2"
echo "=========================================="
git clone --depth 1 --branch v2.4.2 \
https://github.com/CLIUtils/CLI11.git \
"$TMP_DIR/CLI11"
cmake -S "$TMP_DIR/CLI11" -B "$TMP_DIR/CLI11/build" \
-DCLI11_BUILD_EXAMPLES=OFF \
-DCLI11_BUILD_TESTS=OFF
cmake --build "$TMP_DIR/CLI11/build" --parallel "$(nproc)"
sudo cmake --install "$TMP_DIR/CLI11/build"
echo
echo "=========================================="
echo "4. Installing jsoncons 1.4.1"
echo "=========================================="
git clone --depth 1 --branch v1.4.1 \
https://github.com/danielaparker/jsoncons.git \
"$TMP_DIR/jsoncons"
sudo rm -rf \
/usr/local/include/jsoncons \
/usr/local/include/jsoncons_ext
sudo cp -a "$TMP_DIR/jsoncons/include/jsoncons" /usr/local/include/
if [[ -d "$TMP_DIR/jsoncons/include/jsoncons_ext" ]]; then
sudo cp -a "$TMP_DIR/jsoncons/include/jsoncons_ext" /usr/local/include/
fi
echo
echo "=========================================="
echo "5. Installing moodycamel queues"
echo "=========================================="
git clone --depth 1 \
https://github.com/cameron314/concurrentqueue.git \
"$TMP_DIR/concurrentqueue"
sudo install -m 0644 \
"$TMP_DIR/concurrentqueue/concurrentqueue.h" \
"$TMP_DIR/concurrentqueue/blockingconcurrentqueue.h" \
"$TMP_DIR/concurrentqueue/lightweightsemaphore.h" \
/usr/local/include/
git clone --depth 1 \
https://github.com/cameron314/readerwriterqueue.git \
"$TMP_DIR/readerwriterqueue"
sudo mkdir -p /usr/local/include/readerwriterqueue
sudo install -m 0644 \
"$TMP_DIR/readerwriterqueue/readerwriterqueue.h" \
"$TMP_DIR/readerwriterqueue/atomicops.h" \
"$TMP_DIR/readerwriterqueue/readerwritercircularbuffer.h" \
/usr/local/include/readerwriterqueue/
echo
echo "=========================================="
echo "6. Installing plog 1.1.5"
echo "=========================================="
git clone --depth 1 --branch 1.1.5 \
https://github.com/SergiusTheBest/plog.git \
"$TMP_DIR/plog"
sudo rm -rf /usr/local/include/plog
sudo cp -a "$TMP_DIR/plog/include/plog" /usr/local/include/
echo
echo "=========================================="
echo "7. Ensuring Node.js, npm and @vercel/ncc"
echo "=========================================="
# Do NOT install "nodejs npm" together in the main apt command.
# NodeSource's nodejs package already includes npm and conflicts with the
# separate Ubuntu npm package. This logic works with either packaging style.
if ! command -v node >/dev/null 2>&1; then
echo "Node.js not found. Installing nodejs..."
sudo apt-get install -y nodejs
fi
if ! command -v npm >/dev/null 2>&1; then
echo "npm not found after installing/detecting Node.js."
echo "Installing the separate npm package (needed by Ubuntu's split packaging)..."
sudo apt-get install -y npm
fi
echo "node: $(node --version)"
echo "npm: $(npm --version)"
if ! command -v ncc >/dev/null 2>&1; then
echo "Installing @vercel/ncc globally..."
sudo npm install -g @vercel/ncc
fi
hash -r
command -v ncc >/dev/null 2>&1 || {
echo "ERROR: @vercel/ncc installation completed but 'ncc' is not on PATH."
exit 1
}
echo "ncc: $(ncc --version)"
echo
echo "=========================================="
echo "8. Installing wasienv / wasmcc"
echo "=========================================="
# Remove failed/partial wasienv setup from previous attempts.
rm -rf "$HOME/.wasienv"
mkdir -p "$HOME/.wasienv/bin"
# Isolate the Python package in its own venv.
python3 -m venv "$HOME/.wasienv/venv"
"$HOME/.wasienv/venv/bin/python" -m pip install --upgrade pip setuptools wheel
"$HOME/.wasienv/venv/bin/python" -m pip install wasienv
# The Python package installs ALL console wrappers in venv/bin.
# Put that directory on PATH. This is the key fix for wasmcc.
cat > "$HOME/.wasienv/wasienv.sh" <<'EOF'
export WASIENV_DIR="$HOME/.wasienv"
export PATH="$WASIENV_DIR/venv/bin:$WASIENV_DIR/bin:$HOME/.local/bin:$PATH"
EOF
. "$HOME/.wasienv/wasienv.sh"
WASIENV_BASHRC_LINE='. "$HOME/.wasienv/wasienv.sh"'
grep -Fqx "$WASIENV_BASHRC_LINE" "$HOME/.bashrc" 2>/dev/null || {
echo >> "$HOME/.bashrc"
echo '# wasienv / wasmcc' >> "$HOME/.bashrc"
echo "$WASIENV_BASHRC_LINE" >> "$HOME/.bashrc"
}
echo
echo "wasienv executable:"
command -v wasienv
echo
echo "wasmcc wrapper before SDK install:"
command -v wasmcc
echo
echo "Installing WASI SDK..."
wasienv install-sdk unstable
echo
echo "Selecting default WASI SDK..."
wasienv default-sdk unstable
# Refresh shell command cache/PATH.
. "$HOME/.wasienv/wasienv.sh"
hash -r
echo
echo "=========================================="
echo "9. Building RichardAH Hook Cleaner"
echo "=========================================="
if [[ ! -d "$HOME/hook-cleaner-c/.git" ]]; then
git clone \
https://github.com/RichardAH/hook-cleaner-c.git \
"$HOME/hook-cleaner-c"
else
echo "hook-cleaner-c already exists; updating."
git -C "$HOME/hook-cleaner-c" pull --ff-only
fi
make -C "$HOME/hook-cleaner-c" clean 2>/dev/null || true
make -C "$HOME/hook-cleaner-c"
install -m 0755 \
"$HOME/hook-cleaner-c/hook-cleaner" \
"$HOME/.local/bin/hook-cleaner"
echo
echo "=========================================="
echo "10. Verification"
echo "=========================================="
echo "--- gcc ---"
gcc --version | head -1
echo "--- g++ ---"
g++ --version | head -1
echo "--- cmake ---"
cmake --version | head -1
echo "--- clang ---"
clang --version | head -1
echo "--- node ---"
node --version
echo "--- npm ---"
npm --version
echo "--- ncc ---"
command -v ncc
ncc --version
echo "--- WABT ---"
command -v wasm2wat
command -v wat2wasm
command -v wasm-objdump
echo "--- wasienv ---"
command -v wasienv
echo "--- wasmcc ---"
command -v wasmcc
echo "--- wasicc ---"
command -v wasicc
echo "--- hook-cleaner ---"
command -v hook-cleaner
echo
echo "--- C++ headers ---"
for header in \
/usr/local/include/CLI/CLI.hpp \
/usr/local/include/jsoncons/json.hpp \
/usr/local/include/concurrentqueue.h \
/usr/local/include/blockingconcurrentqueue.h \
/usr/local/include/lightweightsemaphore.h \
/usr/local/include/readerwriterqueue/readerwriterqueue.h \
/usr/local/include/plog/Log.h
do
[[ -f "$header" ]] || {
echo "ERROR: missing $header"
exit 1
}
echo "OK: $header"
done
echo
echo "=========================================="
echo "DEVELOPMENT ENVIRONMENT READY"
echo "=========================================="
echo
echo "wasienv: $(command -v wasienv)"
echo "wasmcc: $(command -v wasmcc)"
echo "wasicc: $(command -v wasicc)"
echo "hook-cleaner: $(command -v hook-cleaner)"
echo "ncc: $(command -v ncc)"
echo "wasm2wat: $(command -v wasm2wat)"
echo
echo "Open a new shell, or run:"
echo
echo " . ~/.bashrc"
echo
echo "Done."
Working Today
UBUNTU 20 Compiler Dependencies
Compile in VNC enviorement, I use image everbackup/markz:latest--gptcp1--36525 and VNC Viewer for this.
Code: Select all
#!/usr/bin/env bash
set -Eeuo pipefail
# ============================================================
# Sashimono v1.0.0 development environment
# Ubuntu 20.04 reproduction environment
#
# IMPORTANT:
# Run as your NORMAL user.
# Do NOT run the whole script with sudo.
#
# Purpose:
# Reproduce the historical Ubuntu-20/GCC-9 build environment
# as closely as practical.
#
# Sashimono v1.0.0's own dev-setup.sh used:
# CMake 3.16.0-rc3
# jsoncons 0.153.3
# plog 1.1.5
# readerwriterqueue 1.0.3
# concurrentqueue 1.0.2
# CLI11 2.0.0
# Node.js 20.x
# ============================================================
die() {
echo
echo "============================================================"
echo "ERROR: $*"
echo "============================================================"
exit 1
}
if [[ "${EUID}" -eq 0 ]]; then
die "Run this as your normal development user, not root."
fi
if [[ ! -r /etc/os-release ]]; then
die "Cannot determine operating system."
fi
. /etc/os-release
if [[ "${ID:-}" != "ubuntu" || "${VERSION_ID:-}" != "20.04" ]]; then
die "This script is intended for Ubuntu 20.04. Detected: ${PRETTY_NAME:-unknown}"
fi
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
echo "============================================================"
echo " Sashimono Ubuntu 20.04 development environment"
echo "============================================================"
echo "OS: ${PRETTY_NAME}"
echo
echo "============================================================"
echo "1. Installing Ubuntu packages"
echo "============================================================"
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
git \
wget \
curl \
ca-certificates \
gnupg \
pkg-config \
python3 \
python3-pip \
python3-venv \
libssl-dev \
libsodium-dev \
sqlite3 \
libsqlite3-dev \
libboost-stacktrace-dev \
fuse3 \
jq \
bind9-host \
clang \
lld \
wabt \
binaryen
echo
echo "============================================================"
echo "2. Checking GCC"
echo "============================================================"
gcc --version | head -1
g++ --version | head -1
if ! gcc --version | head -1 | grep -q '9\.4\.0'; then
echo
echo "WARNING:"
echo "Known-good sagent reports GCC 9.4.0."
echo "This machine is using:"
gcc --version | head -1
echo
echo "The build may work, but an exact binary match is less likely."
fi
echo
echo "============================================================"
echo "3. Installing CMake 3.16.0-rc3"
echo "============================================================"
CMAKE_NAME="cmake-3.16.0-rc3-Linux-x86_64"
cd "$TMP_DIR"
wget -q --show-progress \
"https://github.com/Kitware/CMake/releases/download/v3.16.0-rc3/${CMAKE_NAME}.tar.gz"
tar -xzf "${CMAKE_NAME}.tar.gz"
sudo cp -a "${CMAKE_NAME}/bin/." /usr/local/bin/
sudo cp -a "${CMAKE_NAME}/share/." /usr/local/share/
hash -r
echo "cmake: $(cmake --version | head -1)"
echo
echo "============================================================"
echo "4. Installing jsoncons 0.153.3"
echo "============================================================"
cd "$TMP_DIR"
wget -q --show-progress \
"https://github.com/danielaparker/jsoncons/archive/v0.153.3.tar.gz" \
-O jsoncons-0.153.3.tar.gz
tar -xzf jsoncons-0.153.3.tar.gz
sudo rm -rf \
/usr/local/include/jsoncons \
/usr/local/include/jsoncons_ext
sudo cp -a \
"$TMP_DIR/jsoncons-0.153.3/include/jsoncons" \
/usr/local/include/
sudo mkdir -p /usr/local/include/jsoncons_ext
if [[ -d "$TMP_DIR/jsoncons-0.153.3/include/jsoncons_ext/bson" ]]; then
sudo cp -a \
"$TMP_DIR/jsoncons-0.153.3/include/jsoncons_ext/bson" \
/usr/local/include/jsoncons_ext/
fi
echo
echo "============================================================"
echo "5. Installing plog 1.1.5"
echo "============================================================"
cd "$TMP_DIR"
wget -q --show-progress \
"https://github.com/SergiusTheBest/plog/archive/1.1.5.tar.gz" \
-O plog-1.1.5.tar.gz
tar -xzf plog-1.1.5.tar.gz
sudo rm -rf /usr/local/include/plog
sudo cp -a \
"$TMP_DIR/plog-1.1.5/include/plog" \
/usr/local/include/
echo
echo "============================================================"
echo "6. Installing readerwriterqueue 1.0.3"
echo "============================================================"
cd "$TMP_DIR"
wget -q --show-progress \
"https://github.com/cameron314/readerwriterqueue/archive/v1.0.3.tar.gz" \
-O readerwriterqueue-1.0.3.tar.gz
tar -xzf readerwriterqueue-1.0.3.tar.gz
cmake \
-S "$TMP_DIR/readerwriterqueue-1.0.3" \
-B "$TMP_DIR/readerwriterqueue-1.0.3/build"
cmake --build \
"$TMP_DIR/readerwriterqueue-1.0.3/build" \
--parallel "$(nproc)"
sudo cmake --install \
"$TMP_DIR/readerwriterqueue-1.0.3/build"
echo
echo "============================================================"
echo "7. Installing concurrentqueue 1.0.2"
echo "============================================================"
cd "$TMP_DIR"
wget -q --show-progress \
"https://github.com/cameron314/concurrentqueue/archive/1.0.2.tar.gz" \
-O concurrentqueue-1.0.2.tar.gz
tar -xzf concurrentqueue-1.0.2.tar.gz
sudo install -m 0644 \
"$TMP_DIR/concurrentqueue-1.0.2/concurrentqueue.h" \
/usr/local/include/concurrentqueue.h
echo
echo "============================================================"
echo "8. Installing CLI11 2.0.0"
echo "============================================================"
cd "$TMP_DIR"
wget -q --show-progress \
"https://github.com/CLIUtils/CLI11/archive/refs/tags/v2.0.0.tar.gz" \
-O CLI11-2.0.0.tar.gz
tar -xzf CLI11-2.0.0.tar.gz
cmake \
-S "$TMP_DIR/CLI11-2.0.0" \
-B "$TMP_DIR/CLI11-2.0.0/build" \
-DCLI11_BUILD_EXAMPLES=OFF \
-DCLI11_BUILD_TESTS=OFF
cmake --build \
"$TMP_DIR/CLI11-2.0.0/build" \
--parallel "$(nproc)"
sudo cmake --install \
"$TMP_DIR/CLI11-2.0.0/build"
echo
echo "============================================================"
echo "9. Installing Node.js 20"
echo "============================================================"
sudo mkdir -p /etc/apt/keyrings
curl -fsSL \
https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key |
gpg --dearmor |
sudo tee /etc/apt/keyrings/nodesource.gpg >/dev/null
echo \
"deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" |
sudo tee /etc/apt/sources.list.d/nodesource.list >/dev/null
sudo apt-get update
sudo apt-get install -y nodejs
echo "node: $(node --version)"
echo "npm: $(npm --version)"
echo
echo "============================================================"
echo "10. Installing @vercel/ncc"
echo "============================================================"
if ! command -v ncc >/dev/null 2>&1; then
sudo npm install -g @vercel/ncc
fi
hash -r
command -v ncc >/dev/null || die "ncc is not available."
echo "ncc: $(ncc --version)"
echo
echo "============================================================"
echo "11. Local PATH"
echo "============================================================"
mkdir -p "$HOME/.local/bin"
LOCAL_PATH_LINE='export PATH="$HOME/.local/bin:$PATH"'
grep -Fqx "$LOCAL_PATH_LINE" "$HOME/.bashrc" 2>/dev/null || \
echo "$LOCAL_PATH_LINE" >> "$HOME/.bashrc"
export PATH="$HOME/.local/bin:$PATH"
echo
echo "============================================================"
echo "12. Optional wasienv / wasmcc tooling"
echo "============================================================"
# This tooling is kept because your Ubuntu-24 environment contained it.
# It is not used to select the compiler for sagent itself.
rm -rf "$HOME/.wasienv"
mkdir -p "$HOME/.wasienv/bin"
python3 -m venv "$HOME/.wasienv/venv"
"$HOME/.wasienv/venv/bin/python" \
-m pip install --upgrade pip setuptools wheel
"$HOME/.wasienv/venv/bin/python" \
-m pip install wasienv
cat > "$HOME/.wasienv/wasienv.sh" <<'EOF'
export WASIENV_DIR="$HOME/.wasienv"
export PATH="$WASIENV_DIR/venv/bin:$WASIENV_DIR/bin:$HOME/.local/bin:$PATH"
EOF
. "$HOME/.wasienv/wasienv.sh"
WASIENV_BASHRC_LINE='. "$HOME/.wasienv/wasienv.sh"'
grep -Fqx "$WASIENV_BASHRC_LINE" "$HOME/.bashrc" 2>/dev/null || {
echo >> "$HOME/.bashrc"
echo '# wasienv / wasmcc' >> "$HOME/.bashrc"
echo "$WASIENV_BASHRC_LINE" >> "$HOME/.bashrc"
}
if command -v wasienv >/dev/null 2>&1; then
echo "wasienv: $(command -v wasienv)"
# This is intentionally not involved in the sagent C++ compiler.
wasienv install-sdk unstable
wasienv default-sdk unstable
. "$HOME/.wasienv/wasienv.sh"
hash -r
fi
echo
echo "============================================================"
echo "13. Hook Cleaner"
echo "============================================================"
if [[ ! -d "$HOME/hook-cleaner-c/.git" ]]; then
git clone \
https://github.com/RichardAH/hook-cleaner-c.git \
"$HOME/hook-cleaner-c"
else
git -C "$HOME/hook-cleaner-c" pull --ff-only
fi
make -C "$HOME/hook-cleaner-c" clean 2>/dev/null || true
make -C "$HOME/hook-cleaner-c"
install -m 0755 \
"$HOME/hook-cleaner-c/hook-cleaner" \
"$HOME/.local/bin/hook-cleaner"
echo
echo "============================================================"
echo "14. Verification"
echo "============================================================"
echo "--- OS ---"
cat /etc/os-release | grep -E '^(PRETTY_NAME|VERSION_ID)='
echo
echo "--- GCC ---"
gcc --version | head -1
g++ --version | head -1
echo
echo "--- GLIBC ---"
ldd --version | head -1
echo
echo "--- CMake ---"
cmake --version | head -1
echo
echo "--- Node ---"
node --version
npm --version
echo
echo "--- NCC ---"
ncc --version
echo
echo "--- Headers ---"
for header in \
/usr/local/include/CLI/CLI.hpp \
/usr/local/include/jsoncons/json.hpp \
/usr/local/include/concurrentqueue.h \
/usr/local/include/readerwriterqueue/readerwriterqueue.h \
/usr/local/include/plog/Log.h
do
[[ -f "$header" ]] || die "Missing header: $header"
echo "OK: $header"
done
echo
echo "--- WASM tools ---"
for cmd in wasm2wat wat2wasm wasm-objdump clang ld.lld; do
if command -v "$cmd" >/dev/null 2>&1; then
echo "$cmd: $(command -v "$cmd")"
fi
done
echo
echo "--- Extra tools ---"
for cmd in wasienv wasmcc wasicc hook-cleaner; do
if command -v "$cmd" >/dev/null 2>&1; then
echo "$cmd: $(command -v "$cmd")"
fi
done
echo
echo "============================================================"
echo " UBUNTU 20.04 DEVELOPMENT ENVIRONMENT READY"
echo "============================================================"
echo
echo "Open a new shell or run:"
echo
echo " . ~/.bashrc"
echo