Hello,
TL;DR: is it possible to pass CFLAGS to opam install
?
(There already are several threads about $CFLAGS but I still can’t make it work - sorry for asking this again).
Long story:
I’d like to checkout Bogue, which requires ctypes-foreign
.
But opam install -y ctypes-foreign
fails with the following message:
ffi.h: No such file or directory
File "src/ctypes-foreign/dune", line 25, characters 33-47:
25 | (names dl_stubs ffi_call_stubs ffi_type_stubs foreign_threaded_stubs)
^^^^^^^^^^^^^^
(cd _build/default/src/ctypes-foreign && /bin/musl-gcc -O2 -fno-strict-aliasing -fwrapv -fPIC -pthread -D_FILE_OFFSET_BITS=64 -fdiagnostics-color=always -g -I /home/void/.opam/5.3.0+static/lib/ocaml -I /home/void/.opam/5.3.0+static/lib/bigarray-compat -I /home/void/.opam/5.3.0+static/lib/ctypes -I /home/void/.opam/5.3.0+static/lib/integers -I /home/void/.opam/5.3.0+static/lib/ocaml/threads -I /home/void/.opam/5.3.0+static/lib/ocaml/unix -I /home/void/.opam/5.3.0+static/lib/stdlib-shims -o ffi_type_stubs.o -c ffi_type_stubs.c)
ffi_type_stubs.c:14:10: fatal error: ffi.h: No such file or directory
14 | #include <ffi.h>
| ^~~~~~~
compilation terminated.
File "src/ctypes-foreign/dune", line 25, characters 18-32:
25 | (names dl_stubs ffi_call_stubs ffi_type_stubs foreign_threaded_stubs)
^^^^^^^^^^^^^^
(cd _build/default/src/ctypes-foreign && /bin/musl-gcc -O2 -fno-strict-aliasing -fwrapv -fPIC -pthread -D_FILE_OFFSET_BITS=64 -fdiagnostics-color=always -g -I /home/void/.opam/5.3.0+static/lib/ocaml -I /home/void/.opam/5.3.0+static/lib/bigarray-compat -I /home/void/.opam/5.3.0+static/lib/ctypes -I /home/void/.opam/5.3.0+static/lib/integers -I /home/void/.opam/5.3.0+static/lib/ocaml/threads -I /home/void/.opam/5.3.0+static/lib/ocaml/unix -I /home/void/.opam/5.3.0+static/lib/stdlib-shims -o ffi_call_stubs.o -c ffi_call_stubs.c)
ffi_call_stubs.c:22:10: fatal error: ffi.h: No such file or directory
22 | #include <ffi.h>
| ^~~~~~~
compilation terminated.
However, ffi.h
is available in /usr/include
.
The above error messages seems to indicate the C compiler isn’t looking in /usr/include
(because there is no -I /usr/include
).
my attempts:
CFLAGS=-I/usr/include opam install -y ctypes-foreign
still doesn’t include /usr/include
. The flag is ignored.
opam option setenv+='CLFAGS="-I/usr/include"'
doesn’t include /usr/include
either. The flag is ignored too.
opam install --help
doesn’t list any environment variables I could use for including the directory.
debug info
Summary
$ opam var
<><> Global opam variables ><><><><><><><><><><><><><><><><><><><><><><><><><><>
arch x86_64 # Inferred from system
exe # Suffix needed for executable filenames (Windows)
jobs 7 # The number of parallel jobs set up in opam configuration
make make # The 'make' command to use
opam-version 2.3.0 # The currently running opam version
os linux # Inferred from system
os-distribution void # Inferred from system
os-family void # Inferred from system
os-version rolling # Inferred from system
root /home/void/.opam # The current opam root directory
switch 5.3.0+static # The identifier of the current switch
sys-ocaml-arch x86_64 # Target architecture of the OCaml compiler present on your
system
sys-ocaml-cc cc # Host C Compiler type of the OCaml compiler present on your
system
sys-ocaml-libc libc # Host C Runtime Library type of the OCaml compiler present on
your system
sys-ocaml-system linux # Target system of the OCaml compiler present on your system
sys-ocaml-version 5.3.0 # OCaml version present on your system independently of opam,
if any
<><> Configuration variables from the current switch ><><><><><><><><><><><><><>
prefix /home/void/.opam/5.3.0+static
lib /home/void/.opam/5.3.0+static/lib
bin /home/void/.opam/5.3.0+static/bin
sbin /home/void/.opam/5.3.0+static/sbin
share /home/void/.opam/5.3.0+static/share
doc /home/void/.opam/5.3.0+static/doc
etc /home/void/.opam/5.3.0+static/etc
man /home/void/.opam/5.3.0+static/man
toplevel /home/void/.opam/5.3.0+static/lib/toplevel
stublibs /home/void/.opam/5.3.0+static/lib/stublibs
user void
group void
Is there anything else I could try to successfully install ctypes-foreign
?