问题描述
我正在尝试安装 tcoq ,但出现以下错误:
I was trying to install tcoq and I had the following error:
"/Users/pinocchio/.opam/4.05.0/bin/ocamlfind" ocamlc -rectypes -w -3-52-56 -c grammar/compat5.ml
OCAMLC -c -pp grammar/gramCompat.mlp
>> Fatal error: OCaml and preprocessor have incompatible versions
Fatal error: exception Misc.Fatal_error
make[1]: *** [grammar/gramCompat.cmo] Error 2
make: *** [submake] Error 2
有人知道吗?
- 错误是什么意思?
- 如何解决?
我在网上看到了相关的帖子:
I saw related post online:
https://coq-club.inria.narkive.com/h4i0KOH0/problem-compiling-coq
但是它并不是很有帮助.我做到了:
but it wasn't terribly helpful. I did:
ocaml -I +camlp5
按照他们的建议,似乎工作正常……
as they suggested and it seems to be working fine...
我确实做了make clean
,但这没有帮助.
I did do make clean
but that didn't help.
我刚刚意识到我跳过了INSTALL的第3步,但是如果idk与问题或我想怎么做有关,则为idk:
I just realized I skipped step 3 of the INSTALL but idk if its related to the issue or what Im suppose to do with it:
3- The uncompression and un-tarring of the distribution file gave birth
to a directory named "coq-8.xx". You can rename this directory and put
it wherever you want. Just keep in mind that you will need some spare
space during the compilation (reckon on about 300 Mb of disk space
for the whole system in native-code compilation). Once installed, the
binaries take about 30 Mb, and the library about 200 Mb.
我正在尝试安装游戏手柄,要做到这一点,需要遵循说明.特别是,我运行了以下3个命令:
I am trying to install gamepad and to do it one needs to follow instructions. In particular I ran the following 3 commands:
opam switch 4.05.0
opam install camlp4
opam install ocamlfind
最新错误:
Most current error:
make
/Library/Developer/CommandLineTools/usr/bin/make --warn-undefined-variable --no-builtin-rules -f Makefile.build
OCAMLC -c -pp grammar/gramCompat.mlp
>> Fatal error: OCaml and preprocessor have incompatible versions
Fatal error: exception Misc.Fatal_error
make[1]: *** [grammar/gramCompat.cmo] Error 2
make: *** [submake] Error 2
阅读该错误后,我奇迹般地打印了ocaml
和camlp5
的版本:
after reading that error it miraculously occurred to me to print the version of both ocaml
and camlp5
:
$ camlp5 -v
Camlp5 version 7.07 (ocaml 4.07.0)
和:
ocaml
OCaml version 4.05.0
显然这是错误的,所以也许第一步是要修复camlp5
以使其与4.05.0
一起使用,因为那是我需要的那个.
so obviously thats wrong, so perhaps first step is to fix camlp5
to work with 4.05.0
since thats the one I need.
我尝试卸载camlp5
,但拒绝了!
I tried uninstalling camlp5
but it refused!
brew uninstall camlp5
Error: Refusing to uninstall /usr/local/Cellar/camlp5/7.07
because it is required by coq, which is currently installed.
You can override this and force removal with:
brew uninstall --ignore-dependencies camlp5
推荐答案
似乎您已经知道错误的含义.本地camlp5
可执行文件所针对的OCaml版本与通过opam
使用的OCaml版本不同.让我直接切换(意为双关语)到您问题的第二部分.
It seems you already figured out what the error means. The version of OCaml to which your local camlp5
executable is targeted at differs from the OCaml version you are using through opam
. Let me switch (pun intended) directly to the second part of your question.
这里的主要问题来自以下事实:您为OCaml软件包使用了两种不同的来源,即软件包管理器(例如brew
)和opam
.为了解决您的问题,您应该仅从一个来源安装这些软件包.我建议使用opam
,因为它可以让您通过开关轻松管理不同的OCaml版本.
The main problem here comes from the fact that you are using two different sources for OCaml packages, namely your package manager (e.g. brew
) and opam
. In order to fix your issue, you should install those packages from only one source. I would recommend opam
, as it allows you to easily manage differenct OCaml versions through switches.
例如,使用
brew uninstall camlp5
然后使用opam
安装它:
opam install camlp5
此建议也适用于其他OCaml软件包,例如ocamlbuild
,camlp4
等.
This advice also applies to other OCaml packages like ocamlbuild
, camlp4
, etc.
这篇关于安装tcoq时,OCaml和预处理器具有不兼容的版本错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!