3
votes

I wish to install ctypes on my Ubuntu 14.04 computer. I am trying to do so using opam but its failing. Here's the response that I get :-

opam install ctypes
The following actions will be performed:
  ∗  install conf-ncurses 1                   [required by ocamlfind]
  ∗  install ocamlfind    1.6.2               [required by ctypes]
  ∗  install base-bytes   base                [required by ctypes]
  ∗  install ctypes       0.5.1
===== ∗  4 =====
Do you want to continue ? [Y/n] Y

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

[ctypes] Archive in cache
[ocamlfind] Archive in cache

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of conf-ncurses failed at "pkg-config ncurses".

#=== ERROR while installing conf-ncurses.1 ====================================#
# opam-version 1.2.2
# os           linux
# command      pkg-config ncurses
# path         ~/.opam/4.02.1/build/conf-ncurses.1
# compiler     4.02.1
# exit-code    1
# env-file     ~/.opam/4.02.1/build/conf-ncurses.1/conf-ncurses-3089-ccabea.env
# stdout-file  ~/.opam/4.02.1/build/conf-ncurses.1/conf-ncurses-3089-ccabea.out
# stderr-file  ~/.opam/4.02.1/build/conf-ncurses.1/conf-ncurses-3089-ccabea.err



=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions were aborted
  ∗  install base-bytes base 
  ∗  install ctypes     0.5.1
  ∗  install ocamlfind  1.6.2
The following actions failed
  ∗  install conf-ncurses 1
No changes have been performed

=-=- conf-ncurses.1 troobleshooting -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=> This package relies on external (system) dependencies that may be missing. `opam depext conf-ncurses.1' may help you find the correct installation for your system.

I have already installed the dependencies but still I am unable to install ncurses.

~$ opam depext conf-ncurses.1
# Detecting depexts using flags: x86_64 linux ubuntu
# The following system packages are needed:
#  - ncurses-dev
#  - pkg-config
# The following new OS packages need to be installed: ncurses-dev
Not running as root, the following command will be run through "sudo":
    apt-get install -qq -yy ncurses-dev
[sudo] password for ask: 
# OS packages installation successful

I wonder why I am facing these issues, ncurses-dev and pkg-config is already installed on my system.

Update on performing suggestions by Tobias :-

# Detecting depexts using flags: x86_64 linux ubuntu
# The following system packages are needed:
#  - m4
#  - ncurses-dev
#  - pkg-config
# The following new OS packages need to be installed: ncurses-dev
Not running as root, the following command will be run through "sudo":
    apt-get install -qq -yy ncurses-dev
# OS packages installation successful
The following actions will be performed:
  ∗  install conf-pkg-config 1.0              [required by ctypes]
  ∗  install conf-m4         1                [required by ocamlfind]
  ∗  install conf-ncurses    1                [required by ocamlfind]
  ∗  install ocamlfind       1.6.2            [required by ctypes]
  ∗  install base-bytes      base             [required by ctypes]
  ∗  install ctypes          0.5.1
===== ∗  6 =====
Do you want to continue ? [Y/n] Y

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ctypes] Archive in cache
[ocamlfind] Archive in cache

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
∗  installed conf-pkg-config.1.0
∗  installed conf-m4.1
[ERROR] The compilation of conf-ncurses failed at "pkg-config ncurses".

#=== ERROR while installing conf-ncurses.1 ====================================#
# opam-version 1.2.2
# os           linux
# command      pkg-config ncurses
# path         ~/.opam/4.03.0/build/conf-ncurses.1
# compiler     4.03.0
# exit-code    1
# env-file     ~/.opam/4.03.0/build/conf-ncurses.1/conf-ncurses-10261-9b8556.env
# stdout-file  ~/.opam/4.03.0/build/conf-ncurses.1/conf-ncurses-10261-9b8556.out
# stderr-file  ~/.opam/4.03.0/build/conf-ncurses.1/conf-ncurses-10261-9b8556.err



=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions were aborted
  ∗  install base-bytes base 
  ∗  install ctypes     0.5.1
  ∗  install ocamlfind  1.6.2
The following actions failed
  ∗  install conf-ncurses 1
The following changes have been performed
  ∗  install conf-m4         1  
  ∗  install conf-pkg-config 1.0

=-=- conf-ncurses.1 troobleshooting -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=> This package relies on external (system) dependencies that may be missing.
   `opam depext conf-ncurses.1' may help you find the correct installation for
   your system.

The former state can be restored with:
    opam switch import "~/.opam/4.03.0/backup/state-20160410155208.export"

There's still no text in the error files.

Thanks.

3

3 Answers

1
votes

When you are dealing with such erros, you can get more detail by looking the whole errors in the error file pointed out by opam, which is here :

cat /home/ask/.opam/4.02.1/build/conf-ncurses.1/conf-ncurses-3089-ccabea.err

Please note that you also have classical output here :

cat /home/ask/.opam/4.02.1/build/conf-ncurses.1/conf-ncurses-3089-ccabea.out

You may have additional informations that will allow you to end your installation. Sometimes some deps are forgotten in the depext command.

PS : I write here because I don't have enough reputation to ask precision in comment

0
votes

try the following:

$ apt-get install libncurses5-dev
$ pkg-config --print-provides ncurses

to verify that both ncurses and pkg-config are installed and working correctly.

further diagnostics:

$ dpkg-query -L libncurses5-dev | grep pc$

# results for my machine
/usr/lib/x86_64-linux-gnu/pkgconfig/form.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/ncurses++.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/panel.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/ncurses.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/menu.pc

$ pkg-config --variable pc_path pkg-config

# results for my machine
/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig

note that libncurses5-dev has installed its ncurses.pc file in a directory that is in pkg-config's default search path.

If that is not true for your system, try setting $PKG_CONFIG_PATH explicitly to point to where libncurses5-dev has installed ncurses.pc. (Also check that the file actually is there!)

This discussion may be helpful too: https://askubuntu.com/questions/210210/pkg-config-path-environment-variable/373217

0
votes

In my system if I add

export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/

and then execute

opam install conf-ncurses

it works