How to build OCaml reference manual for an opam switch? - ocaml

I like to have a local copy of the ocaml reference manual that correspond to the current version I'm using, so I used to build the documentation when I was compiling ocaml from source.
Now that I use opam, I was wondering if it was possible to ask it to build the documentation when I create a new switch.

Not directly, but you can install a matching version of the manual with
opam install ocaml-manual

You can get the reference manual and documentation for all installed packages via the odig utility,
opam install ocaml-manual odig odoc #installs necessary packages
odig odoc # builds the documentation (takes a while)
odig doc # opens the built documentation in your browser
You can also use odig to search for packages and otherwise explore your opam installation.

Related

VCPKG: list available versions of a package

For example, how can I list available GDAL library versions ?
They are not listed on VCPKG packages website neither by vcpkg search gdalcommand.
Try this! it is a quick fix until vcpkg supports pkgs version listing. https://github.com/hamaney/vcpkg_version_finder.
on a related note:
to look up a package by name and get the latest available version of it use vcpkg search <pkg name>
UPDATE SEP-11-2021:
I just found out that you can use the experimental flag x-history. for example vcpkg x-history <pkg name> (you might need an internet connection the first time you run this command).
You can use https://vcpkg.link/ in order to find all the versions of a package and when it got released (e.g. https://vcpkg.link/ports/gdal/versions for gdal). Besides, you can also see from which version a given feature has been introduced by looking at the overview of a package.
Disclosure: I'm the creator of the platform.

VCPKG versions of packages

is there possibility how to install older version of packages by using vcpkg install?
I found that there is a file in versions/baseline.json, but even if I change the version of the package there, it always install the newest one.
Maybe https://github.com/microsoft/vcpkg/blob/master/docs/specifications/versioning.md is what you are looking for. Be aware you need to pass an additional flag to vcpkg to activate that feature. It also only works in manifest mode and not in classic mode.

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.

RedHawk building from source --- locate the code installing uhd3.5.3

I am trying to build from source for RedHawk installation and trying to replace uhd3.5.3 with a higher version of uhd for USRP_UHD module. I saw USRP_UHD source code, but found nowhere for uhd3.5.3 source code. I am guessing it might simply use "yum install ..." to download and install uhd host code and suporting libraries. Does anybody know where this code is located in redhawk_src_2.0 package? Or is there an efficient way in linux to search for this among all the files in redhawk_src_2.0 package?
Thanks in advance!
UHD is the USRP Harware driver softwware from Ettus Research. The UHD is distributed from:
http://files.ettus.com/binaries/uhd_stable/
Version 3.5.3 is here:
http://files.ettus.com/binaries/uhd_stable/uhd_003.005.003-release/
The current release is 3.9.2:
http://files.ettus.com/binaries/uhd_stable/uhd_003.009.002-release/
Hopefully this helps. I wasn't 100% sure what you are asking for.
First, clone the uhd library:
git clone git://github.com/EttusResearch/uhd.git
Then checkout the 3.9.2 tag:
git checkout release_003_009_002
Using the instructions from Ettus (http://files.ettus.com/manual/page_build_guide.html), install the dependencies listed under the Fedora section:
sudo yum -y install boost-devel libusb1-devel python-mako doxygen python-docutils cmake make gcc gcc-c++
Next, generate the Makefiles with CMake:
cd <uhd-repo-path>/host
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/uhd ../
I recommend using an alternate install prefix at first to preserve the 3.5.3 version, just in case, but if you don't want to, just run:
cmake ../
instead of the longer command with the -DCMAKE_INSTALL_PREFIX flag. (Note: I couldn't get cmake to find the installed boost version, so you may have to do some other research on that since it is probably a whole different stackoverflow post in and of itself)
Now build and install the uhd library:
make
make test
sudo make install
Now that the library is installed, you should edit the USRP_UHD/cpp/configure.ac so that the PKG_CONFIG_PATH points to your install prefix (either the one specified in the flag above, or if you did the default, just leave it, as it should already be pointing to /usr/local/lib/pkgconfig). Also in the configure.ac file, make sure to change the uhd version number to 3.9.2.
Now you should be able to rebuild the USRP_UHD Device:
./reconf && ./configure && make install
I don't guarantee that the Device will build against the new version of the uhd library, that will depend on what (if anything) has been deprecated an removed from the library between the supported version and the newest one.
Finally, if you get through all of those steps successfully and if you specified a non-standard install prefix, you will have to add this prefix to either the LD_LIBRARY_PATH or an /etc/ld.so.conf.d/ script in order for the Device to correctly execute.
Clarification - you can follow the Redhawk manual appendix B for building Redhawk from source AFTER installing UHD v3.9.3 from source as per pwolframs instructions. The UHD v3.5.3 is not packaged with the Redhawk source code, only the Redhawk RPM, disregard all those RPMs when building UHD and Redhawk from source.

How to install corebuild in ocaml

I have installed opam, and after this I can access ocaml, ocamlc, buildocaml successfully.
But I am reading Real World OCaml which is asking me to run a tool called corebuild.
I am not able to install (or run) corebuild.
If I search for sudo find / -name corebuild... I can see files like
/home/abhishek/.opam/repo/default/packages/core/core.109.38.00/files/corebuild
/home/abhishek/.opam/repo/default/packages/core/core.109.42.00/files/corebuild
/home/abhishek/.opam/repo/default/packages/core/core.109.35.00/files/corebuild
/home/abhishek/.opam/repo/default/packages/core/core.109.34.00/files/corebuild
/home/abhishek/.opam/repo/default/packages/core/core.109.47.00/files/corebuild
/home/abhishek/.opam/repo/default/packages/core/core.109.41.00/files/corebuild
/home/abhishek/.opam/repo/default/packages/core/core.109.32.00/files/corebuild
/home/abhishek/.opam/repo/default/packages/core/core.109.37.00/files/corebuild
/home/abhishek/.opam/repo/default/packages/core/core.109.45.00/files/corebuild
/home/abhishek/.opam/repo/default/packages/core/core.109.36.00/files/corebuild
/home/abhishek/.opam/repo/default/packages/core/core.109.40.00/files/corebuild
But still then I don't know how to run this tool.
You need to run opam install core to get corebuild.
More generally, you should look at the install instructions here, which will show you which libraries to install. Note that corebuild is a simple wrapper around ocamlbuild, and it assumes that you have core installed, and gives you the option of using it by default.