zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.81k stars 2.67k forks source link

Error when installing from repository on ubuntu 20.04 #15468

Open juerware opened 1 month ago

juerware commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

When executing command line after clone the repository:

Repository commit: 2a649fa82

# bash script/linux 
+ which rustup
++ command -v sudo
+ maysudo=/usr/bin/sudo
++ command -v apt-get
+ apt=/usr/bin/apt-get
+ [[ -n /usr/bin/apt-get ]]
+ deps=(gcc g++ libasound2-dev libfontconfig-dev libwayland-dev libxkbcommon-x11-dev libssl-dev libstdc++-12-dev libzstd-dev libvulkan1 libgit2-dev make clang mold jq gettext-base elfutils libsqlite3-dev)
+ /usr/bin/sudo /usr/bin/apt-get install -y gcc g++ libasound2-dev libfontconfig-dev libwayland-dev libxkbcommon-x11-dev libssl-dev libstdc++-12-dev libzstd-dev libvulkan1 libgit2-dev make clang mold jq gettext-base elfutils libsqlite3-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libfontconfig1-dev' instead of 'libfontconfig-dev'
E: Unable to locate package libstdc++-12-dev
E: Couldn't find any package by regex 'libstdc++-12-dev'
E: Unable to locate package mold

Environment

This is the system:

# cat /etc/*rele*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS"
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

Zed.log


SomeoneToIgnore commented 1 month ago

Looks like nobody considered Ubuntu 20.04 when creating the script.

I see no mold for 20.04 in the official repos: https://packages.ubuntu.com/search?keywords=mold and I presume other libs may have the same issue.

Somebody with Ubuntu 20.04 needs to propose changes to that script, otherwise the issue risks staying up ~268 days until 23 April 2025 (Ubuntu 20.04 EOL) and then it will be closed.

Alternatively, welcome to use any other means to install those packages in your system, edit the script to omit those and move on. mold is not really required, as it is used to speed up linking, the rest of the libraries seems needed though.

juerware commented 1 month ago

The problem is to compile mold in ubuntu 20.04 because of:

fatal error: concepts: No such file or directory

In ubuntu 20.04 there is no stable repository for "You need a C++20 compiler, like GCC 10.2.0" In fact in "https://github.com/rui314/mold#installation" there is no right status for ubuntu 20.04

Any solution ???

SomeoneToIgnore commented 1 month ago

mold is not really required, as it is used to speed up linking, the rest of the libraries seems needed though.

Keep the old linker and tolerate larger build times?

notpeter commented 1 month ago

I switched to libstdc++-10-dev instead of libstdc++-12-dev (because that's what's available) and grabbed a statically compiled copy of mold v2.32.1 from the mold github releases and I got it to compile and run zed --help in a docker container. I don't have a GUI there so I can't test whether the graphical bits actually work.

My install script:

maysudo=$(command -v sudo || command -v doas || true)
deps=(
    gcc
    g++
    libasound2-dev
    libfontconfig-dev
    libwayland-dev
    libxkbcommon-x11-dev
    libssl-dev
    libstdc++-10-dev
    libzstd-dev
    libvulkan1
    libgit2-dev
    make
    clang
    curl
    jq
    gettext-base
    elfutils
    libsqlite3-dev
)
$maysudo apt-get install -y "${deps[@]}"

#rustup
which rustup > /dev/null 2>&1 || curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# mold
# which mold > /dev/null 2>&1 || curl -s -L https://github.com/rui314/mold/releases/download/v2.32.1/mold-2.32.1-aarch64-linux.tar.gz | $maysudo tar xvz --strip-components=1 -C /usr/local
which mold > /dev/null 2>&1 || curl -s -L https://github.com/rui314/mold/releases/download/v2.32.1/mold-2.32.1-x86_64-linux.tar.gz | $maysudo tar xvz --strip-components=1 -C /usr/local
which mold
mold --version

Then the following worked:

cd zed
cargo run -- --help

Perhaps someone else with Ubuntu 20.04 on native hardware could test and see if that's enough or whether the graphical bits immediately fail.

just-an-engineer commented 3 weeks ago

I just tried to build it as well on Ubuntu 20 (before coming across this, and here are some of my notes)

From the Linux script, it wasn't able to locate package by regex libstdc++-12-dev, however, it didn't seem to make a difference, as even though I installed the 10-dev one, I ended up uninstalling it and it didn't make an impact.

I seemed to have issues with zstd-sys, and ended up running both of these, so I'm not too sure which one it is

cargo add zstd-sys
sudo apt install libzstd-dev

I also had a linking error where it couldn't find a certain symbol, and I had to install libxbcommon-x11-dev, which I think (along with libzstd-dev) should be included with the other dependencies in the script. I ran sudo apt install libxkbcommon-x11-dev and it seemed to work.

After that, I was able to build, but got a NoSupportedDeviceFound, which I did find in other issues, and at that point I decided to wait until I upgrade my entire system in a few months and retry. I think the above packages I mentioned should be included in the package, as well as put mold into the documentation, at least. I changed the linker outlined in the config.toml, so perhaps just adding that to the readme that you can change it there to gold/lld/etc (whatever preferred local linker they want). I had a myriad of other problems with trying to compile mold like some other people mentioned here. I don't want to make a PR or anything myself if I can't actually build it and get it working to truly confirm. But if there's no progress on this issue in a few months, I'll go through the motions of building Zed on a completely fresh install, and even mess around with trying other version of Ubuntu and such if I have the time.

For specs, I'm on Ubuntu 20 (focal), integrated graphics w/ amdgpu and ati for the driver, wayland for display but x.org for the server, x86_64

EDIT: said gold instead of mold. Gy bad

notpeter commented 3 weeks ago

You might try using the backports of mesa drivers for Ubuntu20/22 available in a PPA as described here: https://github.com/zed-industries/zed/issues/16428#issuecomment-2295322255.

just-an-engineer commented 3 weeks ago

Thank you, that worked. I'll keep the notes I have, and when I go through the process again with a clean box, if I encounter the same errors, I'll be a bit more meticulous and push a PR then to make the install process a bit cleaner. I don't want to clutter up the mess even more if it was just a me-error. Thank you again :+1: