opam icon indicating copy to clipboard operation
opam copied to clipboard

Opam cannot recognize Emacs that is built from source

Open sangwoo-joh opened this issue 2 years ago • 4 comments

  • Opam version: 2.1.0
  • Emacs version: 28.0.90 (built from source code)

When installing tuareg, Opam shows the following message:

The following system packages will first need to be installed:
    emacs

I've installed emacs via source code (make install), so I clearly have it in /usr/local/bin/emacs path. However, it seems Opam cannot recognize this installation. Does Opam not look for /usr/local/bin path when looking for system packages? If so, why is that?

Thanks!

sangwoo-joh avatar Aug 19 '22 08:08 sangwoo-joh

I know there is additional options like --assume-depexts or depext-run-install=false, but I just want to understand this behaviour.

sangwoo-joh avatar Aug 19 '22 08:08 sangwoo-joh

Does Opam not look for /usr/local/bin path when looking for system packages? If so, why is that?

Indeed it does not.

The reason is that opam-depext was formally a plugin not integrated to opam and only had the depexts field to use. No installability check was done and the relevant system packages were only installed when the plugin was used explicitly. The plugin model caused many problems and was integrated with added installability check into opam in 2.1.0 with --assume-depexts as an escape hatch for manual installations for example.

Checking for the presence of a binary instead of a system package requires a new field if we want to do it properly, which would make it incompatible with previous opam version, thus it was more pushed as a feature for opam 3.0 when it was discussed some time ago. Plus given the availability of escape hatches such as --assume-depexts, --no-depexts or opam option depext=false, it was judged low priority.

kit-ty-kate avatar Aug 19 '22 11:08 kit-ty-kate

@kit-ty-kate Wow, thanks for your kind and detailed explanation! I didn't know the history behind this feature until your comment. Indeed, I can bypass this by --assume-depexts, but sometimes it is very helpful to let opam install packages by itself. Sorry for the low priority. I will wait for the opm 3.0!

sangwoo-joh avatar Aug 19 '22 13:08 sangwoo-joh

Note also that, while the current interface and cli flags may be confusing, the upcoming version should be pretty clear in how you can work around that lack of detection. See https://github.com/ocaml/opam/pull/5053#issuecomment-1036509239 for a sneak peek.

AltGr avatar Aug 23 '22 14:08 AltGr