Zed
Web, https://zed.dev/
GitHub, https://github.com/zed-industries/zed
1.28.1
This essentially follows 1.27.0, including changes to script/bundle-linx except also a change on path_component.rs,
#!/bin/bash
set -euo pipefail
module purge
module load ceuadmin/clang/22.1.8
module load ceuadmin/rust/1.95.0
V=1.28.1
GCC12=/usr/local/Cluster-Apps/ceuadmin/gcc/12.5.0
LLVM=/usr/local/Cluster-Apps/ceuadmin/clang/22.1.8
LOCAL_LIB="$HOME/hpc-work/lib"
export CC="$LLVM/bin/clang"
export CXX="$LLVM/bin/clang++"
export LLD="$LLVM/bin/ld.lld"
export CXXFLAGS="--gcc-toolchain=$GCC12"
export LD_LIBRARY_PATH="$GCC12/lib64:$LLVM/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
XKB_LIB=/usr/lib64/libxkbcommon-x11.so.0
if [[ ! -e "$XKB_LIB" ]]; then
echo "ERROR: Missing $XKB_LIB" >&2
exit 1
fi
mkdir -p "$LOCAL_LIB"
ln -sfn "$XKB_LIB" "$LOCAL_LIB/libxkbcommon-x11.so"
export LIBRARY_PATH="$LOCAL_LIB:$GCC12/lib64${LIBRARY_PATH:+:$LIBRARY_PATH}"
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-arg=-L$GCC12/lib64"
export REMOTE_SERVER_TARGET=x86_64-unknown-linux-gnu
rustup target add "$REMOTE_SERVER_TARGET"
ldd "$GCC12/lib64/libstdc++.so.6"
cd ~/rds/software
if [[ ! -d "zed-$V/.git" ]]; then
git clone --depth 1 --branch "v$V" \
https://github.com/zed-industries/zed.git "zed-$V"
fi
cd "zed-$V"
sed -i 's/subpath\.is_empty()/subpath.as_os_str().is_empty()/' \
crates/agent/src/tools/terminal_tool.rs
sed -i \
's/!path\.is_empty()/!path.as_os_str().is_empty()/' \
crates/path/src/path_component.rs
script/bundle-linux --skip-sentry
1.27.0
The module is called as follows,
module load ceuadmin/zed/1.27.0
which zed
zed --version
ldd "$CEUADMIN/zed/1.27.0/libexec/zed-editor" | grep 'not found'
Two scripts are available to generate target/release/zed-linux-x86_64.tar.gz as an archive of zed.app/.
script/bundle-linux
The following script builds the app.
#!/bin/bash
set -euo pipefail
module purge
module load ceuadmin/clang/22.1.8
module load ceuadmin/rust/nightly
V=1.27.0
GCC12=/usr/local/Cluster-Apps/ceuadmin/gcc/12.5.0
LLVM=/usr/local/Cluster-Apps/ceuadmin/clang/22.1.8
LOCAL_LIB="$HOME/hpc-work/lib"
export CC="$LLVM/bin/clang"
export CXX="$LLVM/bin/clang++"
export LLD="$LLVM/bin/ld.lld"
# GCC 12.5 C++ headers and runtime, with Clang as compiler
export CXXFLAGS="--gcc-toolchain=$GCC12"
export LD_LIBRARY_PATH="$GCC12/lib64:$LLVM/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
# XKB linker-name workaround
XKB_LIB=/usr/lib64/libxkbcommon-x11.so.0
if [[ ! -e "$XKB_LIB" ]]; then
echo "ERROR: Missing $XKB_LIB" >&2
exit 1
fi
mkdir -p "$LOCAL_LIB"
ln -sfn "$XKB_LIB" "$LOCAL_LIB/libxkbcommon-x11.so"
export LIBRARY_PATH="$LOCAL_LIB:$GCC12/lib64${LIBRARY_PATH:+:$LIBRARY_PATH}"
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-arg=-L$GCC12/lib64"
export REMOTE_SERVER_TARGET=x86_64-unknown-linux-gnu
rustup target add "$REMOTE_SERVER_TARGET"
# Verify GCC C++ runtime
ldd "$GCC12/lib64/libstdc++.so.6"
# Source checkout
cd ~/rds/software
if [[ ! -d "zed-$V/.git" ]]; then
git clone --depth 1 --branch "v$V" \
https://github.com/zed-industries/zed.git "zed-$V"
fi
cd "zed-$V"
# Compatibility adjustment for the Rust source
sed -i 's/subpath\.is_empty()/subpath.as_os_str().is_empty()/' \
crates/agent/src/tools/terminal_tool.rs
sed -i \
's/path\.is_empty()/path.as_os_str().is_empty()/g' \
crates/path/src/path_component.rs
# Build and package
script/bundle-linux --skip-sentry
Three changes are necessary to script/bundle-linux.
# change: find_libs():
find_libs() {
ldd "${target_dir}/${target_triple}/release/zed" |
awk '
$2 == "=>" && $3 ~ /^\// {print $3}
$1 ~ /^\// {print $1}
' |
grep -v '\<\(libc.so\|libgcc_s.so\|libm.so\|libpthread.so\|libdl.so\|libasound.so\)' |
grep -v '\<\(libglib-2.0.so\|libgobject-2.0.so\|libgio-2.0.so\|libgmodule-2.0.so\|libpcre.so\|libpcre2-8.so\|libmount.so\|libblkid.so\|libselinux.so\|libffi.so\|libresolv.so\|libz.so\)'
}
# change: cp $(find_libs) "${zed_dir}/lib"
mapfile -t libs < <(find_libs)
if ((${#libs[@]})); then
cp -L -- "${libs[@]}" "${zed_dir}/lib/"
fi
# change: envsubst
/usr/bin/envsubst
script/install-linux
The script is zed.sh
#!/usr/bin/env bash
set -euo pipefail
V=1.27.0
SRC="$HOME/rds/software/zed-$V"
PREFIX="$CEUADMIN/zed/$V"
GCCROOT="$CEUADMIN/gcc/12.5.0"
GCCLIB="$GCCROOT/lib64"
LLVM=/usr/local/Cluster-Apps/ceuadmin/clang/22.1.8
LOCAL_LIB="$HOME/hpc-work/lib"
module load ceuadmin/clang/22.1.8
module load ceuadmin/gcc/12.5.0
module load ceuadmin/rust
export CC="$(command -v clang)"
export CXX="$(command -v clang++)"
export LLD="$LLVM/bin/ld.lld"
# Use GCC 12.5 headers and C++ runtime with Clang.
export CXXFLAGS="${CXXFLAGS:+$CXXFLAGS }--gcc-toolchain=$GCCROOT -stdlib=libstdc++"
# Native library search paths.
export LIBRARY_PATH="$GCCLIB:$LOCAL_LIB${LIBRARY_PATH:+:$LIBRARY_PATH}"
export LD_LIBRARY_PATH="$GCCLIB:$LOCAL_LIB${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
# Ensure Rust's final linker can find GCC 12.5 libstdc++.
if [[ ! -d "$SRC/.git" ]]; then
git clone --depth 1 --branch "v$V" \
https://github.com/zed-industries/zed.git "$SRC"
fi
cd "$SRC"
# Ensure Rust's final linker can find GCC 12.5 libstdc++.
python3 - "$GCCLIB" <<'PY'
from pathlib import Path
import re
import sys
p = Path(".cargo/config.toml")
if not p.is_file():
raise SystemExit(f"ERROR: Missing {p}")
s = p.read_text()
lib = sys.argv[1]
section = f'''[target.x86_64-unknown-linux-gnu]
rustflags = [
"-C", "symbol-mangling-version=v0",
"--cfg", "tokio_unstable",
"-L", "native={lib}",
"-C", "link-arg=-Wl,-rpath,{lib}",
]
'''
pattern = r"(?ms)^\[target\.x86_64-unknown-linux-gnu\]\s*\n.*?(?=^\[|\Z)"
s = re.sub(pattern, "", s).rstrip()
p.write_text(s + "\n\n" + section)
PY
unset RUSTFLAGS CARGO_ENCODED_RUSTFLAGS
cargo metadata --no-deps --format-version 1 >/dev/null
export REMOTE_SERVER_TARGET=x86_64-unknown-linux-gnu
rustup target add "$REMOTE_SERVER_TARGET"
echo "Checking Clang GCC toolchain selection..."
"$CXX" --gcc-toolchain="$GCCROOT" -stdlib=libstdc++ \
-std=c++20 -v -E -x c++ /dev/null 2>&1 |
grep -E 'Selected GCC|include/c\+\+' || true
echo "Checking GCC 12.5 C++ runtime..."
"$CXX" --gcc-toolchain="$GCCROOT" -stdlib=libstdc++ \
-L"$GCCLIB" -Wl,-t \
-x c++ - -o /tmp/test-clang <<'EOF'
#include <iostream>
int main() {
std::cout << "Clang + GCC 12 libstdc++ OK\n";
}
EOF
ldd /tmp/test-clang | grep -E 'stdc\+\+|gcc_s'
XKB_LIB=/usr/lib64/libxkbcommon-x11.so.0
if [[ ! -e "$XKB_LIB" ]]; then
echo "ERROR: Missing $XKB_LIB" >&2
exit 1
fi
mkdir -p "$LOCAL_LIB"
ln -sfn "$XKB_LIB" "$LOCAL_LIB/libxkbcommon-x11.so"
PATCH_FILE=crates/agent/src/tools/terminal_tool.rs
if grep -qF 'subpath.is_empty()' "$PATCH_FILE"; then
sed -i 's/subpath\.is_empty()/subpath.as_os_str().is_empty()/' \
"$PATCH_FILE"
elif ! grep -qF 'subpath.as_os_str().is_empty()' "$PATCH_FILE"; then
echo "ERROR: Expected source expression not found in $PATCH_FILE" >&2
exit 1
fi
echo "Building Zed $V ..."
script/install-linux It includes the following patch to .cargo/config.toml (as shown in config.toml),
[target.'cfg(all())']
# v0 mangling scheme provides more detailed backtraces around closures
rustflags = [
"-C", "symbol-mangling-version=v0",
"--cfg", "tokio_unstable",
# HPC: GCC 12.5 C++ runtime
"-L", "native=/usr/local/Cluster-Apps/ceuadmin/gcc/12.5.0/lib64",
"-C", "link-arg=-Wl,-rpath,/usr/local/Cluster-Apps/ceuadmin/gcc/12.5.0/lib64",
]
# Global Rust compiler flags
[target.'cfg(all())']
# v0 mangling scheme provides more detailed backtraces around closures
rustflags = [
"-C", "symbol-mangling-version=v0",
"--cfg", "tokio_unstable",
# HPC: GCC 12.5 C++ runtime and library search path
"-L", "native=/usr/local/Cluster-Apps/ceuadmin/gcc/12.5.0/lib64",
"-C", "link-arg=-Wl,-rpath,/usr/local/Cluster-Apps/ceuadmin/gcc/12.5.0/lib64",
]
# Cargo aliases
[alias]
xtask = "run --package xtask --"
perf-test = [
"test", "--profile", "release-fast",
"--lib", "--bins", "--tests", "--all-features",
"--config", "target.'cfg(true)'.runner='cargo run -p perf --release'",
"--config", "target.'cfg(true)'.rustflags=[\"--cfg\", \"perf_enabled\"]"
]
# Keep similar flags here to share some ccache
perf-compare = [
"run", "--profile", "release-fast", "-p", "perf",
"--config", "target.'cfg(true)'.rustflags=[\"--cfg\", \"perf_enabled\"]",
"--", "compare"
]
# Windows-specific settings
[target.'cfg(target_os = "windows")']
rustflags = [
"--cfg",
"windows_slim_errors", # Reduce windows::core::Error size
"-C",
"target-feature=+crt-static", # Fix LiveKit static linking
]
# We need lld to link libwebrtc.a successfully on aarch64-linux
[target.aarch64-unknown-linux-gnu]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
# Environment variables
[env]
MACOSX_DEPLOYMENT_TARGET = "12.0" flatpak:
#!/bin/bash
# Custom Flatpak Zed installer for CentOS 8 / RHEL 8 without root
# 1️⃣ Set custom install directory
export FLATPAK_USER_DIR="$CEUADMIN/zed/0.215.3"
export FLATPAK_USER_DIR="/rds/project/rds-4o5vpvAowP0/software/zed/0.215.3"
mkdir -p "$FLATPAK_USER_DIR"
export XDG_DATA_HOME="$FLATPAK_USER_DIR"
# 2️⃣ Add Flathub remote if missing
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# 3️⃣ Install Zed
flatpak install --user -y flathub dev.zed.Zed
# 4️⃣ Run Zed to verify
flatpak run --user dev.zed.Zed
# 5️⃣ Optional: create a desktop launcher
mkdir -p "$HOME/.local/share/applications"
cat > "$HOME/.local/share/applications/zed.desktop" <<EOL
[Desktop Entry]
Name=Zed Editor
Exec=flatpak run --user dev.zed.Zed
Terminal=false
Type=Application
Icon=zed
Categories=Development;IDE;
EOL
echo "✅ Zed installed in $FLATPAK_USER_DIR and desktop launcher created."