supabase-community/postgres_lsp

Project fails to build on macOS Sonoma 14.1.1 (arm64)

Opened this issue ยท 5 comments

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

FYI to the maintainers, the above bullet points for this issue template still reference Supabase directly, not postgres_lsp. ๐Ÿ˜„

Describe the bug

I was trying to follow the "building from source" section of the docs:

  • I ran git submodule update --init --recursive and verified the submodule was populated correctly.
  • Then I ran cargo xtask install but it eventually errored; see output below.
โฏ cargo xtask install
...
...
...
$ cargo install --path crates/postgres_lsp --locked --force
...
...
...
error[E0554]: `#![feature]` may not be used on the stable release channel
  --> crates/parser/src/lib.rs:18:12
   |
18 | #![feature(lazy_cell, is_sorted)]
   |            ^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
  --> crates/parser/src/lib.rs:18:23
   |
18 | #![feature(lazy_cell, is_sorted)]
   |                       ^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `parser` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `postgres_lsp v0.0.0 (/Users/noah/Git/postgres_lsp/crates/postgres_lsp)`, intermediate artifacts can be found at `/Users/noah/Git/postgres_lsp/target`
Error: install server

Caused by:
    command exited with non-zero code `cargo install --path crates/postgres_lsp --locked --force`: 101

I'm relatively unfamiliar with Rust and its tooling; I found an SO thread online but the suggested fix is to just install the nightly version of Rust/cargo? That feels odd to me, so I'll wait for maintainer feedback. ๐Ÿ˜…

System information

  • macOS Sonoma 14.1.1
  • asdf package manager with asdf-rust plugin
โฏ asdf plugin list --refs --urls
โ•ญโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚  # โ”‚    name    โ”‚                     repository                      โ”‚ branch โ”‚   ref   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  0 โ”‚ nodejs     โ”‚ https://github.com/asdf-vm/asdf-nodejs.git          โ”‚ master โ”‚ 150ec5d โ”‚
โ”‚  1 โ”‚ rust       โ”‚ https://github.com/code-lever/asdf-rust.git         โ”‚ master โ”‚ 95acf4f โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โฏ rustc --version
rustc 1.71.1 (eb26296b5 2023-08-03)

โฏ cargo --version
cargo 1.71.1 (7f1d04c00 2023-07-29)

โฏ node --version
v18.15.0

Additional context

I ended up here because I was reminded about postgres_lsp from a related HN thread posted today.

Reading more, I'm guessing this project requires the nightly Rust build for the time being and that's just how it is. Keyword is "guessing", hence why I'm not closing this issue yet. ๐Ÿ˜„

As for how to prevent newcomers from hitting this in the future, I did find docs about how to specify which Rust release channel to use for a project.

Hey @Nezteb, thanks for opening the issue. You are right, we are currently using two nightly features of rust and thereby require the nightly channel to be used. It seems like I forgot to update the Readme. Will do so later. For now, first install rustup. You can then install nightly rust with
rustup-init --default-toolchain nightly -y.

This is very interesting. I installed rustup

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

I had no issues running the commands in the readme but if I try to run rustup-init says command not found

rustup is a command but not rustup-init

hey @nicoabie, can you check if cargo or rustc are available on your system? I have installed rustup with homebrew and it works fine - maybe you need some additional setup when installing it via curl.

I have both cargo and rustc.

The difference relies in that it seems you installed rustup with homebrew and I followed the instructions on the website
https://www.rust-lang.org/learn/get-started

The website does not tell you to use homebrew.

Probably the homebrew formula is old and has the deprecated rustup-init command