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

support crystal 1.2.0 #29

Closed
gofenix opened this issue Oct 18, 2021 · 10 comments
Closed

support crystal 1.2.0 #29

gofenix opened this issue Oct 18, 2021 · 10 comments

Comments

@gofenix
Copy link

gofenix commented Oct 18, 2021

my crystal version is 1.2.0

git clone to my local dir, and then i run the command like this.

$ env LLVM_CONFIG=/usr/local/opt/llvm/bin/llvm-config crystal build ./src/crystalline.cr  -o ./bin/crystalline --release --no-debug -Dpreview_mt
Showing last frame. Use --error-trace for full trace.

In /usr/local/Cellar/crystal/1.2.0/src/compiler/crystal/tools/doc/generator.cr:1:1

 1 | require "../../../../../lib/markd/src/markd"
     ^
Error: can't find file '../../../../../lib/markd/src/markd' relative to '/usr/local/Cellar/crystal/1.2.0/src/compiler/crystal/tools/doc/generator.cr'

maybe it's not support 1.2.0?

@gofenix gofenix changed the title Error: can't find file '../../../../../lib/markd/src/markd' relative to '/usr/local/Cellar/crystal/1.2.0/src/compiler/crystal/tools/doc/generator.cr' support crystal 1.2.0 Oct 18, 2021
@ghost
Copy link

ghost commented Oct 18, 2021

I get the same error, but it seems the problem may be in the Crystal source? The requirement require "../../../../../lib/markd/src/markd" is in src/compiler/crystal/tools/playground/server.cr as well, which sits in a folder parallel to generator.cr,´. So at least both point to the same markd source file/s, which I can't find on my system either.

For reference I'm on macOS 11.6 (M1 Mac), Crystal 1.2 installed via Homebrew.

EDIT: Seems markd was added in Crystal 1.2.0. Potential issue with markd as well. Anyway I don't have the lib dir in question on my machine from what I can see.

@marghidanu
Copy link

I managed to bypass the markd error by doing these steps:
`

  • Clone markd somewhere on disk
  • Added it to CRYSTAL_PATH using the following command: export CRYSTAL_PATH=/path/to/markd/src:$(crystal env CRYSTAL_PATH)
  • Changed the markd path to require "markd" in these two files: '/opt/homebrew/Cellar/crystal/1.2.1/src/compiler/crystal/tools/doc/generator.cr and /opt/homebrew/Cellar/crystal/1.2.1/src/compiler/crystal/tools/playground/server.cr

Tried to rebuild but now it seems to fail with a different error:

Dependencies are satisfied
Building: crystalline
Error target crystalline failed to compile:
Showing last frame. Use --error-trace for full trace.

There was a problem expanding macro 'string'

Code in src/crystalline/lsp/base/code_action_kind.cr:11:1

 11 | Enum.string CodeActionKind, mappings: {
      ^
Called macro defined in src/crystalline/lsp/ext/enum.cr:3:3

 3 | macro string(name, *, downcase = true, mappings = nil, &block)

Which expanded to:

 > 27 |       end
 > 28 |
 > 29 |       def to_json(builder : JSON::Builder) : IO
                                                     ^-
Error: method CodeActionKind#to_json must return IO but it is returning Nil

@marghidanu
Copy link

Hmmm, is anybody maintaining the repo? Seems to be zero activity, and also no replies for some time.

@elbywan
Copy link
Owner

elbywan commented Nov 17, 2021

Hey @marghidanu,

Hmmm, is anybody maintaining the repo?

I am still reading issues and PRs, but sadly I do not have time these days to do much more than that, sorry 😕.

@ghost
Copy link

ghost commented Nov 18, 2021

That's a real pity, but also the nature of most open source projects. Developers give up lots of spare time to deliver a product us users expect to get for free. Anyway, thanks for your work so far @elbywan! Perhaps in due time crystalline can be picked up again, or forked.

Crystal could really do with a good lsp implementation - I've been spoiled by Rust + rust-analyzer. Scry also seems stale at this point.

@travisgalloway
Copy link

travisgalloway commented Dec 30, 2021

Per previous responses, I was able to get a mostly working build on a M1 Mac with two workarounds.

First by copying the 1.2.x lib/markd dir to the brew install dir.

git clone https://github.com/crystal-lang/crystal.git
cp -r crystal/lib /opt/homebrew/Cellar/crystal/1.2.2/lib

Then to avoid the enum macro error, I changed the return type of the to_json method. Not a permanent fix, but will complete the build. This might be a regression in 1.2.x.

/src/crystalline/lsp/ext/enum.cr:16
-      def to_json(builder : JSON::Builder) : IO
+      def to_json(builder : JSON::Builder) : Nil

refi64 added a commit to refi64/crystalline that referenced this issue Jan 1, 2022
We now need a custom copy of the sources to build, because the main
release distribution doesn't have the markd sources or the required LLVM
object files.

Closes elbywan#29
refi64 added a commit to refi64/crystalline that referenced this issue Jan 1, 2022
We now need a custom copy of the sources to build, because the main
release distribution doesn't have the markd sources or the required LLVM
object files.

Closes elbywan#29
@ghost
Copy link

ghost commented Jan 2, 2022

First by copying the 1.2.x lib/markd dir to the brew install dir. (...)

This made compilation work for me as well (M1 Mac), thanks! But you probably need cp -r, right?

cp -r crystal/lib /opt/homebrew/Cellar/crystal/1.2.2/lib

@elbywan elbywan closed this as completed in cc4fb06 Jan 2, 2022
@elbywan
Copy link
Owner

elbywan commented Jan 2, 2022

With the latest commits building the lib should be straightforward now, and the markd shenanigans should not be needed anymore.

@marghidanu
Copy link

Thank you @elbywan. Just compiled it from scratch on my M1 machine and it works fine!

@ghost
Copy link

ghost commented Jan 2, 2022

Thanks, compiles fine here as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants