Problems using opam and ocaml - bash

I am working on RDP having Ubuntu 14.04 and trying to install ocaml.
I am trying to update my ocaml compiler to 4.05.0 or above but opam switch list gives only one compiler system C system System compiler (4.01.0). Also my opam update gives me below log.
[ERROR] Your version of OPAM (1.1.1) is not recent enough to read ~/.opam/repo/default/repo. Upgrade OPAM to a more recent version (at least 2.0) to read this file correctly.
[ERROR] Skipping https://opam.ocaml.org as the repository is not available.
Updating ~/.opam/repo/compiler-index ...
Updating ~/.opam/compilers/ ...
Updating ~/.opam/repo/package-index ...
Updating ~/.opam/packages/ ...
Updating the cache of metadata (~/.opam/state.cache) ...
Everything is up-to-date.
Any idea how to do this? Thanks for help in advance.
UPDATE:
I need to install newer opam version separately using binary distribution. with this
sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)
command I can install it but it will prompt me where to install it,
but I have to automate installation so that there is no interaction from user side. Is there a way to do it?
UPDATE 2:
found a way to do it using ppa see my answer.

Well, as the log says you have to update your OPAM to 2.x. The old version is no longer supported. So you have to follow the installation instructions and update your OCaml.

I tried using sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) but failed in doing it as non-interactive script.
I have found this method which does work, though using Ubuntu 14.04 adding ppa sudo add-apt-repository ppa:avsm/ppa and then doing update, upgrade, dist-upgrade and finally installation of opam will be of version 2.2 (latest as by ppa). Follow below commands for exact procedure.
add-apt-repository ppa:avsm/ppa
apt-get update -y
apt-get upgrade -y
apt-get dist-upgrade -y
apt-get install curl build-essential m4 zlib1g-dev libssl-dev ocaml ocaml-native-compilers opam -y
opam init --disable-sandboxing -y
eval `opam config env`
opam update
opam switch list-available
opam switch create 4.07.0
opam init -y
eval `opam config env`
After this Everything should be latest as of now.

Related

Installing Z3 with OCaml bindings

I'm trying to install Z3 with OCaml bindings and getting the following error.
cp ../src/api/ml/z3.mli api/ml/z3.mli
ocamlc -I api/ml -o api/ml/z3.cmi -c api/ml/z3.mli
File "api/ml/z3.mli", line 1159, characters 35-50:
Error: Unbound module Big_int
make: *** [api/ml/z3.cmo] Error 2
I firstly tried installing via
opam install z3
And then I tried cloning the Z3 repo and running
python scripts/mk_make.py --ml
cd build
make
After which I get the same error.
Any help would be greatly appreciated. Thank you!
The Z3 installation is expecting an older OCaml environment. In recent OCaml releases, Big_int is in the Num module.
$ opam install num
For what it's worth, I don't believe there is an OPAM module for Z3. If you run the Z3 install, the OCaml/Z3 interface gets installed as if it was an OPAM module (in ~/.opam). But it's not really.
I'm using Z3 every day, so I can verify that it works (both OCaml 4.03.0 and OCaml 4.06.0.)
Update
I just now verified that there is a Z3 package in OPAM these days, and I was able to install it under OCaml 4.06.0 on a previously clean system that I happen to have handy. The system is Ubuntu 14.04.
I needed to do the following initial installations:
sudo apt-get update
sudo apt-get install ocaml
sudo apt-get install m4
sudo apt-get install dev-libgmp
sudo apt-get install g++
Then I installed OPAM:
sudo add-apt-repository ppa:avsm/ppa
sudo apt-get update
sudo apt-get install opam
Now running as myself:
$ opam init
$ eval `opam config env`
$ opam update
$ opam switch 4.06.0
$ eval `opam config env`
$ opam install z3
$ ls ~/.opam/4.06.0/lib/z3
dllz3ml.so z3.cmi z3enums.cmx z3ml.cmxa z3native.cmx
libz3ml.a z3.cmo z3enums.mli z3ml.cmxs z3native.mli
libz3.so z3.cmx z3enums.o z3.mli z3native.o
META z3enums.cmi z3ml.a z3native.cmi z3native_stubs.o
opam.config z3enums.cmo z3ml.cma z3native.cmo z3.o
This looks good to me. I'm not a Z3 wizard; it's mostly just a dependency of a project I'm working on. But these are the files I'm used to seeing.

Mac OS X Can't install build-essential via brew or apt-get

So I've been trying for two days to unsuccessfully install build-essential on a Mac OS X Sierra with brew and apt-get. Researching into the issue has given me some results but nothing that has yielded any results.
sudo apt-get update
Reading Package Lists... Done
Building Dependency Tree... Done
Being lazy I've also listed below the other packages I'm struggling to install and their respective errors below.
sudo apt-get install -y build-essential
E: Couldn't find package build-essential
E: Couldn't find package libfreetype6-dev
E: Couldn't find package automake
E: Couldn't find package postgresql-9.5
Theres been a couple of suggestions to edit the source list of apt-get but I can't seem to find it.
What on Earth are you doing? macOS doesn't use apt-get - at all. It doesn't come with a package manager.
There are independent package management tools, to my mind the best of them is homebrew from here. Some folks use MacPorts.
Before you can do any development in macOS, you need Xcode's command-line tools - see here.
If you want Postgresql, I suggest you go to the homebrew website above, copy the one-line install and paste it into Terminal. Once you have that set up, you can install Postgresql with:
brew install postgresql
If you want to search for package abcXYZnnn, just search for any part of that name:
brew search XYZ
If you want to do updates, and upgrades:
brew update && brew upgrade
If you want to remove a package:
brew rm PACKAGENAME
You can use Homebrew:
brew install gcc binutils bison

Can not find the shared library:libhdfs3.so

everyone. I'm try to used Dask with Distributed + HDFS for processing some files. when I installed the distributed try to install the HDFS3 plugins, the error was :
Can not find the shared library:libhdfs3.so
My environment is Ubuntu 16 Desktop version. I strict according to bewlo, but still not working. Hope someone can help! Thanks a lot
conda install hdfs3 -c conda-forge
echo "deb https://dl.bintray.com/wangzw/deb trusty contrib" | sudo tee /etc/apt/sources.list.d/bintray-wangzw-deb.list
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install libhdfs3 libhdfs3-dev
pip install hdfs3
If you are not using conda and you are using pip, you can also face this error
Can not find the shared library:libhdfs3.so
To ensure requirements in this page https://github.com/ContinuumIO/libhdfs3-downstream/tree/master/libhdfs3
solved my problem.
There are packages that you should install, if you are installing with pip:
cmake (2.8+) http://www.cmake.org/
boost (tested on 1.53+) http://www.boost.org/
google protobuf http://code.google.com/p/protobuf/
libxml2 http://www.xmlsoft.org/
kerberos http://web.mit.edu/kerberos/
libuuid http://sourceforge.net/projects/libuuid/
libgsasl http://www.gnu.org/software/gsasl/ (need https://github.com/bdrosen96/libgsasl)
openssl https://www.openssl.org/
P.S.: OS: Centos7
Since no one answers this question and I figure out the solution by myself , at least it works for me.
conda install libhdfs3
pip install libhdfs3
conda install -c clinicalgraphics libgcrypt11
conda install libprotobuf=2.5
conda update libhdfs3
if still not work try to update.

Conflicting packages on ubuntu

I was installing Sass on ubuntu for that I first installed Ruby and then Sass. but when i tried sass -v it gave a deprecated message about currently install ruby1.9 version saying it will not be support in future. so i tried upgrading ruby version to 2.0 (2.3 is not being installed on ubuntu) using
$ sudo apt-get install ruby2.0
But when checking the ruby version it still showed 1.9 so i tried with UN-installing Ruby1.9 then it showed a dependent library to uninstalled. I even did that but after that on installing ruby 2.0 again it gives error
the following packages have unmet dependencies:
libantlr3c-antlrdbg-3.2-0 : Conflicts: libantlr3c-3.2-0
E: Unable to correct problems, you have held broken packages.
How to solve this??
Basically you should install it directly from source, like so:
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev
libreadline6-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p451.tar.gz
tar -xvzf ruby-2.0.0-p451.tar.gz
cd ruby-2.0.0-p451/
./configure --prefix=/usr/local
make
sudo make install
Solution found here.

Installing Ruby on Linux

I want to install only Ruby, not Ruby on Rails, I check this command:
sudo apt-get install ruby-full -g
But the terminal report me this error:
E:Command line option 'g' [from -g] is not known
This command will install the latest stable Ruby version and will make it
available globally (through the '-g' parameter) on your system environment...
Why do I get this error?
Update your package manager first:
sudo apt-get update
This must finish without error or the following step will fail.
Install curl:
sudo apt-get install curl
You’ll use curl for installing RVM.
Install RVM
curl -L https://get.rvm.io | bash -s stable --ruby
You Already Have RVM Installed
If you already have RVM installed, update it to the latest version and install Ruby:
rvm get stable --autolibs=enable
Install Ruby:
rvm install ruby
apt-get install ruby-full
apt (Debian or Ubuntu)
Debian GNU / Linux and Ubuntu use the apt package manager. You can use it as follows:
font: https://www.ruby-lang.org/pt/documentation/installation/
-g is not an option of apt-get. There is nothing like "global" install in apt-get. Everything is installed globally. If you want to install the ruby-full package, just do
sudo apt-get install ruby-full
Another option is to install ruby via rvm.io or rbenv

Resources