Opam not getting latest packages - ocaml

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")

Related

Using the most recent version of zarith with opam

I am using zarith for handling arbitrary sized integers.
The most recent version I could find on opam.ocaml.org was v1.9.1 (published in August 2019). On the project's github page I read Latest commit a9a309d on 23 Jan (2020).
I'd like to switch to the newer version, but how do I do that? I want to
keep opam happy, and
always use the most current version of zarith.
Please help!
Indeed, currently 1.9.1 is both the latest version of Zarith available as an opam package (https://opam.ocaml.org/packages/zarith/) and as a GitHub tag (https://github.com/ocaml/Zarith/tags).
However, given this upstream Git repository also contains an .opam specification file, you can just as well use opam to install the latest development version available in the master branch, or if need be, a precise Git commit just by relying on the so-called pinning feature of opam.
So, you can run alternatively:
opam pin add -n -y -k git zarith.dev --dev-repo
or
opam pin add -n -y -k git zarith.dev "https://github.com/ocaml/Zarith.git#master"
or
opam pin add -n -y -k git zarith.dev "https://github.com/ocaml/Zarith.git#a9a309d0596d93b6c0c902951e1cae13d661bebd"
Then:
opam install zarith
Further details on the opam-pin command
The .dev version suffix is unneeded syntactically, but is recommended actually, as the zarith.opam file does not specify any version. To be more precise:
If you have other dependencies that would complain of zarith.dev when being installed, you can replace the version suffix of dev with any compatible version string, "close" to the commit or branch you selected.
However if you omit this version, opam will typically pick the latest version string from the opam package repository (i.e., 1.9.1), which wouldn't necessarily match the code of the Git branch or commit you selected.
-n, -y, and -k are the short form of the options:
--no-action (don't install the package readily but wait the subsequent opam install command),
--yes (answer potential yes/no questions without prompting − a common opam pin question is Package foo does not exist, create as a NEW package? [Y/n] if ever you'd want to install a custom package not yet released in the opam-repository),
--kind=KIND (as there are several KINDS of pinning, the most typical being version, path, and git)
If you really need to use the unreleased, in-development version of zarith you can use the --dev-repo option of opam pin add:
opam pin add --dev-repo zarith
opam install zarith

Upgrading opam on Ubuntu 14.04

I'm trying to upgrade my opam to the latest version of Ubuntu 14.04
chris#chris-870Z5E-880Z5E-680Z5E:~$ sudo opam update
default Downloading https://opam.ocaml.org/1.1/urls.txt
Updating ~/.opam/repo/compiler-index ...
Updating ~/.opam/compilers/ ...
Updating ~/.opam/repo/package-index ...
Updating ~/.opam/packages/ ...
The following package has been DELETED:
- camlp4.4.02.0+2
[WARNING] install and dev-repo are unknown fields in /home/chris/.opam/repo/default/packages/liquidsoap/liquidsoap.1.1.1/opam: is your OPAM up-to-date ?
[WARNING] install is an unknown field in /home/chris/.opam/repo/default/packages/ocurl/ocurl.0.7.2/opam: is your OPAM up-to-date ?
Updating the cache of metadata (~/.opam/state.cache) ...
23 to install | 17 to reinstall | 16 to upgrade | 1 to downgrade | 0 to remove
You can now run 'opam upgrade' to upgrade your system.
chris#chris-870Z5E-880Z5E-680Z5E:~$ sudo opam upgrade
[WARNING] External solver failed with inconsistent return value. Request saved to "/home/chris/.opam/log/solver-error-6572-1.cudf"
Falling back to the internal heuristic.
The dependency ocamlbuild of package variantslib.109.15.03 is not available for your compiler or your OS.
'opam upgrade' failed.
As the error message says, it appears that variantslib.109.15.03 is not available on my OS/compiler version. Is there any way I can get around this? Here is my compiler version:
chris#chris-870Z5E-880Z5E-680Z5E:~$ ocaml -version
The OCaml toplevel, version 4.02.0
First of all, don't use sudo as opam is installed in your user folder, so you may actually break it by locking it from yourself. (I think you already did it). In general, don't use sudo if you're not absolutely sure what you're doing.
The solver is unable to find a package variantslib that will fit into constraints of your system. If you're installing or using some package, that you believe should work for the Ubuntu 14.04 LTS, then I would suggest you just to start from a clean state and install it, instead of performing the update. Since you already messed with sudo, I would actually suggest you to remove the ~/.opam folder, and start with
opam init
And install whatever you need from scratch.
If I remember well, I had some issues with opam 1.1 in the past... And the opam FAQ states that you should move to opam 1.2 (because of : ubuntu bugs).... I personally use opam 1.2.2 (on ubuntu 16.04 & 12.04...)

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

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.

Cannot install Core, unlikely download issues reported

I'm trying to install Janestreet's Core for OCaml using opam on Mac OsX to get started with the "Real world OCaml" book.
I get the following error:
===== ERROR while installing herelib.109.35.02 =====
Could not get the source for herelib.109.35.02:
# opam-version 1.1.1
# os darwin
Cannot download https://opam.ocaml.org/archives/herelib.109.35.02+opam.tar.gz,
please check your connection settings.
All other libraries after herelib fail as well.
I don't have connection problems, though, as the libraries up to herelib do download (last successful is type_conv as far as I can tell). Also, pasting the reported URL in Chrome starts a file download immediately, so it doesn't seem to be a server problem at the source.
Homebrew reports my Opam and Ocaml as up to date.
Any ideas?
Your version numbers for both herelib and opam looks quite outdated. The following may help:
Update your repository with opam update
Try to use more recent opam, it is available under macports and brew.

Specify which version to install with macports

I would like to install a specific version of gdb and gcc with macports on mac os x leopard, not the last one, but the 6.8 for gdb. Is it possible?
It is possible. It's just convoluted and tedious. It's listed in the documentation these days.
Steps
Go to macports trac and find the package you're looking for. This is the link for subversion, which is the package I'll be using in the example.
Click the PortFile
Click Revision Log (top right)
Pour through the revisions until you find the version you're looking for. Remember the revision number.
In this example I'm looking for version 1.7 of subversion.
With that revision number noted. You need to checkout the version of that subdirectory at that revision.
cd /tmp
svn co http://svn.macports.org/repository/macports/trunk/dports/devel/subversion --revision 106629
Then cd into the folder and run the install
cd subversion
sudo port install
Then it should become selected by default. You can check with
sudo port installed subversion
The following ports are currently installed:
subversion #1.7.10_0 (active)
subversion #1.8.8_0
subversion #1.8.10_0
As I just came across this question when trying to figure out how to download an older version of curl, I thought I'd share an update:
The currently accepted answer did not work for me any longer. This is with MacPorts 2.2.0. What I did was the following.
I started following the directions located here. I ended up using the SVN method, since the first method didn't work. What I didn't realize is that I was missing a critical step.
I found another post that suggested moving the downloaded directory to /private/tmp. After doing this, I cd into the new directory and after a sudo port install I was able to install the older version.
I am on a Mac running OS X 10.8, so your mileage may vary.
This post is old.. but specifying a version is possible. For example I want to install ZeroMQ version 3.2.2 so I use:
sudo port install zmq #3.2.2
And it always helps to goto the MacPorts website and search to see if they have what you are looking for.
As far as I know it is not possible at all to install other versions than the exact version, unless there is a specific port for a certain version.
The only thing you could do is fetch the portfile of the desired version from the Macports subversion repository.
In your case only gdb 7.2 is available on the current version, no variants and no other versions - sorry :)