dbuenzli / topkg

The transitory OCaml software packager
http://erratique.ch/software/topkg
ISC License
69 stars 25 forks source link

installation failure: Unbound module Topkg_result #110

Closed donpdonp closed 7 years ago

donpdonp commented 7 years ago

installation fails as follows, is this a problem with the topkg opam package, or something else?

$ ocaml -version 
The OCaml toplevel, version 4.02.3

$ opam install topkg
The following actions will be performed:
  ∗  install topkg 0.9.0

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[default] https://opam.ocaml.org/archives/topkg.0.9.0+opam.tar.gz downloaded

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of topkg failed at "ocaml pkg/pkg.ml build --pkg-name topkg --dev-pkg false".

#=== ERROR while installing topkg.0.9.0 =======================================#
# opam-version 1.2.2
# os           linux
# command      ocaml pkg/pkg.ml build --pkg-name topkg --dev-pkg false
# path         /home/donp/.opam/system/build/topkg.0.9.0
# compiler     system (4.02.3)
# exit-code    2
# env-file     /home/donp/.opam/system/build/topkg.0.9.0/topkg-4225-d2d111.env
# stdout-file  /home/donp/.opam/system/build/topkg.0.9.0/topkg-4225-d2d111.out
# stderr-file  /home/donp/.opam/system/build/topkg.0.9.0/topkg-4225-d2d111.err
### stdout ###
# [...]
# File "src/topkg_publish.ml", line 7, characters 5-17:
# Error: Unbound module Topkg_result
# File "src/topkg_pkg.ml", line 7, characters 5-17:
# Error: Unbound module Topkg_result
# File "src/topkg_ipc.ml", line 7, characters 5-17:
# Error: Unbound module Topkg_result
# File "src/topkg_main.ml", line 7, characters 5-17:
# Error: Unbound module Topkg_result
# File "src/topkg.ml", line 9, characters 8-20:
# Error: Unbound module Topkg_result
### stderr ###
# File "pkg/pkg.ml", line 29, characters 5-10:
# Error: Unbound module Topkg

=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions failed
  ∗  install topkg 0.9.0
No changes have been performed
dbuenzli commented 7 years ago

Could you please post the full build log ? This seems to be a system switch and I suspect a problem with ocamlfind in these lines https://github.com/dbuenzli/topkg/blob/master/pkg/pkg.ml#L1-L6

donpdonp commented 7 years ago

I'm new to ocaml/opam so i had to dig a bit. I'm not sure what a system switch is, but I initially attempted to install the 'reason' package which apparently wants topkg 0.8.1, while opam install topkg tries to install 0.9.0. I dont expect that is related but I thought I'd mention it. I'll look at the logs for 0.9.0. I hope these are the right files, they dont seem to have any new information.

topkg.0.8.1  topkg.0.9.0

build $ cd topkg.0.9.0 
donp@jewel topkg.0.9.0 $ ls -ltr
total 80
-rw-rw-r-- 1 donp donp  637 Mar 14 10:33 topkg.opam
-rw-rw-r-- 1 donp donp  738 Mar 14 10:33 topkg-care.opam
drwxrwxr-x 2 donp donp 4096 Mar 14 10:33 test
-rw-rw-r-- 1 donp donp  272 Mar 14 10:33 _tags
drwxrwxr-x 2 donp donp 4096 Mar 14 10:33 src-care
drwxrwxr-x 2 donp donp 4096 Mar 14 10:33 src-bin
-rw-rw-r-- 1 donp donp 2038 Mar 14 10:33 README.md
drwxrwxr-x 2 donp donp 4096 Mar 14 10:33 pkg
-rw-rw-r-- 1 donp donp  735 Mar 14 10:33 LICENSE.md
drwxrwxr-x 2 donp donp 4096 Mar 14 10:33 doc
-rw-rw-r-- 1 donp donp 1302 Mar 14 10:33 DEVEL.md
-rw-rw-r-- 1 donp donp 8744 Mar 14 10:33 CHANGES.md
drwxrwxr-x 2 donp donp 4096 Mar 15 07:17 src
-rw-rw-r-- 1 donp donp  566 Apr 25 08:32 topkg-9816-6d07ae.info
-rw-rw-r-- 1 donp donp 4799 Apr 25 08:32 topkg-9816-6d07ae.env
-rw-r--r-- 1 donp donp 1543 Apr 25 08:32 topkg-9816-6d07ae.out
-rw-r--r-- 1 donp donp   73 Apr 25 08:32 topkg-9816-6d07ae.err

donp@jewel topkg.0.9.0 $ cat topkg-9816-6d07ae.out 
No such package: result
File "src/topkg_result.ml", line 7, characters 5-11:
Error: Unbound module Result
File "src/topkg_log.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_os.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_vcs.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_conf.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_fexts.ml", line 22, characters 16-40:
Error: Unbound module Topkg_conf
Hint: Did you mean Topkg_cmd?
File "src/topkg_codec.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_opam.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_test.ml", line 23, characters 2-13:
Error: Unbound module Topkg_codec
Hint: Did you mean Topkg_cmd?
File "src/topkg_install.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_build.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_distrib.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_publish.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_pkg.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_ipc.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg_main.ml", line 7, characters 5-17:
Error: Unbound module Topkg_result
File "src/topkg.ml", line 9, characters 8-20:
Error: Unbound module Topkg_result
donp@jewel topkg.0.9.0 $ cat topkg-9816-6d07ae.err
File "pkg/pkg.ml", line 29, characters 5-10:
Error: Unbound module Topkg
donp@jewel topkg.0.9.0 $ 
dbuenzli commented 7 years ago

donp@jewel topkg.0.9.0 $ cat topkg-9816-6d07ae.out No such package: result

Well this is odd since topkg has result as a dependency, so it should be installed. What do

> ocamlfind list | grep result 
> opam list -i | grep result 

report ?

dbuenzli commented 7 years ago

Also please could you tell me what is the result of

> type ocamlfind
donpdonp commented 7 years ago

okay here it is. i added the output from the ubuntu package version for ocamlfind as well.

donp@jewel ~ $ ocamlfind list | grep result
donp@jewel ~ $ opam list -i | grep result
result                          1.2  Compatibility Result module
donp@jewel ~ $ type ocamlfind
ocamlfind is /usr/bin/ocamlfind

donp@jewel ~ $ dpkg -S ocamlfind
ocaml-findlib: /usr/bin/ocamlfind
ocaml-findlib: /usr/share/man/man1/ocamlfind.1.gz
libfindlib-ocaml: /etc/ocamlfind.conf
ocaml-findlib: /etc/bash_completion.d/ocamlfind

donp@jewel ~ $ dpkg -l ocaml-findlib 
ii  ocaml-findlib            1.5.5-2build1     amd64             management tool for OCaml libraries
dbuenzli commented 7 years ago

Ok so the problem seems to be that the system ocamlfind does not see the installs made by opam, I'm no longer sure whether this is supposed to work or not. But I suspect that's not a supported configuration.

So is ocamfind actually installed in your switch ? (opam list -i | grep ocamlfind) ? If that is the case and that it's not being picked up you are maybe simple missing an eval $(opam config env) in your shell before invoking opam. Otherwise you should try to install it in your switch so that it overrides the system one (and make sure you have that eval ... invocation in your shell).

Note that in general system switches are less used and tested and more brittle. The experience is better when the whole environment is in control of opam. So if the above doesn't work I'd suggest to simply create a non-system switch (e.g. opam switch 4.03.0 && eval $(opam config env) && opam install reason).

dbuenzli commented 7 years ago

I'm closing this since this doesn't seem to be a topkg problem per se. Please tell me if you managed to solve the problem or if you need further help.