yallop / ocaml-ctypes

Library for binding to C libraries using pure OCaml
MIT License
363 stars 95 forks source link

ctypes.0.17.1 doesn't install #647

Closed UnixJunkie closed 4 years ago

UnixJunkie commented 4 years ago
# opam --version
2.0.7
# opam switch
#  switch  compiler                    description
→  4.08.1  ocaml-base-compiler.4.08.1  4.08.1
# opam install ctypes
The following actions will be performed:
  ∗ install ctypes 0.17.1

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ctypes.0.17.1] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of ctypes failed at
        "/home/fbr/.opam/opam-init/hooks/sandbox.sh build make XEN=disable
        ctypes-foreign".

#=== ERROR while compiling ctypes.0.17.1 ======================================#
# context     2.0.7 | linux/x86_64 | ocaml-base-compiler.4.08.1 | git+https://github.com/ocaml/opam-repository.git
# path        ~/.opam/4.08.1/.opam-switch/build/ctypes.0.17.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build make XEN=disable ctypes-foreign
# exit-code   2
# env-file    ~/.opam/log/ctypes-15049-e7966f.env
# output-file ~/.opam/log/ctypes-15049-e7966f.out
### output ###
# The following required C libraries are missing: libffi.
# Please install them and retry. If they are installed in a non-standard location
# or need special flags, set the environment variables <LIB>_CFLAGS and <LIB>_LIBS
# accordingly and retry.
# 
#  For example, if libffi is installed in /opt/local, you can type:
# 
#    export LIBFFI_CFLAGS=-I/opt/local/include
#    export LIBFFI_LIBS="-L/opt/local/lib -lffi"
# Makefile:217: recipe for target 'test-libffi' failed
# make: *** [test-libffi] Error 1

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build ctypes 0.17.1
└─ 
╶─ No changes have been performed
UnixJunkie commented 4 years ago

libffi-dev is needed to be installed system-wide. The opam package doesn't say anything about this.

yallop commented 4 years ago

Do you have ctypes-foreign installed?

It should be possible to install ctypes without libffi, but the combination of ctypes-foreign and ctypes requires libffi.

UnixJunkie commented 4 years ago

Yes I have ctypes-foreign. Though, I never installed it explicitly. It probably came as a dependency of some other package.

yallop commented 4 years ago

In that case the options are:

  1. remove ctypes-foreign
  2. install libffi
UnixJunkie commented 4 years ago

Is it ctypes-foreign that should trigger the install of libffi-dev?

yallop commented 4 years ago

Yes: opam depext ctypes-foreign should install libffi on your system.