mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-05-12 05:19:33 +00:00
fix build from scratch. See Claude comment:
The script looks correct now. Here's the summary of what changed and why:
scripts/install_nim.sh — two changes:
Moved NIM_DEST definition to the top (line 20), before the early-exit check that references it.
Replaced the early-exit condition. The old logic checked nim --version in PATH and exited if it matched — including a silent exit for "newer version already installed". The problem: on the Linux machine, nim 2.2.4 was installed by the system package manager at a non-standard path (e.g. /usr/bin/nim or /nix/store/…). The script saw the right version and exited early, but ~/.nim/nim-2.2.4/ was never created. Later, when nimble fell back to downloading nimble 0.22.3 source and compiling it, nim looked for its stdlib at ~/.nim/nim-2.2.4/lib/system.nim — which didn't exist.
The new logic: only skip if ${NIM_DEST}/lib/system.nim actually exists (i.e. we installed it there). If it does, re-create the ~/.nimble/bin/ symlinks just in case they're stale, then exit. Otherwise, always download and install to ~/.nim/nim-2.2.4/, creating a self-contained installation the rest of the build can rely on.
This commit is contained in:
parent
6754d61ff1
commit
78ee490cca
@ -17,26 +17,28 @@ if [ -z "${NIM_VERSION}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the right version is already installed
|
||||
nim_ver=$(nim --version 2>/dev/null | head -1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)
|
||||
if [ "${nim_ver}" = "${NIM_VERSION}" ]; then
|
||||
echo "Nim ${NIM_VERSION} already installed, skipping."
|
||||
NIM_DEST="${HOME}/.nim/nim-${NIM_VERSION}"
|
||||
|
||||
# Check if nim is already installed at our expected location (not just anywhere in PATH).
|
||||
# Checking PATH version is not sufficient: a system-installed nim of the right version
|
||||
# won't have its stdlib at ${NIM_DEST}/lib/, causing downstream compilation failures.
|
||||
if [ -f "${NIM_DEST}/lib/system.nim" ]; then
|
||||
echo "Nim ${NIM_VERSION} already installed at ${NIM_DEST}, re-linking binaries."
|
||||
mkdir -p "${HOME}/.nimble/bin"
|
||||
for bin_path in "${NIM_DEST}/bin/"*; do
|
||||
ln -sf "${bin_path}" "${HOME}/.nimble/bin/$(basename "${bin_path}")"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -n "${nim_ver}" ]; then
|
||||
newer=$(printf '%s\n%s\n' "${NIM_VERSION}" "${nim_ver}" | sort -V | tail -1)
|
||||
if [ "${newer}" = "${nim_ver}" ]; then
|
||||
echo "WARNING: Nim ${nim_ver} is installed; this repo is validated against ${NIM_VERSION}." >&2
|
||||
echo "WARNING: The build will proceed but may behave differently." >&2
|
||||
exit 0
|
||||
fi
|
||||
nim_ver=$(nim --version 2>/dev/null | head -1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || true)
|
||||
if [ -n "${nim_ver}" ] && [ "${nim_ver}" != "${NIM_VERSION}" ]; then
|
||||
echo "INFO: Nim ${nim_ver} found in PATH; installing Nim ${NIM_VERSION} to ${NIM_DEST}." >&2
|
||||
fi
|
||||
|
||||
OS=$(uname -s | tr 'A-Z' 'a-z' | sed 's/darwin/macosx/')
|
||||
ARCH=$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')
|
||||
|
||||
NIM_DEST="${HOME}/.nim/nim-${NIM_VERSION}"
|
||||
BINARY_URL="https://nim-lang.org/download/nim-${NIM_VERSION}-${OS}_${ARCH}.tar.xz"
|
||||
WORK_DIR=$(mktemp -d)
|
||||
trap 'rm -rf "${WORK_DIR}"' EXIT
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user