basalt-inference-git

LOW
maintainer saber-nyan 0 votes scanned 2026-11-03 10:04:25.157601
View on AUR
Why flagged

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

Triggered rules

Low Few votes, recently uploaded zero_votes_recent

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

PKGBUILD

1# Maintainer: saber-nyan <saber-nyan@ya.ru>
2# Written by an LLM: Qwen3.8-Flash-Next (Qwen3.8-FN-GSQ-RCO-IQ3_S) served by basalt itself - the
3# engine this package builds - with a human driving, reviewing and running every build.
4# Tracks upstream main of https://github.com/jesdga95/basalt plus two local patches:
5# 0001-cmake-overridable-basalt-source-dir.patch BASALT_SOURCE_DIR / engine path become cmake options
6# ram-guard-mib.patch --ram-guard-mib N (0 = the RAM guard off)
7# Both patches apply with `git am --3way` to upstream main through bd984820 (checked 2026-11-03).
8# Upstream bug found through this package: https://github.com/jesdga95/basalt/issues/224
9# (out-of-range operator[] in Tokenizer::merge_piece; see build() and README).
10# Named basalt-inference-git, and the PATH commands are qualified the same way: AUR already has
11# aur/basalt and aur/basalt-bin (a TUI for Obsidian) owning /usr/bin/basalt, plus the vkBasalt
12# family and basalt-monado (a SLAM library). Qualifying the names beats declaring a conflict with
13# unrelated software. The runtime tree keeps upstream's own names (/usr/lib/basalt/bin/basalt),
14# which is also the path baked into basalt-probe/-bench as their engine.
15pkgname=basalt-inference-git
16pkgver=0.2.0.45.g83d76f90
17pkgrel=1
18pkgdesc='Local inference engine for Qwen3.8-Flash-Next MoE packs (NVIDIA Blackwell, sm_120)'
19arch=(x86_64)
20url='https://github.com/jesdga95/basalt'
21license=(MIT)
22depends=(cuda python python-numpy python-jinja python-markupsafe
23 python-regex python-yaml python-tqdm python-pillow python-psutil)
24makedepends=(git cmake ninja)
25source=("basalt::git+https://github.com/jesdga95/basalt.git#branch=main"
26 ram-guard-mib.patch
27 0001-cmake-overridable-basalt-source-dir.patch)
28sha256sums=('SKIP'
29 '3f591caf54a17dff4f7c4093fc01581154e5e170e4be87a20e3189bfcf4e3f0b'
30 'd065296aa095292902f3b02a87d9321c798c6f00972c17594a14a4f324747490')
31
32# BASALT_DEBUG=1 makepkg -si builds with -g, splits off a basalt-git-debug package (gdb then reports
33# file:line), and turns LTO off there: -g plus -flto wants far more RAM than this codebase compiles
34# comfortably. Used to catch the engine's out-of-bounds vector<int> (see README).
35[[ -n ${BASALT_DEBUG:-} ]] && options=('debug' '!lto')
36
37# The installed runtime tree: basalt serve chdirs here and runs `python3 -m serve.server`, and the
38# engine reads its expert profiles from $pkgdir$_prefix/data/profiles.
39_prefix=/usr/lib/basalt
40
41pkgver() {
42 cd "$srcdir/basalt"
43 git describe --tags --always | sed -e 's/^v//' -e 's/-/./g'
44}
45
46prepare() {
47 cd "$srcdir/basalt"
48 git config user.email pkgbuild@localhost # git am needs a committer identity
49 git config user.name makepkg
50 for p in 0001-cmake-overridable-basalt-source-dir.patch ram-guard-mib.patch; do
51 if ! git am --3way "$srcdir/$p"; then
52 git am --abort 2>/dev/null
53 printf '%s does not apply to %s:\n' "$p" "$(git describe --tags --always)" >&2
54 printf ' 1. in a scratch clone: git checkout <new-main>; git am --3way %s/%s\n' "$srcdir" "$p" >&2
55 printf ' fix the conflicts, git add them, git am --continue, then:\n' >&2
56 printf ' git format-patch -1 --stdout > %s/%s (keep the patch file name)\n' "$srcdir" "$p" >&2
57 printf ' 2. sha256sum that file, put the new sum in sha256sums[]\n' >&2
58 printf ' 3. rm -rf src pkg && makepkg -si\n' >&2
59 printf 'A silently unpatched tree is worse than a failed build: the flag would just be missing.\n' >&2
60 return 1
61 fi
62 done
63}
64
65build() {
66 cd "$srcdir/basalt"
67 # CUDA toolkit: name it, do not inherit it. AUR helpers run makepkg through sudo, and sudo's
68 # env_reset + secure_path ("/usr/local/sbin:/usr/local/bin:/usr/bin") drop both CUDA_PATH and
69 # /opt/cuda/bin that /etc/profile.d/cuda.sh exports for login shells. Arch installs CUDA to
70 # /opt/cuda and has no /usr/local/cuda - the one directory CMake force-prepends to its toolkit
71 # search - so configure then dies in project(): "Failed to find nvcc. Compiler requires the CUDA
72 # toolkit. Please set the CUDAToolkit_ROOT variable". An explicit CUDAToolkit_ROOT or CUDA_PATH
73 # in the environment still wins over the /opt/cuda default.
74 local cuda_root="${CUDAToolkit_ROOT:-${CUDA_PATH:-/opt/cuda}}"
75 local cuda_compiler=()
76 [[ -x "$cuda_root/bin/nvcc" ]] && cuda_compiler=(-DCMAKE_CUDA_COMPILER="$cuda_root/bin/nvcc")
77 export CUDAToolkit_ROOT="$cuda_root"
78 export PATH="$cuda_root/bin:$PATH"
79 # Arch's hardening puts -Wp,-D_GLIBCXX_ASSERTIONS in CXXFLAGS, and libstdc++ then checks every
80 # vector::operator[]. The engine hits one on the serve path - Tokenizer::merge_piece forms
81 # &sym_[count] in its shift (src/program/tokenizer/bpe.cpp:240), reported upstream as
82 # https://github.com/jesdga95/basalt/issues/224 - and the check aborts the engine mid-request
83 # (exit -6, "stl_vector.h:1253 ... Assertion '__n < this->size()' failed") on ordinary tool-list
84 # prompts. A plain build is not hurt today (the move is empty), it is silent UB, so the flag
85 # cannot stay on here; the checks also sit in the hot expert/token loops.
86 # Drop the one flag; the rest of the hardening stays. BASALT_GLIBCXX_ASSERTIONS=1 keeps it on to
87 # hunt the next one (README), and to re-check this once #224 is fixed upstream.
88 # given to cmake as -DCMAKE_CXX_FLAGS below, not just exported: an existing build/ directory keeps
89 # its cached CMAKE_CXX_FLAGS otherwise, and the flag would come back on an incremental rebuild.
90 local cxxflags="$CXXFLAGS" cudaflags=""
91 [[ -z ${BASALT_GLIBCXX_ASSERTIONS:-} ]] && cxxflags="${cxxflags/-Wp,-D_GLIBCXX_ASSERTIONS/}"
92 # nvcc does not take CXXFLAGS, so the .cu host code needs -g passed through explicitly
93 [[ -n ${BASALT_DEBUG:-} ]] && cudaflags="-Xcompiler=-g"
94 [[ -n ${BASALT_JOBS:-} ]] && echo "basalt: building with ${BASALT_JOBS} jobs, CXXFLAGS=[$cxxflags]" >&2
95 # CMAKE_SKIP_RPATH: the cuda package ships /etc/ld.so.conf.d/cuda.conf, so the binaries do not
96 # need a RUNPATH into /opt/cuda (namcap flags it as insecure).
97 cmake -S . -B build -G Ninja \
98 -DCMAKE_BUILD_TYPE=Release \
99 -DCMAKE_INSTALL_PREFIX=/usr \
100 -DCMAKE_CXX_FLAGS="$cxxflags" \
101 -DCMAKE_CUDA_FLAGS="$cudaflags" \
102 -DBASALT_SOURCE_DIR="$_prefix" \
103 -DBASALT_ENGINE_BIN="$_prefix/bin/basalt" \
104 -DCMAKE_CUDA_ARCHITECTURES=120 \
105 ${cuda_compiler[@]+"${cuda_compiler[@]}"} \
106 -DCMAKE_SKIP_RPATH=ON \
107 -DBUILD_TESTING=OFF \
108 -DWERROR=OFF
109 # peak nvcc memory is bounded by the job count: BASALT_JOBS=2 makepkg -si (default: nproc)
110 cmake --build build -- -k 0 -j "${BASALT_JOBS:-$(nproc)}"
111}
112
113package() {
114 cd "$srcdir/basalt"
115 # CMake has no install() rules and puts the binaries in the source tree's bin/, so they are installed by hand.
116 # In the tree they keep upstream's names (the engine path is baked into probe/bench); only the PATH
117 # symlinks are qualified, so /usr/bin/basalt stays free for aur/basalt and aur/basalt-bin.
118 install -d "$pkgdir/usr/bin"
119 for b in basalt basalt-bench basalt-probe basalt-vision; do
120 install -Dm755 "bin/$b" "$pkgdir$_prefix/bin/$b"
121 ln -sfn "$_prefix/bin/$b" "$pkgdir/usr/bin/basalt-inference${b#basalt}"
122 done
123
124 # serve/ (the Python server), tools/ (on serve's sys.path) and data/ (profiles, bench fixtures)
125 # are read at run time from $_prefix.
126 for d in serve tools data; do
127 cp -a "$d" "$pkgdir$_prefix/"
128 done
129 find "$pkgdir$_prefix" -name '__pycache__' -type d -prune -exec rm -rf {} +
130 install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
131 install -m644 THIRD_PARTY_LICENSES "$pkgdir$_prefix/THIRD_PARTY_LICENSES"
132
133 # both patches must be baked into the installed engine, or the package is broken
134 if ! grep -aq -- '--ram-guard-mib' "$pkgdir$_prefix/bin/basalt"; then
135 printf 'ram-guard-mib.patch is not in the installed binary: the flag would be missing.\n' >&2
136 return 1
137 fi
138 if ! grep -aq "$_prefix" "$pkgdir$_prefix/bin/basalt"; then
139 printf 'BASALT_SOURCE_DIR is not %s: basalt serve would not find its tree.\n' "$_prefix" >&2
140 return 1
141 fi
142 # basalt-probe and basalt-bench bake in the engine they start and the fixtures they read
143 for b in basalt-probe basalt-bench; do
144 if ! grep -aq "$_prefix/bin/basalt" "$pkgdir$_prefix/bin/$b"; then
145 printf '%s still points at the build tree for its engine; it would need --engine.\n' "$b" >&2
146 return 1
147 fi
148 done
149}
150

Scan history

Scanned at (UTC)SeverityRules
2026-11-03 10:04:25 Low 1

Report a package

Reports go to the AURWatch maintainer (one person) and are read by hand. No login required.

0 / 4000
Your suggestion