Repository: spack/spack

Issue:
Installation issue: neovim libluv
### Steps to reproduce the issue

Working on retooling/updating my machine.  Trying to install the latest neovim on my M1 mac. @albestro @trws 

```console
$ spack install neovim
...
```


### Error message

<details><summary>Error message</summary>

<pre>
==> Error: ProcessError: Command exited with status 2:
    '/Users/psakiev/soft/dotfiles-spack/opt/spack/darwin-monterey-armv8.4a/apple-clang-14.0.0/gmake-4.4.1-2vkvhimmfpgrtax52czg7ghq6ceeidys/bin/make' '-j10'

7 errors found in build log:
     1125      ' (no such file), '/usr/local/liReason: tried: 'libluv.1.dylib' b/libluv.1.dylib' (no such file), '/usr/lib/libluv.1.dylib' (no such file)
     1126    (no such file), '/usr/local/lib/libluv.1.dylib' (no such file), '/usr/lib/libluv.1.dylib' (no such file), '/private/var/folders/ln/1_3kxbwd35s_ylsjlm3zmqmc00307v/T/psakiev/spack-stage/spack-stage-neovim-0.9.1-m2zlku4egizhq3ni4hhbvkrk7qnvvlju/spack-build-m2zlku4/runtime/pack/dist/opt/matchit/libluv.1.
             dylib' (no such file), '/usr/local/lib/libluv.1.dylib' (no such file), '/usr/lib/libluv.1.dylib' (no such file)
     1127    /bin/sh: line 1: 29383 Abort trap: 6           /private/var/folders/ln/1_3kxbwd35s_ylsjlm3zmqmc00307v/T/psakiev/spack-stage/spack-stage-neovim-0.9.1-m2zlku4egizhq3ni4hhbvkrk7qnvvlju/spack-build-m2zlku4/bin/nvim -u NONE -i NONE -e --headless -c helptags\ doc -c quit
     1128    /bin/sh: line 1: 29385 Abort trap: 6           /private/var/folders/ln/1_3kxbwd35s_ylsjlm3zmqmc00307v/T/psakiev/spack-stage/spack-stage-neovim-0.9.1-m2zlku4egizhq3ni4hhbvkrk7qnvvlju/spack-build-m2zlku4/bin/nvim -u NONE -i NONE -e --headless -c helptags\ ++t\ doc -c quit
     1129    /bin/sh: line 1: 29377 Abort trap: 6           ../../../bin/nvim -u NONE -i NONE -n --headless --cmd "set cpo+=+" -S /var/folders/ln/1_3kxbwd35s_ylsjlm3zmqmc00307v/T/psakiev/spack-stage/spack-stage-neovim-0.9.1-m2zlku4egizhq3ni4hhbvkrk7qnvvlju/spack-src/src/nvim/po/tojavascript.vim /private/var/folde
             rs/ln/1_3kxbwd35s_ylsjlm3zmqmc00307v/T/psakiev/spack-stage/spack-stage-neovim-0.9.1-m2zlku4egizhq3ni4hhbvkrk7qnvvlju/spack-build-m2zlku4/src/nvim/po/nvim.pot /var/folders/ln/1_3kxbwd35s_ylsjlm3zmqmc00307v/T/psakiev/spack-stage/spack-stage-neovim-0.9.1-m2zlku4egizhq3ni4hhbvkrk7qnvvlju/spack-src/runtim
             e/optwin.vim
     1130    /bin/sh: line 1: 29382 Abort trap: 6           /private/var/folders/ln/1_3kxbwd35s_ylsjlm3zmqmc00307v/T/psakiev/spack-stage/spack-stage-neovim-0.9.1-m2zlku4egizhq3ni4hhbvkrk7qnvvlju/spack-build-m2zlku4/bin/nvim -u NONE -i NONE -e --headless -c helptags\ doc -c quit
  >> 1131    make[2]: *** [runtime/CMakeFiles/runtime.dir/build.make:91: runtime/pack/dist/opt/vimball/doc/tags] Error 134
     1132    make[2]: *** Waiting for unfinished jobs....
  >> 1133    make[2]: *** [runtime/CMakeFiles/runtime.dir/build.make:81: runtime/doc/tags] Error 134
  >> 1134    make[2]: *** [src/nvim/po/CMakeFiles/translations.dir/build.make:418: src/nvim/po/nvim.pot] Error 134
     1135    make[2]: Leaving directory '/private/var/folders/ln/1_3kxbwd35s_ylsjlm3zmqmc00307v/T/psakiev/spack-stage/spack-stage-neovim-0.9.1-m2zlku4egizhq3ni4hhbvkrk7qnvvlju/spack-build-m2zlku4'
  >> 1136    make[2]: *** [runtime/CMakeFiles/runtime.dir/build.make:86: runtime/pack/dist/opt/matchit/doc/tags] Error 134
     1137    make[2]: Leaving directory '/private/var/folders/ln/1_3kxbwd35s_ylsjlm3zmqmc00307v/T/psakiev/spack-stage/spack-stage-neovim-0.9.1-m2zlku4egizhq3ni4hhbvkrk7qnvvlju/spack-build-m2zlku4'
  >> 1138    make[1]: *** [CMakeFiles/Makefile2:2432: src/nvim/po/CMakeFiles/translations.dir/all] Error 2
     1139    make[1]: *** Waiting for unfinished jobs....
  >> 1140    make[1]: *** [CMakeFiles/Makefile2:2541: runtime/CMakeFiles/runtime.dir/all] Error 2
     1141    make[1]: Leaving directory '/private/var/folders/ln/1_3kxbwd35s_ylsjlm3zmqmc00307v/T/psakiev/spack-stage/spack-stage-neovim-0.9.1-m2zlku4egizhq3ni4hhbvkrk7qnvvlju/spack-build-m2zlku4'
  >> 1142    make: *** [Makefile:159: all] Error 2

See build log for details:
  /var/folders/ln/1_3kxbwd35s_ylsjlm3zmqmc00307v/T/psakiev/spack-stage/spack-stage-neovim-0.9.1-m2zlku4egizhq3ni4hhbvkrk7qnvvlju/spack-build-out.txt
</pre></details>


### Information on your system

* **Spack:** 0.21.0.dev0 (2cb66e6e44aacca9ea81517031223d662cea23b9)
* **Python:** 3.9.6
* **Platform:** darwin-monterey-m1
* **Concretizer:** clingo

### Additional information

[spack-build-out.txt](https://github.com/spack/spack/files/12403950/spack-build-out.txt)
[spack-build-env.txt](https://github.com/spack/spack/files/12403952/spack-build-env.txt)


### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
Hmm wondering if this is related: https://github.com/NixOS/nixpkgs/pull/95364

This seems to be just an issue when using `libluv@1.44.2-1`. If I roll back to `@1.43` then I can install.
Sorry for the delay, but I've been super busy in the last months.

Today I had the chance to investigate a bit the problem and I'm pretty sure to have identified it (I opened an issue about it in https://github.com/neovim/neovim/issues/25770).

Starting from `libluv@1.44` they changed library names, which resulted in not using anymore `libluv` static library in favour of the dynamic one...which unfortunately does not work nicely on macOS due to RPATH problem (it is set but not used, I speculate it needs `@rpath` tag in library name, but not sure).

Anyway, the point here is that I confirm that limiting `libluv@1.43` solves the problem as you already experienced, so for the time being until `neovim` will fix the problem with RPATH on macOS, I would add a conflict (I'm going to open a PR soon™).

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/libluv/package.py b/var/spack/repos/builtin/packages/libluv/package.py
--- a/var/spack/repos/builtin/packages/libluv/package.py
+++ b/var/spack/repos/builtin/packages/libluv/package.py
@@ -14,7 +14,9 @@ class Libluv(CMakePackage):
     homepage = "https://github.com/luvit/luv"
     url = "https://github.com/luvit/luv/releases/download/1.36.0-0/luv-1.36.0-0.tar.gz"
 
+    version("1.45.0-0", sha256="fa6c46fb09f88320afa7f88017efd7b0d2b3a0158c5ba5b6851340b0332a2b81")
     version("1.44.2-1", sha256="3eb5c7bc44f61fbc4148ea30e3221d410263e0ffa285672851fc19debf9e5c30")
+    version("1.44.2-0", sha256="30639f8e0fac7fb0c3a04b94a00f73c6d218c15765347ceb0998a6b72464b6cf")
     version("1.43.0-0", sha256="567a6f3dcdcf8a9b54ddc57ffef89d1e950d72832b85ee81c8c83a9d4e0e9de2")
     version("1.42.0-1", sha256="4b6fbaa89d2420edf6070ad9e522993e132bd7eb2540ff754c2b9f1497744db2")
     version("1.42.0-0", sha256="b5228a9d0eaacd9f862b6270c732d5c90773a28ce53b6d9e32a14050e7947f36")
diff --git a/var/spack/repos/builtin/packages/neovim/package.py b/var/spack/repos/builtin/packages/neovim/package.py
--- a/var/spack/repos/builtin/packages/neovim/package.py
+++ b/var/spack/repos/builtin/packages/neovim/package.py
@@ -17,6 +17,8 @@ class Neovim(CMakePackage):
 
     version("master", branch="master")
     version("stable", tag="stable", commit="7d4bba7aa7a4a3444919ea7a3804094c290395ef")
+    version("0.9.4", sha256="148356027ee8d586adebb6513a94d76accc79da9597109ace5c445b09d383093")
+    version("0.9.2", sha256="06b8518bad4237a28a67a4fbc16ec32581f35f216b27f4c98347acee7f5fb369")
     version("0.9.1", sha256="8db17c2a1f4776dcda00e59489ea0d98ba82f7d1a8ea03281d640e58d8a3a00e")
     version("0.9.0", sha256="39d79107c54d2f3babcad2cd157c399241c04f6e75e98c18e8afaf2bb5e82937")
     version("0.8.3", sha256="adf45ff160e1d89f519b6114732eba03485ae469beb27919b0f7a4f6b44233c1")
@@ -136,7 +138,10 @@ class Neovim(CMakePackage):
     # Support for `libvterm@0.2:` has been added in neovim@0.8.0
     # term: Add support for libvterm >= 0.2 (https://github.com/neovim/neovim/releases/tag/v0.8.0)
     # https://github.com/neovim/neovim/issues/16217#issuecomment-958590493
-    conflicts("^libvterm@0.2:", when="@:0.7")
+    conflicts("libvterm@0.2:", when="@:0.7")
+
+    # https://github.com/neovim/neovim/issues/25770
+    conflicts("libluv@1.44:", when="platform=darwin")
 
     @when("^lua")
     def cmake_args(self):


Test patch: