Gentlefolk,
Thank you for your patience and persistence. The problem appears to be that the gcc compiler cannot compile a test file during the OPAN-Ocaml install.
My test/install process is:
New Mint18.2 install, all updates applied.
iru@ian-HP ~ $ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
// Update gcc to version 6
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60
// From the OPAM install instructions
// wget ://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin
// Results (edited)
// Location: ://raw.githubusercontent.com/ocaml/opam/master/shell/opam_installer.sh [following]
…
…
Downloading opam…
You don’t have write access to /usr/local/bin: sudo may ask for your password
Initializing with compiler 4.05.0
Checking for available remotes: rsync and local.
…
…
[WARNING] Recommended external solver aspcud not found.
=-=- Fetching repository information =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[default] synchronized from https://opam.ocaml.org
=-=- Installing compiler 4.05.0 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[compiler.get] https://github.com/ocaml/ocaml/archive/4.05.0.tar.gz downloaded
Now compiling OCaml. This may take a while, please bear with us…
[ERROR] Compiler build failed at “./configure -prefix /home/iru/.opam/4.05.0
-with-debug-runtime”:
# opam-version 1.2.2
# os linux
# command ./configure -prefix /home/iru/.opam/4.05.0
-with-debug-runtime
# path /home/iru/.opam/4.05.0/build/ocaml
# exit-code 2
# env-file /home/iru/.opam/log/log-20385-cc66ff.env
# stdout-file /home/iru/.opam/log/log-20385-cc66ff.out
# stderr-file /home/iru/.opam/log/log-20385-cc66ff.err
### stdout ###
# Configuring OCaml version 4.05.0
# Configuring for host x86_64-unknown-linux-gnu …
# Configuring for target x86_64-unknown-linux-gnu …
# Using compiler gcc.
# Compiler family and version: gcc-6-3.
# [ERROR!] Unable to compile the test program.
# Make sure the C compiler gcc is properly installed.
[ERROR] Initialisation failed
OpamGlobals.Exit(66)
// Notes:
On a previous attempt to install OPAM it failed with the same error but specified the gcc-5.4 compiler. I performed a clean install and updated gcc in an attempt to overcome that issue.
So this is how I wind up with OPAM installed but no Ocaml.
Looking at the script (with some added ‘echos’ to trace things):
// ://raw.githubusercontent.com/ocaml/opam/master/shell/opam_installer.sh
The problem occurs in the following.
if [ “$(id -u)” = “0” ]; then
echo "Running as super-user: not running opam initialization.“
echo “You’ll want to run “$OPAM init --comp $COMP” as user"
else
echo “Initializing with compiler $COMP”
”$OPAM” init --comp “$COMP”
I will try and get into the following files and see what is the problem/s.
env-file /home/iru/.opam/log/log-20385-cc66ff.env
# stdout-file /home/iru/.opam/log/log-20385-cc66ff.out
# stderr-file /home/iru/.opam/log/log-20385-cc66ff.err