无法使用opam安装ctypes

时间:2016-05-06 23:40:01

标签: ocaml opam

我希望在我的Ubuntu 14.04计算机上安装ctypes。我试图使用opam这样做,但它失败了。以下是我得到的回复: -

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.

我已经安装了依赖项,但仍然无法安装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

我想知道为什么我会遇到这些问题,我的系统上已经安装了ncurses-dev和pkg-config。

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"

错误文件中仍然没有文字。

感谢。

3 个答案:

答案 0 :(得分:1)

当您处理此类错误时,您可以通过查看opam指出的错误文件中的整个错误来获取更多详细信息,其中包括:

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

请注意,您还有经典输出:

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

您可能还有其他信息可以让您结束安装。有时在depext命令中会遗忘一些代表。

PS:我在这里写的是因为我没有足够的声誉来评论评论中的精确度

答案 1 :(得分:0)

尝试以下方法:

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

验证ncursespkg-config是否已安装并正常运行。

进一步诊断:

$ 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

请注意,libncurses5-dev已将其ncurses.pc文件安装在pkg-config默认搜索路径中的目录中。

如果您的系统不适用,请尝试明确设置$PKG_CONFIG_PATH以指向libncurses5-dev已安装ncurses.pc的位置。 (还要确认文件确实在那里!)

此讨论也可能有所帮助:https://askubuntu.com/questions/210210/pkg-config-path-environment-variable/373217

答案 2 :(得分:0)

如果我添加

,在我的系统中
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig/

然后执行

opam install conf-ncurses

它有效