1. 程式人生 > >編譯opam報錯

編譯opam報錯

opam google gdrive

0x01:打算在VPS上安裝個Google的網盤,環境需要安裝OPAM,在檢查環境時就提示缺少not found的一些包。

#./configure
checking for OCaml findlib package unix... found
checking for OCaml findlib package extlib... not found
checking for OCaml findlib package re... not found
checking for OCaml findlib package re.str... not found
checking for OCaml findlib package re.pcre... not found
checking for OCaml findlib package re.glob... not found
checking for OCaml findlib package cmdliner... not found
checking for OCaml findlib package ocamlgraph... not found
checking for OCaml findlib package cudf... not found
checking for OCaml findlib package dose3.common... not found
checking for OCaml findlib package dose3.algo... not found
checking for OCaml findlib package jsonm... not found

0x02:心想也許直接make能過去,結果是下面一樣報錯了。

#make
make -C src opam-lib
make[1]: Entering directory ‘/home/roott/opam/src‘
make[1]: *** No rule to make target ‘opam-lib‘.  Stop.
make[1]: Leaving directory ‘/home/roott/opam/src‘
Makefile:26: recipe for target ‘opam-lib‘ failed
make: *** [opam-lib] Error 2


0x03:按照檢查提示,用‘make lib-ext’可以自動下載。

============================================================================
Some dependencies are missing. If you are just interested in the stand-alone
‘opam‘ binary, run ‘make lib-ext‘ to download and include them.
============================================================================

0x04:經過make lib-ext後下載原來鏈接失效了,造成cppo-1.1.2.tar.gz解壓失敗。

# make lib-ext
make -C src_ext lib-ext
make[1]: Entering directory ‘/home/roott/opam/src_ext‘
[ -e  cppo-1.1.2.tar.gz ] || curl  -OL http://mjambon.com/releases/cppo/cppo-1.1.2.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  9340  100  9340    0     0  97476      0 --:--:-- --:--:-- --:--:-- 97291
ocaml ../shell/md5check.ml cppo-1.1.2.tar.gz f1a551639c0c667ee8840d95ea5b2ab7
MD5 for cppo-1.1.2.tar.gz differ:
  expected: f1a551639c0c667ee8840d95ea5b2ab7
    actual: baeb004575d58a7b186737a3be6d5f07
mkdir -p tmp
cd tmp && tar xfz ../cppo-1.1.2.tar.gz
tar (child): ../cppo-1.1.2.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Makefile:58: recipe for target ‘cppo.stamp‘ failed
make[1]: *** [cppo.stamp] Error 2
make[1]: Leaving directory ‘/home/roott/opam/src_ext‘
Makefile:29: recipe for target ‘lib-ext‘ failed
make: *** [lib-ext] Error 2

0x05:到/home/root/opam/src_ext目錄下看到文件只有45字節肯定不對。

-rwxrwxr-x 1 root root    45 Jun 20 15:15 cppo-1.1.2.tar.gz

0x06:原鏈接失效只能手動下載cppo-1.1.2.tar.gz,google找到一個github上的一個鏈接

# wget https://github.com/mjambon/cppo/archive/v1.1.2.tar.gz

0x07:解壓cppo將裏面文件覆蓋到opam文件夾裏。我的opam放在home下

#tar -zxf v1.1.2.tar.gz
#mv -f cppo-1.1.2/ ~/opam/

0x08:覆蓋完再次‘make’,成功。

make
[15:35:12]echo ‘let cppo_version = "1.1.2"‘ > cppo_version.ml
[15:35:12]ocamlyacc cppo_parser.mly
[15:35:12]ocamllex cppo_lexer.mll
[15:35:12]368 states, 13139 transitions, table size 54764 bytes
[15:35:12]3729 additional bytes used for bindings
[15:35:12]ocamlopt -o cppo -dtypes unix.cmxa str.cmxa cppo_version.ml cppo_types.ml cppo_parser.mli cppo_parser.ml cppo_lexer.ml cppo_command.ml cppo_eval.ml cppo_main.ml
[15:35:14]cd ocamlbuild_plugin && ocamlbuild -use-ocamlfind ocamlbuild_cppo.cma ocamlbuild_cppo.cmxa ocamlbuild_cppo.a ocamlbuild_cppo.cmxs
[15:35:15]Finished, 8 targets (0 cached) in 00:00:00.
[15:35:31][email protected]:~/opam$ sudo make install
[15:35:37][sudo] password for roott: 
[15:35:38]install -m 0755 cppo /usr/local/bin || [15:35:38]        install -m 0755 cppo.exe /usr/local/bin
[15:35:38]ocamlfind install -patch-version 1.1.2 "cppo_ocamlbuild" [15:35:38]        META ocamlbuild_plugin/_build/ocamlbuild_cppo.cmi ocamlbuild_plugin/_build/ocamlbuild_cppo.cma ocamlbuild_plugin/_build/ocamlbuild_cppo.cmxa ocamlbuild_plugin/_build/ocamlbuild_cppo.a ocamlbuild_plugin/_build/ocamlbuild_cppo.cmxs
[15:35:38]Installed /usr/local/lib/ocaml/4.02.3/cppo_ocamlbuild/ocamlbuild_cppo.cmxs
[15:35:38]Installed /usr/local/lib/ocaml/4.02.3/cppo_ocamlbuild/ocamlbuild_cppo.a
[15:35:38]Installed /usr/local/lib/ocaml/4.02.3/cppo_ocamlbuild/ocamlbuild_cppo.cmxa
[15:35:38]Installed /usr/local/lib/ocaml/4.02.3/cppo_ocamlbuild/ocamlbuild_cppo.cma
[15:35:38]Installed /usr/local/lib/ocaml/4.02.3/cppo_ocamlbuild/ocamlbuild_cppo.cmi
[15:35:38]Installed /usr/local/lib/ocaml/4.02.3/cppo_ocamlbuild/META

0x09:在下面就是安裝。

#sudo make install





編譯opam報錯