Search code examples
macosgtkocamlopam

Installing ocaml-top on OSX - GTK issue


I am trying to install ocaml-top on macOS High Sierra 10.13. I have installed homebrew (using the command given at https://brew.sh/) and done:

brew install opam
opam init  

and answered Y to "Do you want Opam to modify ~/.bash_profile and ~/.ocamlinit". Then:

eval `opam config env`
opam install ocaml-top

I get the following error

The following actions failed
  ∗  install conf-gtksourceview 2
No changes have been performed

=-=- conf-gtksourceview.2 troobleshooting -=-=-=-=-
=> This package relies on external (system) dependencies that may be 
missing.
   `opam depext conf-gtksourceview.2' may help you find the correct
   installation for your system.

[EDIT: trying on a second mac computer, the error is "[ERROR] The compilation of conf-gtksourceview failed at "pkg-config gtksourceview-2.0"."]

The above depext command gives:

# The following system packages are needed:
#  - gtksourceview
#  - libxml2
# All required OS packages found.

I have found advice (e.g. https://github.com/OCamlPro/ocaml-top/issues/46) like: "If you installed gtk+ through brew, you may need to do 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig' (homebrew)". However typing either that or "export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig" in the terminal and retrying does not help.

I do not know anything about any of this, but it looked libgtksourceview2.0-dev might be involved, so I tried

 opam install libgtksourceview2.0-dev

but

[ERROR] No package named libgtksourceview2 found.

Likewise "brew install libgtksourceview2.0-dev" or "brew install libgtksourceview".

https://github.com/ocaml/opam-repository/issues/8449 seems to imply this error could be because other packages need to be upgraded, and mentions that "the expanded pkg-config --short-errors --print-errors "gtksourceview-2.0 >= 2.2.0" [...] does print more information". I have no idea what this means though and how to detect which packages need to be upgraded.


Solution

  • You could try

    brew install pkg-config gtksourceview libxml2
    

    Otherwise, running brew search <part-of-name-of-dep> may help to find the required dependencies.