I have had no problem installing any OCaml packages via opam in the past. However I am unable to install Cryptokit.
I am using the command:
$ opam install cryptokit
and I recieve the following error messages (I am unsure what they mean and cannot find any documentation on the errors):
[ERROR] The compilation of cryptokit.1.9 failed.
Removing cryptokit.1.9.
ocamlfind remove cryptokit
===== ERROR while installing cryptokit.1.9 =====
# opam-version 1.1.0
# os linux
# command make
# path /home/alpha/.opam/system/build/cryptokit.1.9
# compiler system (4.01.0)
# exit-code 2
# env-file /home/alpha/.opam/system/build/cryptokit.1.9/cryptokit-9111-ffb3fd.env
# stdout-file /home/alpha/.opam/system/build/cryptokit.1.9/cryptokit-9111-ffb3fd.out
# stderr-file /home/alpha/.opam/system/build/cryptokit.1.9/cryptokit-9111-ffb3fd.err
### stdout ###
# ...[truncated]
# mv stubs-md5.o src/stubs-md5.o
# ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-misc.c
# mv stubs-misc.o src/stubs-misc.o
# ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-rng.c
# mv stubs-rng.o src/stubs-rng.o
# ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-zlib.c
# + ocamlfind ocamlc -ccopt -O -ccopt -DHAVE_ZLIB -c src/stubs-zlib.c
# src/stubs-zlib.c:19:18: fatal error: zlib.h: No such file or directory
# compilation terminated.
# Command exited with code 2.
### stderr ###
# E: Failure("Command ''/usr/bin/ocamlbuild' src/libcryptokit_stubs.a src/dllcryptokit_stubs.so src/cryptokit.cma src/cryptokit.cmxa src/cryptokit.a src/cryptokit.cmxs -tag debug -classic-display' terminated with error code 10")
# make: *** [build] Error 1
'opam install cryptokit' failed.
# src/stubs-zlib.c:19:18: fatal error: zlib.h: No such file or directory
OPAM does not install non OCaml external libraries automatically. It is out of the scope of this tool. Cryptokit depends on several external libraries and zlib is one of them.
You must install zlib and its header files (and those of other libraries) by your distribution's package manager or by hand. In many distributions it should be provided by the name of zlib-dev or something similar.
In Ubuntu:
sudo apt-get install zlib1g zlib1g-dev
[This should be a comment for the response above.]
Related
I have an error installing utop in fedora 25 when I run "opam install utop". The first time I ran the command some packages were installed, but not all. I ran the same command again and got the error message below. Any suggestion?
The following actions will be performed:
- install lambda-term 1.12.0 [required by utop]
- install utop 2.0.2
===== 2 to install =====
Do you want to continue ? [Y/n] y
=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[lambda-term] Archive in cache
[utop] Archive in cache
=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of lambda-term failed at "jbuilder build -p lambda-term
-j 4".
#=== ERROR while installing lambda-term.1.12.0 ================================#
# opam-version 1.2.2
# os linux
# command jbuilder build -p lambda-term -j 4
# path /home/se/.opam/4.05.0/build/lambda-term.1.12.0
# compiler 4.05.0
# exit-code 1
# env-file /home/se/.opam/4.05.0/build/lambda-term.1.12.0/lambda-term-1999-58c514.env
# stdout-file /home/se/.opam/4.05.0/build/lambda-term.1.12.0/lambda-term-1999-58c514.out
# stderr-file /home/se/.opam/4.05.0/build/lambda-term.1.12.0/lambda-term-1999-58c514.err
### stderr ###
# Warning 3: deprecated: module Lwt_sequence
# [...]
# File "src/lTerm_widget_callbacks.ml", line 48, characters 2-21:
# Warning 3: deprecated: module Lwt_sequence
# This module is an implementation detail of Lwt. See
# https://github.com/ocsigen/lwt/issues/361
# ocamlc src/lTerm_unix.{cmo,cmt} (exit 2)
# (cd _build/default && /home/se/.opam/4.05.0/bin/ocamlc.opt -w -40 -safe-string -g -bin-annot -I /home/se/.opam/4.05.0/lib/bytes -I /home/se/.opam/4.05.0/lib/camomile -I /home/se/.opam/4.05.0/lib/lwt -I /home/se/.opam/4.05.0/lib/lwt_react -I /home/se/.opam/4.05.0/lib/ocaml -I /home/se/.opam/4.05.0/lib/ocaml/threads -I /home/se/.opam/4.05.0/lib/react -I /home/se/.opam/4.05.0/lib/result -I /home/se/.opam/4.05.0/lib/zed -no-alias-deps -I src -o src/lTerm_unix.cmo -c -impl src/lTerm_unix.ml)
# File "src/lTerm_unix.ml", line 342, characters 32-51:
# Error: This expression has type bytes but an expression was expected of type
# string
=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions were aborted
- install utop 2.0.2
The following actions failed
- install lambda-term 1.12.0
No changes have been performed
Problem fixed:
opam update
opam upgrade
and possibly
opam reinstall [whatever-was-not-installed-correctly]
I currently have Fedora 26 installed, and I have installed the following packages:
sudo dnf install opam ocaml gcc gcc-c++ m4 make ocamldoc sqlite-devel libcurl-devel fuse-devel zlib-devel ocaml-camlp4-devel redhat-rpm-config
This is the error I currently get trying to install utop:
#=== ERROR while installing lwt.2.7.1 =========================================#
# opam-version 1.2.2
# os linux
# command make build
# path /home/z/.opam/system/build/lwt.2.7.1
# compiler system (4.02.3)
# exit-code 2
# env-file /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.env
# stdout-file /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.out
# stderr-file /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.err
### stdout ###
# ./setup.exe -build
# ocamlfind ocamlopt -package unix -package ocamlbuild -linkpkg -package cppo_ocamlbuild myocamlbuild.ml /usr/lib64/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# + ocamlfind ocamlopt -package unix -package ocamlbuild -linkpkg -package cppo_ocamlbuild myocamlbuild.ml /usr/lib64/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# File "myocamlbuild.ml", line 1:
# Error: Files /home/z/.opam/system/lib/cppo_ocamlbuild/ocamlbuild_cppo.cmxa
# and /usr/lib64/ocaml/ocamlbuild/ocamlbuildlib.cmxa
# make inconsistent assumptions over implementation Ocamlbuild_plugin
# Command exited with code 2.
# Makefile:33: recipe for target 'build' failed
### stderr ###
# W: Cannot find source file matching module 'Lwt_unix' in library lwt-unix.
# W: Use InterfacePatterns or ImplementationPatterns to define this file with feature "source_patterns".
# W: Cannot find source file matching module 'Lwt_unix' in library lwt-unix.
# W: Use InterfacePatterns or ImplementationPatterns to define this file with feature "source_patterns".
# E: Failure("Command ''/usr/bin/ocamlbuild' src/core/lwt.cma src/core/lwt.cmxa src/core/lwt.a src/core/lwt.cmxs src/logger/lwt-log.cma src/logger/lwt-log.cmxa src/logg$r/lwt-log.a src/logger/lwt-log.cmxs src/unix/liblwt-unix_stubs.a src/unix/dlllwt-unix_stubs.so src/unix/lwt-unix.cma src/unix/lwt-unix.cmxa src/unix/lwt-unix.a src/unix$lwt-unix.cmxs src/simple_top/lwt-simple-top.cma src/simple_top/lwt-simple-top.cmxa src/simple_top/lwt-simple-top.a src/simple_top/lwt-simple-top.cmxs src/react/lwt-reac$.cma src/react/lwt-react.cmxa src/react/lwt-react.a src/react/lwt-react.cmxs src/preemptive/lwt-preemptive.cma src/preemptive/lwt-preemptive.cmxa src/preemptive/lwt-pre$mptive.a src/preemptive/lwt-preemptive.cmxs src/ppx/ppx.cma src/ppx/ppx.cmxa src/ppx/ppx.a src/ppx/ppx.cmxs src/ppx/ppx_lwt_ex.native doc/examples/unix/logging.native d$c/examples/unix/relay.native doc/examples/unix/parallelize.native -use-ocamlfind -plugin-tags 'package(cppo_ocamlbuild)' -tag debug' terminated with error code 10")
# make: *** [build] Error 1
What should I do?
Thank you!
Opam's "system compiler", that is used by default on opam init, is an hybrid setting in which the packages are installed in the local opam sandbox, but the compiler from the system (/usr) is used. See the opam switch command to use a sandbox with a compiler compiled by opam instead, or to switch back.
Your example shows that you are using a system compiler, as provided by dnf install ocaml ; opam is consequently supposed to use e.g. /usr/bin/ocamlopt, but installed software and libs from ~/.opam/system/{bin,lib}.
What is supposed to happen is that lwt depends on ocamlbuild and ocamlfind, which opam installs first; then PATH is set so that ~/.opam/system/bin/ is first and these installed binaries are always chosen. It's where something must be going wrong, because the end of the log shows that /usr/bin/ocamlbuild was called.
It's difficult to know what without more details, and I failed to reproduce on a Fedora 25 container. But you could:
check if ocamlbuild and ocamlfind were properly installed by opam, and the presence of ~/.opam/system/bin/ocaml{find,build}
check if there is any global or environment configuration of ocamlfind that could interfere (which ocamlfind; ocamlfind printconf; opam config exec -- ocamlfind printconf).
check the linked environment file: /home/z/.opam/system/build/lwt.2.7.1/lwt-21869-a00279.env to see if PATH is properly defined
run with -v to see all commands issued by opam
Of course, as mentionned in the comments above, using a standard (i.e. non-system) switch, which includes its own OCaml compiler, would work around the issue. It takes a tad longer to compile though.
I'm tyring to install cohttp with opam and I get an error regarding modular-implicits
Here is the stack trace for camlp4
chris#chris-870Z5E-880Z5E-680Z5E:~$ opam install camlp4
The following actions will be performed:
∗ install camlp4 4.02.0-1modular-implicits
=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[camlp4] Archive in cache
=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of camlp4 failed at "make all".
Processing 1/1: [camlp4: rm]
#=== ERROR while installing camlp4.4.02.0-1modular-implicits ==================#
# opam-version 1.2.2
# os linux
# command make all
# path /home/chris/.opam/core/build/camlp4.4.02.0-1modular-implicits
# compiler system (4.02.3)
# exit-code 2
# env-file /home/chris/.opam/core/build/camlp4.4.02.0-1modular-implicits/camlp4-12430-e7966f.env
# stdout-file /home/chris/.opam/core/build/camlp4.4.02.0-1modular-implicits/camlp4-12430-e7966f.out
# stderr-file /home/chris/.opam/core/build/camlp4.4.02.0-1modular-implicits/camlp4-12430-e7966f.err
### stdout ###
# [...]
# cp /usr/lib/ocaml/compiler-libs/parsetree.cmi camlp4/import/parsetree.cmi
# cp /usr/lib/ocaml/compiler-libs/outcometree.cmi camlp4/import/outcometree.cmi
# cp /usr/lib/ocaml/compiler-libs/oprint.cmi camlp4/import/oprint.cmi
# cp /usr/lib/ocaml/compiler-libs/toploop.cmi camlp4/import/toploop.cmi
# /usr/bin/ocamlc.opt -c -g -w Z -I camlp4/import -warn-error A-3 -I camlp4/config -I camlp4 -o camlp4/config/Camlp4_config.cmi camlp4/config/Camlp4_config.mli
# /usr/bin/ocamlc.opt -c -g -w a -I camlp4/import -warn-error A-3 -I camlp4/config -I camlp4/boot -o camlp4/boot/Camlp4.cmo camlp4/boot/Camlp4.ml
# + /usr/bin/ocamlc.opt -c -g -w a -I camlp4/import -warn-error A-3 -I camlp4/config -I camlp4/boot -o camlp4/boot/Camlp4.cmo camlp4/boot/Camlp4.ml
# File "camlp4/boot/Camlp4.ml", line 14607, characters 36-58:
# Error: Unbound type constructor Asttypes.implicit_flag
# Command exited with code 2.
### stderr ###
# + echo camlp4/Camlp4.cmo camlp4/Camlp4Top.cmo camlp4/camlp4prof.byte camlp4/mkcamlp4.byte camlp4/camlp4.byte camlp4/camlp4fulllib.cma camlp4/camlp4boot.byte camlp4/camlp4boot.cma camlp4/camlp4r.byte camlp4/camlp4r.cma camlp4/camlp4rf.byte camlp4/camlp4rf.cma camlp4/camlp4o.byte camlp4/camlp4o.cma camlp4/camlp4of.byte camlp4/camlp4of.cma camlp4/camlp4oof.byte camlp4/camlp4oof.cma camlp4/camlp4orf.byte camlp4/camlp4orf.cma camlp4/Camlp4Parsers/Camlp4AstLoader.cmo camlp4/Camlp4Parsers/Camlp4DebugParser.cmo camlp4/Camlp4Parsers/Camlp4GrammarParser.cmo camlp4/Camlp4Parsers/Camlp4ListComprehension.cmo camlp4/Camlp4Parsers/Camlp4MacroParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlOriginalQuotationExpander.cmo camlp4/Camlp4Parsers/Camlp4OCamlParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlParserParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlReloadedParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlRevisedParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlRevisedParserParser.cmo camlp4/Camlp4Parsers/Camlp4OCamlRevisedQuotationExpander.cmo camlp4/Camlp4Parsers/Camlp4QuotationCommon.cmo camlp4/Camlp4Parsers/Camlp4QuotationExpander.cmo camlp4/Camlp4Printers/Camlp4AstDumper.cmo camlp4/Camlp4Printers/Camlp4AutoPrinter.cmo camlp4/Camlp4Printers/Camlp4NullDumper.cmo camlp4/Camlp4Printers/Camlp4OCamlAstDumper.cmo camlp4/Camlp4Printers/Camlp4OCamlPrinter.cmo camlp4/Camlp4Printers/Camlp4OCamlRevisedPrinter.cmo camlp4/Camlp4Filters/Camlp4AstLifter.cmo camlp4/Camlp4Filters/Camlp4ExceptionTracer.cmo camlp4/Camlp4Filters/Camlp4FoldGenerator.cmo camlp4/Camlp4Filters/Camlp4LocationStripper.cmo camlp4/Camlp4Filters/Camlp4MapGenerator.cmo camlp4/Camlp4Filters/Camlp4MetaGenerator.cmo camlp4/Camlp4Filters/Camlp4Profiler.cmo camlp4/Camlp4Filters/Camlp4TrashRemover.cmo
# make: *** [byte] Error 10
=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions failed
∗ install camlp4 4.02.0-1modular-implicits
No changes have been performed
This is happening on Ubuntu 14.04, how can I get around this strange error that is happening?
EDIT: Relevant info
chris#chris-870Z5E-880Z5E-680Z5E:~$ ocaml -version
The OCaml toplevel, version 4.02.3
chris#chris-870Z5E-880Z5E-680Z5E:~$ opam --version
1.2.2
I would propose to have your ocaml compiler installed by opam (
opam switch 4.02.3
). It looks your ocaml is located in your system.
Apparently, this comes to an older revision of opam database : opam update may solve it.
I have an opam file with the line:
install: [make "install" "prefix=${prefix}$"]
my intent is that something like the following (which I have tested) will be executed by opam install:
make install prefix=/home/laheadle/.opam/4.02.0
In the Makefile I have:
install: js
cp ./tournabox.css ./tournabox.js $(prefix)/lib
But I get the error:
#=== ERROR while installing tournabox.1.0 =====================================#
# opam-version 1.2.0
# os linux
# command make install prefix=${prefix}$
# path /home/laheadle/.opam/4.02.0/build/tournabox.1.0
# compiler 4.02.0
# exit-code 2
# env-file /home/laheadle/.opam/4.02.0/build/tournabox.1.0/tournabox-7593-d2c37b.env
# stdout-file /home/laheadle/.opam/4.02.0/build/tournabox.1.0/tournabox-7593-d2c37b.out
# stderr-file /home/laheadle/.opam/4.02.0/build/tournabox.1.0/tournabox-7593-d2c37b.err
### stdout ###
# ocamlbuild -cflag -annot -use-ocamlfind -pkgs js_of_ocaml.log,js_of_ocaml,js_of_ocaml.syntax -syntax camlp4o tournabox.byte
# js_of_ocaml +weak.js tournabox.byte
# lessc tournabox.less tournabox.css
# ocamlbuild -cflag -annot -use-ocamlfind -pkgs js_of_ocaml.log,js_of_ocaml,js_of_ocaml.syntax -syntax camlp4o tournabox.byte
### stderr ###
# make: *** Recursive variable `prefix' references itself (eventually). Stop.
What am I doing wrong?
OPAM uses %{prefix}%, not ${prefix}$.
You can see the use of prefix in Creating OPAM Packages part of the docs.
This error msg seems printed by make:
‘Recursive variable `xxx' references itself (eventually). Stop.’
This means you’ve defined a normal (recursive) make variable xxx that, when it’s expanded, will refer to itself (xxx). This is not allowed; either use simply-expanded variables (‘:=’ or ‘::=’) or use the append operator (‘+=’). See How to Use Variables.
https://www.gnu.org/software/make/manual/html_node/Error-Messages.html
I receive the following error while trying to install core with opam.
==== ERROR [while installing core.109.42.00] ====
# opam-version 1.0.0
# os linux
# command make
# path /home/cesally/.opam/4.01.0/build/core.109.42.00
# exit-code 2
# env-file /home/cesally/.opam/4.01.0/build/core.109.42.00/core-5f1023.env
# stdout-file /home/cesally/.opam/4.01.0/build/core.109.42.00/core-5f1023.out
# stderr-file /home/cesally/.opam/4.01.0/build/core.109.42.00/core-5f1023.err
### stdout ###
...[truncated]
/home/cesally/.opam/4.01.0/bin/ocamlopt.opt unix.cmxa -I /home/cesally/.opam/4.01.0/ lib/ocaml/ocamlbuild /home/cesally/.opam/4.01.0/lib/ocaml/ocamlbuild/ocamlbuildlib .cmxa myocamlbuild.ml /home/cesally/.opam/4.01.0/lib/ocaml/ocamlbuild/ocamlbuild.c mx -o myocamlbuild
ocamlfind ocamlc -I lib -package core_kernel -c lib/backtrace_stubs.c
mv backtrace_stubs.o lib/backtrace_stubs.o
ocamlfind ocamlc -I lib -package core_kernel -c lib/bigstring_stubs.c
+ ocamlfind ocamlc -I lib -package core_kernel -c lib/bigstring_stubs.c
lib/bigstring_stubs.c: In function ‘bigstring_recvmmsg_assume_fd_is_nonblocking_ stub’:
lib/bigstring_stubs.c:592:18: error: array type has incomplete element type
lib/bigstring_stubs.c:639:7: warning: implicit declaration of function ‘recvmmsg ’ [-Wimplicit-function-declaration]
lib/bigstring_stubs.c:592:18: warning: unused variable ‘hdrs’ [-Wunused-variable ]
Command exited with code 2.
### stderr ###
/tmp/cc5m08R9.o: In function `main':
test_recvmmsg.c:(.text+0x24): warning: recvmmsg is not implemented and will alwa ys fail
E: Failure("Command ''/home/cesally/.opam/4.01.0/bin/ocamlbuild' lib/libcore_stubs .a lib/dllcore_stubs.so lib/core.cma lib/core.cmxa lib/core.a lib/core.cmxs top/ core_top.cma top/core_top.cmxa top/core_top.a top/core_top.cmxs -tag debug' term inated with error code 10")
make: *** [build] Error 1
'opam install core' failed.
I can't quite understand this error message, can any ocaml hackers shed some light?
I am on ubuntu, without admin rights. Thanks
Edit: g++ version is 4.6.3
Looks like the core configure script and the C compiler are in disagreement on whether recvmmsg is available on your system. I guess it is a bug in core. First, try the latest version (at time of this writing it is 110.something), and if it is not fixed yet report it to core authors.