Re: Conflicting installation advice

"Gabriel Scherer [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <CAPFanBH4+-hwX3E91vuMaywW0hbTzUaDALA81364d89ox5n2RA@mail.gmail.com>
I think it is possible to install the OPAM binaries without depending
on OCaml, and some distributions have this option -- Fedora for
example. If you do this, the first invocation of OPAM will ask you to
specify an OCaml version to install, using
  opam init --comp=4.02.3
for example.

Independently, it is possible to use a system OCaml installation to
install OPAM, and then do the rest of your work in an OPAM-specific
OCaml version that is installed after OPAM. OPAM support the notion of
"switches", that you have several compiler installed simultaneously,
with different set of installed packages. I guess that the most common
workflow is to install OPAM (by whatever technique, with OCaml in the
system or not), and then start with
  opam switch install 4.02.3
to install a new independent "switch" (your OCaml development place)
with the latest OCaml version.

In particular, I think that it is good to use system packages for
software that I use as an end-user, even those written in OCaml: Why3,
Unison, Coq, etc. I use OPAM for OCaml *development*, which need
greater flexibility in the library and tools installed. This means
that having a "system OCaml" together with one or several "development
switches" is the expected state.

Finally, OPAM also supports a form of cooperation with the "system
OCaml", in the form of a dedicated switch named "system", that denotes
whatever version of OCaml is installed by your system. There is some
level of cooperation with the system in this mode: when compiling
programs from this switch, I think they will see both OCaml libraries
installed by the system package manager and those coming from OPAM.
But I rarely use it so I cannot comment much on how it work.


Note that installing system packages may also be useful for dependency
reasons. Some OPAM packages will require you to install system
libraries, or have optional dependencies on system libraries that
enable additional features. OPAM will tell you that it is the case,
but the package name it gives may not be the one used by your system
package manager. A simple solution is to ask the system to install the
corresponding OCaml library (in the system switch, if you want), as a
quick and dirty way to make sure all corresponding system dependencies
will be pulled.
I encountered an instance of this problem recently: on some Fedora
machine, installing OCaml after OPAM had worked, except that the
Graphics library (usually bundled with the compiler) was not
available. It turned out that the x11 library headers were not
installed on this system, and thus compilation of the compiler from
sources (as done by OPAM) had just silently disabled Graphics at
configure time. I could fix it by installing x11-devel, but installing
the distribution's OCaml package (which depends on x11-devel) would
also have solved the problem -- and does not require as much thinking.

On Sat, Aug 15, 2015 at 3:46 PM, Hendrik Boom [email protected]
[ocaml_beginners] <[email protected]> wrote:
> On https://ocaml.org/docs/install.html it says:
>
> OPAM
>
> OPAM is a package manager for OCaml. It is the recommended method to
> install the OCaml compiler and OCaml packages.
>
> Nice.  One specialised installer to install everything ocaml, which
> enables me to keep things more up-to-date than my distro might.
>
> And on https://opam.ocaml.org/doc/Install.html it says the preferred way
> to install opam is from my distro's package repository.
>
> So thats the bootstrap mechanism.
>
> But when I ask aptitude to install opam, it also installs a huge number
> of other packages, such as ocaml.  Not surprising, because opam installs
> packages from source.
>
> This would seem to put ocaml, and all those other packages outside the
> scope of opam.  Too late to install ocaml using opam.
>
> If I persist in using opam to install ocamland other libraries, how do
> I distinguish the two installations -- the one by opam and the one
> from aptitude?
>
> -- hendrik
>
>
>
>
> ------------------------------------
> Posted by: Hendrik Boom <[email protected]>
> ------------------------------------
>
> Archives up to December 31, 2011 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners
> The archives of the very official ocaml list (the seniors' one) can be found at http://caml.inria.fr
> Attachments are banned and you're asked to be polite, avoid flames etc.
> ------------------------------------
>
> Yahoo Groups Links
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.