spack / spack

A flexible package manager that supports multiple versions, configurations, platforms, and compilers.
https://spack.io
Other
4.19k stars 2.23k forks source link

Neovim missing libluv during runtime when building module on mac #39973

Open JBlaschke opened 11 months ago

JBlaschke commented 11 months ago

Steps to reproduce

This is a combination of building Neovim 0.9 on mac, and loading it via modules. I have lmod set up to ignore implicit modules, and libluv is an implicit package (it's installed as a dependency for neovim, but I don't run spack install libluv -- so a module is never generated for it).

  1. Install neovim: spack install neovim
  2. Make sure you haven't explicitly installed libluv
  3. Generate module files: spack module lmod refresh
  4. Load neovim module: ml load neovim
  5. Run nvim

This will crash with the error dyld[46837]: Library not loaded: 'libluv.1.dylib'. Note also that the module file generated for neovim/0.9 does not include the libluv:

whatis("Name : neovim")
whatis("Version : 0.9.1")
whatis("Target : skylake")
whatis("Short description : Neovim: Vim-fork focused on extensibility and usability")
help([[Name   : neovim]])
help([[Version: 0.9.1]])
help([[Target : skylake]])
help()
help([[Neovim: Vim-fork focused on extensibility and usability]])
depends_on("libuv/1.46.0-apple-clang-14.0.0")
conflict("neovim") 

A workaround is running spack install libluv followed by spack module lmod refresh -- this generates a libluv module and includes it as a dependency in neovim/0.9:

whatis("Name : neovim")
whatis("Version : 0.9.1")
whatis("Target : skylake")
whatis("Short description : Neovim: Vim-fork focused on extensibility and usability")
help([[Name   : neovim]])
help([[Version: 0.9.1]])
help([[Target : skylake]])
help()
help([[Neovim: Vim-fork focused on extensibility and usability]])
depends_on("libluv/1.44.2-1-apple-clang-14.0.0")
depends_on("libuv/1.46.0-apple-clang-14.0.0")
conflict("neovim") 

I don't know what the "right" solution is here. You could make all runtime dependency modules be generated. But I think that would be wrong. I think the real problem is that libluv is not being linked via RPATHs. Therefore tagging @albestro @trws as neovim maintainers.

Error message

Dynamic linker error:

dyld[46837]: Library not loaded: 'libluv.1.dylib'

Information on your system

I have spack set up to exclude implici modules:

modules:
  default:
    enable::
      - lmod
    lmod:
      exclude_implicits: true
      hash_length: 0
      all:
        conflict:
        - "{name}"
      hierarchy:
        - mpi
      projections:
          all: "{name}/{version}-{compiler.name}-{compiler.version}"

spack debug report:

* **Spack:** 0.21.0.dev0 (a0bd53148be23b598052b7851ca83ce35c3d7cfc)
* **Python:** 3.9.17
* **Platform:** darwin-monterey-skylake
* **Concretizer:** clingo

General information

alalazo commented 10 months ago

Re-tagged as "build-error" since it seems more an issue with software recipes, than with core Spack.

albestro commented 10 months ago

Likely this problem can be traced back to what I reported in https://github.com/spack/spack/issues/39563#issuecomment-1777590993.

Can you @JBlaschke try with an older version of libluv? In particular, something <=1.43.

albestro commented 10 months ago

@JBlaschke in case, feel free to review also the PR mentioned above. 😉

JBlaschke commented 10 months ago

@albestro this makes sense. I'm traveling without my work computer (my only Apple device) until Nov 1st. I can check then.

Out of curiosity, how does one install a spack package while limiting the version of a dependency (without editing the package.py)? I.e. using the spec?

albestro commented 10 months ago

@JBlaschke no worries. In the meanwhile I got some suggestions and it ends up that there is a fix. If you test #40716 it should work even without constraining libluv.

Anyway, FIY, you can constrain dependency using ^ caret operator, e.g. spack install neovim ^ libluv@1.43