Skip to content

WIP: statically linked build for non Alpine Linux x86_64 #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
code-target: linux-x64
- os: ubuntu-22.04
target: x86_64-unknown-linux-musl
code-target: linux-x64
Comment on lines +36 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add this target?

- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
code-target: linux-arm64
Expand Down Expand Up @@ -86,11 +89,12 @@ jobs:
name: dist-${{ matrix.target }}
path: ./dist

dist-x86_64-unknown-linux-musl:
name: dist (x86_64-unknown-linux-musl)
dist-x86_64-alpine-linux-musl:
name: dist (x86_64-alpine-linux-musl)
runs-on: ubuntu-latest
env:
LLM_LS_TARGET: x86_64-unknown-linux-musl
LLM_LS_ARTIFACT: x86_64-alpine-linux-musl
# For some reason `-crt-static` is not working for clang without lld
RUSTFLAGS: "-C link-arg=-fuse-ld=lld -C target-feature=-crt-static"
container:
Expand All @@ -113,13 +117,13 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: dist-x86_64-unknown-linux-musl
name: dist-x86_64-alpine-linux-musl
path: ./dist

publish:
name: publish
runs-on: ubuntu-latest
needs: ["dist", "dist-x86_64-unknown-linux-musl"]
needs: ["dist", "dist-x86_64-alpine-linux-musl"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
Expand Down Expand Up @@ -151,6 +155,10 @@ jobs:
with:
name: dist-x86_64-unknown-linux-musl
path: dist
- uses: actions/download-artifact@v1
with:
name: dist-x86_64-alpine-linux-musl
path: dist
- uses: actions/download-artifact@v1
with:
name: dist-aarch64-unknown-linux-gnu
Expand Down
19 changes: 3 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions crates/llm-ls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ tree-sitter-bash = "0.20"
tree-sitter-c = "0.20"
tree-sitter-cpp = "0.20"
tree-sitter-c-sharp = "0.20"
tree-sitter-elixir = "0.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened here? 😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in the PR description, this version of the module used C++, so I changed it to use the git repository, where the module is rewritten in C, so that it can compile with musl.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is why the current musl version does not work -- it requires libstdc++.so.6.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should leave a comment above each of these tree-sitter dependencies to state why they are pulling in a specific version from github.

tree-sitter-elixir = { git = "https://github.com/elixir-lang/tree-sitter-elixir.git", rev = "a2861e88a730287a60c11ea9299c033c7d076e30", version = "0.1.0" }
tree-sitter-erlang = "0.2"
tree-sitter-go = "0.20"
tree-sitter-html = "0.19"
tree-sitter-html = { git = "https://github.com/tree-sitter/tree-sitter-html.git", rev = "d742025fa2d8e6100f134a6ea990443aa1f074b3", version = "0.20.0" }
tree-sitter-java = "0.20"
tree-sitter-javascript = "0.20"
tree-sitter-json = "0.20"
Expand All @@ -34,7 +34,6 @@ tree-sitter-md = "0.1"
tree-sitter-objc = "3"
tree-sitter-python = "0.20"
tree-sitter-r = "0.19"
tree-sitter-ruby = "0.20"
tree-sitter-rust = "0.20"
tree-sitter-scala = "0.20"
tree-sitter-swift = "0.3"
Expand Down
8 changes: 1 addition & 7 deletions crates/llm-ls/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,7 @@ fn get_parser(language_id: LanguageId) -> Result<Parser> {
.map_err(internal_error)?;
Ok(parser)
}
LanguageId::Ruby => {
let mut parser = Parser::new();
parser
.set_language(tree_sitter_ruby::language())
.map_err(internal_error)?;
Ok(parser)
}
LanguageId::Ruby => Ok(Parser::new()),
LanguageId::Rust => {
let mut parser = Parser::new();
parser
Expand Down
5 changes: 4 additions & 1 deletion xtask/src/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ impl Target {
(String::new(), None)
};
let server_path = out_path.join(format!("llm-ls{exe_suffix}"));
let artifact_name = format!("llm-ls-{name}{exe_suffix}");
let artifact_name = match env::var("LLM_LS_ARTIFACT") {
Ok(artifact) => format!("llm-ls-{artifact}{exe_suffix}"),
_ => format!("llm-ls-{name}{exe_suffix}")
};
Self {
name,
server_path,
Expand Down