Opam switch install could not install the older version of ocaml (3.08.3) - ocaml

I'm doing some works with ocaml and opam.
I need ocaml of version 3.08.3, so I tried install this version via opam.
opam switch install 3.08.3
The above command would install it successfully, I hoped. But it couldn't.
opam-switch could not install 3.* versions of ocaml with the following error message.
[ERROR] Could not resolve set of base packages
I searched this message everywhere, but I couldn't get any of hints. Does anyeone have a clue to solve this problem? Thanks.

compilers/3.08.3/3.08.3/3.08.3.comp, the file to describe the base packages for that compiler version tells:
packages: [
"base-unix"
"base-bigarray"
"base-threads"
"base-ocamlbuild"
]
So it requires base-unix, base-bigarray, base-threads and base-ocamlbuild. However, the package description of base-ocamlbuild, packages/base-ocamlbuild/base-ocamlbuild.base/opam says:
ocaml-version: [>= "3.10" & < "4.03"]
It says that ocamlbuild is not available before 3.10. Indeed, ocamlbuild was introduced since 3.10. It is likely that the compiler description file 3.08.3.comp has a bug. It is great if you would raise a bug ticket at https://github.com/ocaml/opam-repository/issues for the fix.
For a workaround, I recommend to install OCaml 3.08 by hand, not using OPAM command: I see almost no benefit to use OPAM with 3.08 where ocamlbuild is not available, since most of the OPAM packages assume the existence of ocamlbuild.
You could also create your own copy of OPAM repo with a fixed 3.08.3.comp file without "base-ocamlbuild". See the document of opam repo for more details.

Related

error while installing gmp (frama-c prerequisite) on mac os catalina using opam on terminal

I ran these commands to install Frama-C as said on http://frama-c.com/install-sulfur-20171101.html#installing-frama-c-on-mac-os-x:
brew install autoconf opam
Do not forget to opam init and eval $(opam config env) for a proper OPAM installation (if not already done before on your machine).
brew install gmp gtk+ gtksourceview libgnomecanvas
brew install graphviz
opam install altgr-ergo why3
I encountered an error after the 3rd command (of course there are 2 more commands to install frama-c completely, but the same error is showing up after the last command too).
ERROR while compiling conf-gmp.1
test.c:7:2: error: implicit declaration of function '__gmp_init' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
__gmp_init();
Your issue is related to opam and the conf-gmp (version 1) package in particular, which is used by Frama-C, but not caused by it.
If you do opam update and then opam install conf-gmp.2, you should be able to install the package without errors.
Otherwise, if you have control over whatever is adding -Werror to your CFLAGS environment variable, you can try removing it and reinstalling the packages.
Long explanation
It is likely that your CFLAGS environment variable contains -Werror or some similar setting which is causing the warning emitted by conf-gmp during its compilation to become an error.
The conf-gmp.1 package indeed does emit a warning when compiled, but in standard settings, the warning is simply ignored by opam and everything works. In your system, the warning became an error, and prevented the other packages from being installed.
A new version of conf-gmp was posted after the issue was noticed due to this question. Running opam update and then opam install conf-gmp.2 should get this new version and hopefully avoid any warnings. Note that having -Werrors in CFLAGS may trigger some issues in other packages, however. For instance, in my configuration, it is impossible to install lablgtk with -Werror, since its compilation inevitably raises several warnings. It might be necessary to add CFLAGS=-Wno-error or similar to ensure lablgtk will be compiled. Otherwise, you may have to compile Frama-C from source (lablgtk is optional in this case).

opam install error "no solution found"

I came across a bug when installing certain packages using opam.
> opam install foo
Sorry, no solution found: there seems to be a problem with your request.
No solution found, exiting
According to particular form of the error message I read you are using the opam v1.2 internal solver (which you can confirm via opam config report). This solver is no longer able to cope with the repository.
Either install an external solver, see here or switch to opam v2 (currently in rc) which bundles a decent solver.
Opam was using a version of the ocaml compiler that wasn't able to install this package. So unistall the current version and use opam switch to set opam to use the latest ocaml compiler.
> opam switch x.xx.x
Then make sure to update/upgrade opam.
> opam update
> opam upgrade

Cannot install utop on RHEL 5.0

Having successfully installed opam and having switched to 4.01.0 version of compiler I am struggling to install utop. Installation is failing at 'conf-ncurses.1' step.
Running 'opam depext' does not reveal much, saying that 'no extra dependencies' need to be installed. Switching to latest stable compiler, and then installing utop fails with the same problem. The *.err and *.out files are empty, hence not revealing any problem.
On my box I also have ncurses-devl and pkgconfig installed (see rpm output below)
Below is the screenshot of what I can see (hopefully it give us enough information). Any ideas where to look at ?:
Screehshot
First of all, SO is not an issue tracker and it is better to report this issue to the package maintainers. The following command will reveal URLs for the issue trackers:
opam show conf-ncurses | grep bug-reports
opam show utop | grep bug-reports
Second, your output is not at sync with what I'm seeing in the opam-repository. At the current HEAD there is no check pkg-config ncurses at all, as it was removed three days ago. So, if you indeed have ncurses-devel package installed, then you need just to update opam, with
opam update

Opam not getting latest packages

I just installed opam using the quick install
http://opam.ocaml.org/doc/Quick_Install.html
I now have
$opam --version
1.1.0
which is current. I ran "opam update" and "opam upgrade" to get the latest packages. However, when I install packages, it is still giving me the old versions (such as core 109.42 instead of core 109.55):
$ opam search core
Available packages for 4.01.0:
async_core 109.42.00 Monadic concurrency library
What do I need to do to get opam to give me the latest libraries?
If you previously built from source, make sure you uninstall that first. For whatever reason, even though the opam version correctly reports "1.1.0", it was still using the old repo address. After you uninstall old opam entirely, then follow the installation instructions at the link above.
You will know you succeeded when you do "opam update" and prints:
default Downloading http://opam.ocamlpro.com/urls.txt
[NOTE] The repository 'default' will be *permanently* redirected to https://opam.ocaml.org (opam-version >= "1.1.0")

Ocaml Opam install camlbz2

Error while installing camlbz2
%opam install camlbz2
...
...
. checking bzlib.h usability... no
. checking bzlib.h presence... no
. checking for bzlib.h... no
awk: line 1: regular expression compile failed (syntax error ^* or ^+)
^+
configure: error: not found 'opam install camlbz2' failed.
I can not find anything for opam to install something like "libbz2" or whatever, any suggestions?
OPAM only deals (currently) with OCaml source packages.
Here, your problem comes from the ./configure script of the OCaml package detecting that a system package is missing, not an OCaml package (you can see that it has searched for files with a .h extension, i.e. a C include file).
To fix your problem, you need to install this system package. As Ontologiae said, the missing package is related to the libbz2 library, and include files are usually provided in development packages, so you should probably try to install libbz2-dev using the system installer of your OS. This package is not in OCaml, so there is no risk of messing up with OPAM installation.
Note that, since you use opam config -env to set your OCaml environment, even if you install OCaml packages with your system installer, there should be no bad interaction with packages installed in your homedir by OPAM.
You need to install the libbz2 C library. So, check your package system and install it.
In Debian, it's the package "libbz2-dev" (so sudo apt-get install libbz2-dev)