Skip to content
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

Linux: Disable PureScript grammar to avoid linking error #7543

Merged
merged 2 commits into from
Feb 8, 2024

Conversation

h3mosphere
Copy link
Contributor

@h3mosphere h3mosphere commented Feb 8, 2024

Release Notes:

  • N/A

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 8, 2024
Copy link
Member

@maxdeviant maxdeviant left a comment

Choose a reason for hiding this comment

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

We only want to disable it on Linux.

AFAIK this isn't a problem on macOS, so we don't want to disable it there.

@maxdeviant
Copy link
Member

@h3mosphere Could you try changing the tree-sitter-purescript dependency in Zed from:

tree-sitter-purescript = { git = "https://github.com/ivanmoreau/tree-sitter-purescript", rev = "a37140f0c7034977b90faa73c94fcb8a5e45ed08" }

to this:

tree-sitter-purescript = { git = "https://github.com/deviant-forks/tree-sitter-purescript", rev = "ad3a8ebbf8d29039374050637c7e2c3995626baa" }

Does that fix the linking error when the PureScript grammar is not commented-out?

@h3mosphere
Copy link
Contributor Author

h3mosphere commented Feb 8, 2024

Whoops, sorry my brain is a little tired.

@h3mosphere
Copy link
Contributor Author

Barring me making a mistake, It didnt work alas:

diff --git a/Cargo.lock b/Cargo.lock
index 9da269ce5..530d6054a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -9237,7 +9237,7 @@ dependencies = [
 [[package]]
 name = "tree-sitter-purescript"
 version = "1.0.0"
-source = "git+https://github.com/ivanmoreau/tree-sitter-purescript?rev=a37140f0c7034977b90faa73c94fcb8a5e45ed08#a37140f0c7034977b90faa73c94fcb8a5e45ed08"
+source = "git+https://github.com/deviant-forks/tree-sitter-purescript?rev=ad3a8ebbf8d29039374050637c7e2c3995626baa#ad3a8ebbf8d29039374050637c7e2c3995626baa"
 dependencies = [
  "cc",
  "tree-sitter",
diff --git a/Cargo.toml b/Cargo.toml
index 2746b5d87..79e95006b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -251,7 +251,8 @@ tree-sitter-nu = { git = "https://github.com/nushell/tree-sitter-nu", rev = "26b
 tree-sitter-ocaml = { git = "https://github.com/tree-sitter/tree-sitter-ocaml", rev = "4abfdc1c7af2c6c77a370aee974627be1c285b3b" }
 tree-sitter-php = "0.21.1"
 tree-sitter-proto = { git = "https://github.com/rewinfrey/tree-sitter-proto", rev = "36d54f288aee112f13a67b550ad32634d0c2cb52" }
-tree-sitter-purescript = { git = "https://github.com/ivanmoreau/tree-sitter-purescript", rev = "a37140f0c7034977b90faa73c94fcb8a5e45ed08" }
+# tree-sitter-purescript = { git = "https://github.com/ivanmoreau/tree-sitter-purescript", rev = "a37140f0c7034977b90faa73c94fcb8a5e45ed08" }
+tree-sitter-purescript = { git = "https://github.com/deviant-forks/tree-sitter-purescript", rev = "ad3a8ebbf8d29039374050637c7e2c3995626baa" }
 tree-sitter-python = "0.20.2"
 tree-sitter-racket = { git = "https://github.com/zed-industries/tree-sitter-racket", rev = "eb010cf2c674c6fd9a6316a84e28ef90190fe51a" }
 tree-sitter-ruby = "0.20.0"
diff --git a/crates/zed/src/languages.rs b/crates/zed/src/languages.rs
index 43e92fb0a..01a9e2c4e 100644
--- a/crates/zed/src/languages.rs
+++ b/crates/zed/src/languages.rs
@@ -266,7 +266,7 @@ pub fn init(
 
     // Produces a link error on linux due to duplicated `state_new` symbol
     // todo!(linux): Restore purescript
-    #[cfg(not(target_os = "linux"))]
+    // #[cfg(not(target_os = "linux"))]
     language(
         "purescript",
         vec![Arc::new(purescript::PurescriptLspAdapter::new(

inux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-321b82c30dffdf5f.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-3dd8a6810a0bdfef.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-eb39a61c0c879984.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-aa769569f91c3548.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-510a192a50a983ed.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-0577018320f99037.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-193cf992125ccd4c.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-8e138eaf26ebb4a8.rlib" "-Wl,-Bdynamic" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lasound" "-lfontconfig" "-lfreetype" "-ldl" "-lfreetype" "-lxcb" "-ldl" "-lssl" "-lcrypto" "-lz" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/hemosphere/repos/ides/zed/hemosphere/target/debug/deps/Zed-529538631754ab2e" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: /home/hemosphere/repos/ides/zed/hemosphere/target/debug/deps/libtree_sitter_haskell-8da48a83a0b5f337.rlib(scanner.o): in function `state_new':
          /home/hemosphere/.cargo/git/checkouts/tree-sitter-haskell-74c278e7a2ef8d7d/cf98de2/src/scanner.c:218: multiple definition of `state_new'; /home/hemosphere/repos/ides/zed/hemosphere/target/debug/deps/libtree_sitter_purescript-c5ade00a1193717a.rlib(scanner.o):/home/hemosphere/.cargo/git/checkouts/tree-sitter-purescript-eded29d2e8e62f6a/ad3a8eb/src/scanner.c:218: first defined here
          collect2: error: ld returned 1 exit status


@h3mosphere
Copy link
Contributor Author

Ok, that should be good

@h3mosphere h3mosphere changed the title disable purescript fully, otherwise causing a linking error on main Linux: disable purescript fully, prevents linking error on main Feb 8, 2024
@maxdeviant maxdeviant changed the title Linux: disable purescript fully, prevents linking error on main Linux: Disable PureScript grammar to avoid linking error Feb 8, 2024
@maxdeviant
Copy link
Member

Barring me making a mistake, It didnt work alas:

diff --git a/Cargo.lock b/Cargo.lock
index 9da269ce5..530d6054a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -9237,7 +9237,7 @@ dependencies = [
 [[package]]
 name = "tree-sitter-purescript"
 version = "1.0.0"
-source = "git+https://github.com/ivanmoreau/tree-sitter-purescript?rev=a37140f0c7034977b90faa73c94fcb8a5e45ed08#a37140f0c7034977b90faa73c94fcb8a5e45ed08"
+source = "git+https://github.com/deviant-forks/tree-sitter-purescript?rev=ad3a8ebbf8d29039374050637c7e2c3995626baa#ad3a8ebbf8d29039374050637c7e2c3995626baa"
 dependencies = [
  "cc",
  "tree-sitter",
diff --git a/Cargo.toml b/Cargo.toml
index 2746b5d87..79e95006b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -251,7 +251,8 @@ tree-sitter-nu = { git = "https://github.com/nushell/tree-sitter-nu", rev = "26b
 tree-sitter-ocaml = { git = "https://github.com/tree-sitter/tree-sitter-ocaml", rev = "4abfdc1c7af2c6c77a370aee974627be1c285b3b" }
 tree-sitter-php = "0.21.1"
 tree-sitter-proto = { git = "https://github.com/rewinfrey/tree-sitter-proto", rev = "36d54f288aee112f13a67b550ad32634d0c2cb52" }
-tree-sitter-purescript = { git = "https://github.com/ivanmoreau/tree-sitter-purescript", rev = "a37140f0c7034977b90faa73c94fcb8a5e45ed08" }
+# tree-sitter-purescript = { git = "https://github.com/ivanmoreau/tree-sitter-purescript", rev = "a37140f0c7034977b90faa73c94fcb8a5e45ed08" }
+tree-sitter-purescript = { git = "https://github.com/deviant-forks/tree-sitter-purescript", rev = "ad3a8ebbf8d29039374050637c7e2c3995626baa" }
 tree-sitter-python = "0.20.2"
 tree-sitter-racket = { git = "https://github.com/zed-industries/tree-sitter-racket", rev = "eb010cf2c674c6fd9a6316a84e28ef90190fe51a" }
 tree-sitter-ruby = "0.20.0"
diff --git a/crates/zed/src/languages.rs b/crates/zed/src/languages.rs
index 43e92fb0a..01a9e2c4e 100644
--- a/crates/zed/src/languages.rs
+++ b/crates/zed/src/languages.rs
@@ -266,7 +266,7 @@ pub fn init(
 
     // Produces a link error on linux due to duplicated `state_new` symbol
     // todo!(linux): Restore purescript
-    #[cfg(not(target_os = "linux"))]
+    // #[cfg(not(target_os = "linux"))]
     language(
         "purescript",
         vec![Arc::new(purescript::PurescriptLspAdapter::new(

inux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-321b82c30dffdf5f.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-3dd8a6810a0bdfef.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-eb39a61c0c879984.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-aa769569f91c3548.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-510a192a50a983ed.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-0577018320f99037.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-193cf992125ccd4c.rlib" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-8e138eaf26ebb4a8.rlib" "-Wl,-Bdynamic" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lstdc++" "-lasound" "-lfontconfig" "-lfreetype" "-ldl" "-lfreetype" "-lxcb" "-ldl" "-lssl" "-lcrypto" "-lz" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/hemosphere/.rustup/toolchains/1.75-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/hemosphere/repos/ides/zed/hemosphere/target/debug/deps/Zed-529538631754ab2e" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: /usr/bin/ld: /home/hemosphere/repos/ides/zed/hemosphere/target/debug/deps/libtree_sitter_haskell-8da48a83a0b5f337.rlib(scanner.o): in function `state_new':
          /home/hemosphere/.cargo/git/checkouts/tree-sitter-haskell-74c278e7a2ef8d7d/cf98de2/src/scanner.c:218: multiple definition of `state_new'; /home/hemosphere/repos/ides/zed/hemosphere/target/debug/deps/libtree_sitter_purescript-c5ade00a1193717a.rlib(scanner.o):/home/hemosphere/.cargo/git/checkouts/tree-sitter-purescript-eded29d2e8e62f6a/ad3a8eb/src/scanner.c:218: first defined here
          collect2: error: ld returned 1 exit status

Darn. Although the error message does provide some additional clues.

@maxdeviant maxdeviant merged commit 4048dbf into zed-industries:main Feb 8, 2024
8 checks passed
postsolar added a commit to postsolar/tree-sitter-purescript that referenced this pull request Feb 23, 2024
I suspect this is what causing issues for multiple projects attempting to use this grammar:

- neurocyte/zat#1

- zed-industries/zed#7543 (comment)

Don't know why it wasn't static in the first place (in the original Haskell grammar),
but I looked at what other grammars do and none export any functions other than those used by Tree-sitter.
postsolar added a commit to postsolar/tree-sitter-purescript that referenced this pull request Feb 23, 2024
I suspect this is what causing issues for multiple projects attempting to use this grammar:

- neurocyte/zat#1

- zed-industries/zed#7543 (comment)

Don't know why it wasn't static in the first place (in the original Haskell grammar),
but I looked at what other grammars do and none export any functions other than those used by Tree-sitter.
SomeoneToIgnore pushed a commit that referenced this pull request Feb 23, 2024
Relevant PRs:
- #7543
- #7827

Release Notes:

- Fixed build issues with PureScript on Windows and Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants