reasonml / reason-cli

Globally installable Reason toolchain.
MIT License
291 stars 23 forks source link

ocamlmerlin binary broken in 3.3.3-macos? #87

Closed pascalw closed 6 years ago

pascalw commented 6 years ago

Hi,

I just installed npm -g install reason-cli@3.3.3-macos, but now my VSCode plugin is not working anymore. Digging in a little it seems that ocamlmerlin is broken:

❯ /Users/Pascal/.asdf/installs/nodejs/8.9.1/.npm/lib/node_modules/reason-cli/bin/ocamlmerlin -h
execvp(ocamlmerlin-server): No such file or directory
merlin path: /Users/Pascal/.asdf/installs/nodejs/8.9.1/.npm/lib/node_modules/reason-cli/bin/ocamlmerlin-server
socket path: /var/folders/yq/ggpg7lnd6nndbnhr5xxyqhg80000gn/T//<not computed yet>

This error is also exposed in VSCode, see https://github.com/reasonml-editor/vscode-reasonml/issues/243.

On the previous version (3.3.2-macos-betabeta) the VSCode plugin is working and the binary seems to work:

❯ /Users/Pascal/.asdf/installs/nodejs/8.9.1/.npm/lib/node_modules/reason-cli/bin/ocamlmerlin -h
Usage: ocamlmerlin-server <frontend> <arguments...>
Select the merlin frontend to execute. Valid values are:

- 'old-protocol' executes the merlin frontend from previous version.
  It is a top level reading and writing commands in a JSON form.

- 'single' is a simpler frontend that reads input from stdin,
  processes a single query and outputs result on stdout.

- 'server' works like 'single', but uses a background process to
  speedup processing.
If no frontend is specified, it defaults to 'old-protocol' for
compatibility with existing editors.
jordwalke commented 6 years ago

Thanks for letting me know. Can you try again to repro? Also what version of MacOS are you on? (I'm not able to repro this).

pascalw commented 6 years ago

I can reproduce this consistently, both with npm and yarn. If I rename the ocamlmerlin binary to ocamlmerlin-server, the binary works (at least outputs help). Though VSCode then still cannot work with it.

I'm on macOS 10.13.6.

jordwalke commented 6 years ago

Discussing in Discord #general right now, if you happen to be around.

andreypopp commented 6 years ago

@pascalw can you archive and send me reason-cli installation (from inside node_modules). You can find me on discord under same nickname.

andreypopp commented 6 years ago

Hm... I can repro this if I run not via nodenv shims but directory via reason-cli/bin/ocamlmerlin. Investigating.

andreypopp commented 6 years ago

Ok, so the problem is that merlin assumes that ocamlmerlin-server resides in the same dir as ocamlmerlin: https://github.com/ocaml/merlin/blob/8bcd99c8e5de984f04966674dcbb1c40c5d89045/src/frontend/ocamlmerlin.c#L496

Simplest repro:

% PATH="$HOME/.nodenv/versions/9.0.0/bin:$PATH" ocamlmerlin -version
The Merlin toolkit version next, for Ocaml 4.02.3
% ~/.nodenv/versions/9.0.0/bin/ocamlmerlin --version
execvp(ocamlmerlin-server): No such file or directory
merlin path: /Users/andreypopp/.nodenv/versions/9.0.0/lib/node_modules/reason-cli/bin/ocamlmerlin-server
socket path: /var/folders/ds/qlqp24pd0kj3kfyfx7v8jmk00000gn/T//<not computed yet>
pascalw commented 6 years ago

Thanks!

andreypopp commented 6 years ago

Should be fixed with reason-cli@3.3.3-macos-1.

pascalw commented 6 years ago

Confirmed!