kubo39's blog

ただの雑記です。

opamでnumのインストールに失敗してcoqが入らなかったのでocamlfind removeで解決した

opamでcoqをインストールしようとすると以下のようなエラーになった。

$ opam --version
2.0.5
$ opam list
# Packages matching: installed
# Name              # Installed # Synopsis
base-bigarray       base
base-threads        base
base-unix           base
camlp5              7.10        Preprocessor-pretty-printer of OCaml
conf-findutils      1           Virtual package relying on findutils
conf-m4             1           Virtual package relying on m4
ocaml               4.07.0      The OCaml compiler (virtual package)
ocaml-base-compiler 4.07.0      Official release 4.07.0
ocaml-config        1           OCaml Switch Configuration
ocamlfind           1.8.1       A library manager for OCaml
$ opam install coq                                                                                                                                              
The following actions will be performed:                                                                                                                                    
  ∗ install num 1.3     [required by coq]                                                                                                                                   
  ∗ install coq 8.10.1*                                                                                                                                                     
===== ∗ 2 =====                                                                                                                                                             
Do you want to continue? [Y/n] y                                                                                                                                            
                                                                                                                                                                            
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>                                                                                            
[coq.8.10.1] found in cache                                                                                                                                                 
[num.1.3] found in cache                                                                                                                                                    
                                                                                                                                                                            
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>                                                                                            
[ERROR] The installation of num failed at "make install".                                                                                                                   
                                                                                                                                                                            
#=== ERROR while installing num.1.3 ===========================================#                                                                                            
# context     2.0.5 | linux/x86_64 | base-bigarray.base base-threads.base base-unix.base ocaml-base-compiler.4.07.0 | https://opam.ocaml.org/#662359aa                      
# path        ~/.opam/4.07.0/.opam-switch/build/num.1.3                                                                                                                     
# command     ~/.opam/opam-init/hooks/sandbox.sh install make install                                                                                                       
# exit-code   2                                                                                                                                                             
# env-file    ~/.opam/log/num-16298-0a5907.env                                                                                                                              
# output-file ~/.opam/log/num-16298-0a5907.out                                                                                                                              
### output ###                                                                                                                                                              
# [...]                                                                                                                                                                     
# make[1]: ディレクトリ '/home/kubo39/.opam/4.07.0/.opam-switch/build/num.1.3/src' から出ます                                                                               
# make -C toplevel install                                                                                                                                                  
# make[1]: ディレクトリ '/home/kubo39/.opam/4.07.0/.opam-switch/build/num.1.3/toplevel' に入ります                                                                          
# sed -e 's/%%VERSION%%/1.3/g' META.in > META                                                                                                                               
# ocamlfind install num-top META num_top.cma num_top.cmi num_top_printers.cmi                                                                                               
# ocamlfind: Package num-top is already installed                                                                                                                           
#  - (file /home/kubo39/.opam/4.07.0/lib/num-top/META already exists)                                                                                                       
# Makefile:27: recipe for target 'install' failed                                                                                                                           
# make[1]: *** [install] Error 2                                                                                                                                            
# make[1]: ディレクトリ '/home/kubo39/.opam/4.07.0/.opam-switch/build/num.1.3/toplevel' から出ます                                                                          
# Makefile:14: recipe for target 'install' failed                                                                                                                           
# make: *** [install] Error 2                                                                                                                                               
                                                                                                                                                                            
                                                                                                                                                                            
                                                                                                                                                                            
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>                                                                                            
┌─ The following actions failed                                                                                                                                             
│ ∗ install num 1.3                                                                                                                                                         
└─                                                
╶─ No changes have been performed

これはocamlfind内のnumが邪魔をしており、opamのnumが入らないからのようだ。 以下のように ocamlfind remove すればインストールできるようになった。

$ ocamlfind remove num num-top
Removed /home/kubo39/.opam/4.07.0/lib/num/META
Removed /home/kubo39/.opam/4.07.0/lib/num
Removed /home/kubo39/.opam/4.07.0/lib/num-top/META
Removed /home/kubo39/.opam/4.07.0/lib/num-top
$ opam install coq          
The following actions will be performed: 
  ∗ install num 1.3     [required by coq]                                       
  ∗ install coq 8.10.1*    
===== ∗ 2 =====                 
Do you want to continue? [Y/n] y
                                                                                
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[coq.8.10.1] found in cache
[num.1.3] found in cache                                                        
                                                                                                                                                      
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed num.1.3                                                  
∗ installed coq.8.10.1
Done.